@astral/ui 4.113.2 → 4.114.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/ActionGroup/ActionGroup.js +2 -2
- package/components/ActionGroup/SecondaryActions/SecondaryActions.d.ts +1 -1
- package/components/ActionGroup/SecondaryActions/SecondaryActions.js +2 -2
- package/components/ActionGroup/types.d.ts +9 -0
- package/components/DataGrid/DataGrid.js +13 -5
- package/components/DataGrid/DataGridContext/DataGridProvider/DataGridProvider.d.ts +3 -2
- package/components/DataGrid/DataGridContext/DataGridProvider/DataGridProvider.js +3 -2
- package/components/DataGrid/DataGridSelectionContext/DataGridSelectionContext.d.ts +25 -0
- package/components/DataGrid/DataGridSelectionContext/DataGridSelectionContext.js +13 -0
- package/components/DataGrid/DataGridSelectionContext/DataGridSelectionProvider/DataGridSelectionProvider.d.ts +7 -0
- package/components/DataGrid/DataGridSelectionContext/DataGridSelectionProvider/DataGridSelectionProvider.js +8 -0
- package/components/DataGrid/DataGridSelectionContext/DataGridSelectionProvider/index.d.ts +1 -0
- package/components/DataGrid/DataGridSelectionContext/DataGridSelectionProvider/index.js +1 -0
- package/components/DataGrid/DataGridSelectionContext/index.d.ts +2 -0
- package/components/DataGrid/DataGridSelectionContext/index.js +2 -0
- package/components/DataGrid/constants.d.ts +2 -0
- package/components/DataGrid/constants.js +2 -0
- package/components/DataGrid/styles.d.ts +4 -0
- package/components/DataGrid/styles.js +26 -0
- package/components/DataGrid/types.d.ts +7 -0
- package/components/DataGrid/useLogic/useLogic.d.ts +3 -1
- package/components/DataGrid/useLogic/useLogic.js +10 -2
- package/components/DataGrid/utils/checkIsMassActionsOpen/checkIsMassActionsOpen.d.ts +10 -0
- package/components/DataGrid/utils/checkIsMassActionsOpen/checkIsMassActionsOpen.js +4 -0
- package/components/DataGrid/utils/checkIsMassActionsOpen/index.d.ts +1 -0
- package/components/DataGrid/utils/checkIsMassActionsOpen/index.js +1 -0
- package/components/DataGrid/utils/index.d.ts +1 -0
- package/components/DataGrid/utils/index.js +1 -0
- package/components/DataGridInfinite/DataGridInfinite.js +17 -13
- package/components/DataGridInfinite/Footer/Footer.d.ts +6 -0
- package/components/DataGridInfinite/Footer/Footer.js +25 -0
- package/components/DataGridInfinite/Footer/index.d.ts +2 -0
- package/components/DataGridInfinite/Footer/index.js +1 -0
- package/components/DataGridInfinite/Footer/types.d.ts +26 -0
- package/components/DataGridInfinite/Footer/types.js +1 -0
- package/components/DataGridInfinite/constants.d.ts +1 -0
- package/components/DataGridInfinite/constants.js +1 -0
- package/components/DataGridInfinite/styles.d.ts +4 -0
- package/components/DataGridInfinite/styles.js +24 -0
- package/components/DataGridInfinite/useLogic/useLogic.d.ts +6 -3
- package/components/DataGridInfinite/useLogic/useLogic.js +32 -8
- package/components/DataGridMassActions/DataGridMassActions.d.ts +15 -0
- package/components/DataGridMassActions/DataGridMassActions.js +32 -0
- package/components/DataGridMassActions/constants.d.ts +4 -0
- package/components/DataGridMassActions/constants.js +5 -0
- package/components/DataGridMassActions/index.d.ts +2 -0
- package/components/DataGridMassActions/index.js +1 -0
- package/components/DataGridMassActions/public.d.ts +2 -0
- package/components/DataGridMassActions/public.js +1 -0
- package/components/DataGridMassActions/styles.d.ts +8 -0
- package/components/DataGridMassActions/styles.js +49 -0
- package/components/DataGridMassActions/tests/testDataGridMassActions.d.ts +23 -0
- package/components/DataGridMassActions/tests/testDataGridMassActions.js +77 -0
- package/components/DataGridMassActions/types.d.ts +2 -0
- package/components/DataGridMassActions/types.js +1 -0
- package/components/DataGridMassActions/useLogic/index.d.ts +1 -0
- package/components/DataGridMassActions/useLogic/index.js +1 -0
- package/components/DataGridMassActions/useLogic/useLogic.d.ts +6 -0
- package/components/DataGridMassActions/useLogic/useLogic.js +21 -0
- package/components/IconDropdownButton/IconDropdownButton.d.ts +5 -0
- package/components/IconDropdownButton/IconDropdownButton.js +2 -2
- package/components/MassActions/MassActions.d.ts +5 -0
- package/components/MassActions/MassActions.js +17 -0
- package/components/MassActions/constants.d.ts +6 -0
- package/components/MassActions/constants.js +12 -0
- package/components/MassActions/index.d.ts +2 -0
- package/components/MassActions/index.js +1 -0
- package/components/MassActions/styles.d.ts +34 -0
- package/components/MassActions/styles.js +43 -0
- package/components/MassActions/types.d.ts +20 -0
- package/components/MassActions/types.js +1 -0
- package/components/MassActions/useLogic/index.d.ts +1 -0
- package/components/MassActions/useLogic/index.js +1 -0
- package/components/MassActions/useLogic/useLogic.d.ts +7 -0
- package/components/MassActions/useLogic/useLogic.js +9 -0
- package/components/PageHeader/PageActions/SecondaryActions/styles.d.ts +1 -1
- package/components/Tree/TreeItem/MobileSlidePanel/MobileSlidePanelContent/useLogic/hooks/index.d.ts +0 -1
- package/components/Tree/TreeItem/MobileSlidePanel/MobileSlidePanelContent/useLogic/hooks/index.js +0 -1
- package/components/Tree/TreeItem/MobileSlidePanel/MobileSlidePanelContent/useLogic/useLogic.js +2 -1
- package/hook-form/FormToggleButtonGroup/FormToggleButtonGroup.d.ts +1 -1
- package/hook-form/FormToggleButtonGroup/FormToggleButtonGroup.js +2 -2
- package/node/components/ActionGroup/ActionGroup.js +2 -2
- package/node/components/ActionGroup/SecondaryActions/SecondaryActions.d.ts +1 -1
- package/node/components/ActionGroup/SecondaryActions/SecondaryActions.js +2 -2
- package/node/components/ActionGroup/types.d.ts +9 -0
- package/node/components/DataGrid/DataGrid.js +12 -4
- package/node/components/DataGrid/DataGridContext/DataGridProvider/DataGridProvider.d.ts +3 -2
- package/node/components/DataGrid/DataGridContext/DataGridProvider/DataGridProvider.js +3 -2
- package/node/components/DataGrid/DataGridSelectionContext/DataGridSelectionContext.d.ts +25 -0
- package/node/components/DataGrid/DataGridSelectionContext/DataGridSelectionContext.js +16 -0
- package/node/components/DataGrid/DataGridSelectionContext/DataGridSelectionProvider/DataGridSelectionProvider.d.ts +7 -0
- package/node/components/DataGrid/DataGridSelectionContext/DataGridSelectionProvider/DataGridSelectionProvider.js +12 -0
- package/node/components/DataGrid/DataGridSelectionContext/DataGridSelectionProvider/index.d.ts +1 -0
- package/node/components/DataGrid/DataGridSelectionContext/DataGridSelectionProvider/index.js +17 -0
- package/node/components/DataGrid/DataGridSelectionContext/index.d.ts +2 -0
- package/node/components/DataGrid/DataGridSelectionContext/index.js +18 -0
- package/node/components/DataGrid/constants.d.ts +2 -0
- package/node/components/DataGrid/constants.js +2 -0
- package/node/components/DataGrid/styles.d.ts +4 -0
- package/node/components/DataGrid/styles.js +27 -1
- package/node/components/DataGrid/types.d.ts +7 -0
- package/node/components/DataGrid/useLogic/useLogic.d.ts +3 -1
- package/node/components/DataGrid/useLogic/useLogic.js +9 -1
- package/node/components/DataGrid/utils/checkIsMassActionsOpen/checkIsMassActionsOpen.d.ts +10 -0
- package/node/components/DataGrid/utils/checkIsMassActionsOpen/checkIsMassActionsOpen.js +8 -0
- package/node/components/DataGrid/utils/checkIsMassActionsOpen/index.d.ts +1 -0
- package/node/components/DataGrid/utils/checkIsMassActionsOpen/index.js +5 -0
- package/node/components/DataGrid/utils/index.d.ts +1 -0
- package/node/components/DataGrid/utils/index.js +3 -1
- package/node/components/DataGridInfinite/DataGridInfinite.js +19 -15
- package/node/components/DataGridInfinite/Footer/Footer.d.ts +6 -0
- package/node/components/DataGridInfinite/Footer/Footer.js +29 -0
- package/node/components/DataGridInfinite/Footer/index.d.ts +2 -0
- package/node/components/DataGridInfinite/Footer/index.js +17 -0
- package/node/components/DataGridInfinite/Footer/types.d.ts +26 -0
- package/node/components/DataGridInfinite/Footer/types.js +2 -0
- package/node/components/DataGridInfinite/constants.d.ts +1 -0
- package/node/components/DataGridInfinite/constants.js +1 -0
- package/node/components/DataGridInfinite/styles.d.ts +4 -0
- package/node/components/DataGridInfinite/styles.js +27 -3
- package/node/components/DataGridInfinite/useLogic/useLogic.d.ts +6 -3
- package/node/components/DataGridInfinite/useLogic/useLogic.js +30 -6
- package/node/components/DataGridMassActions/DataGridMassActions.d.ts +15 -0
- package/node/components/DataGridMassActions/DataGridMassActions.js +36 -0
- package/node/components/DataGridMassActions/constants.d.ts +4 -0
- package/node/components/DataGridMassActions/constants.js +8 -0
- package/node/components/DataGridMassActions/index.d.ts +2 -0
- package/node/components/DataGridMassActions/index.js +5 -0
- package/node/components/DataGridMassActions/public.d.ts +2 -0
- package/node/components/DataGridMassActions/public.js +5 -0
- package/node/components/DataGridMassActions/styles.d.ts +8 -0
- package/node/components/DataGridMassActions/styles.js +52 -0
- package/node/components/DataGridMassActions/tests/testDataGridMassActions.d.ts +23 -0
- package/node/components/DataGridMassActions/tests/testDataGridMassActions.js +81 -0
- package/node/components/DataGridMassActions/types.d.ts +2 -0
- package/node/components/DataGridMassActions/types.js +2 -0
- package/node/components/DataGridMassActions/useLogic/index.d.ts +1 -0
- package/node/components/DataGridMassActions/useLogic/index.js +17 -0
- package/node/components/DataGridMassActions/useLogic/useLogic.d.ts +6 -0
- package/node/components/DataGridMassActions/useLogic/useLogic.js +25 -0
- package/node/components/IconDropdownButton/IconDropdownButton.d.ts +5 -0
- package/node/components/IconDropdownButton/IconDropdownButton.js +2 -2
- package/node/components/MassActions/MassActions.d.ts +5 -0
- package/node/components/MassActions/MassActions.js +21 -0
- package/node/components/MassActions/constants.d.ts +6 -0
- package/node/components/MassActions/constants.js +15 -0
- package/node/components/MassActions/index.d.ts +2 -0
- package/node/components/MassActions/index.js +5 -0
- package/node/components/MassActions/styles.d.ts +34 -0
- package/node/components/MassActions/styles.js +46 -0
- package/node/components/MassActions/types.d.ts +20 -0
- package/node/components/MassActions/types.js +2 -0
- package/node/components/MassActions/useLogic/index.d.ts +1 -0
- package/node/components/MassActions/useLogic/index.js +17 -0
- package/node/components/MassActions/useLogic/useLogic.d.ts +7 -0
- package/node/components/MassActions/useLogic/useLogic.js +13 -0
- package/node/components/PageHeader/PageActions/SecondaryActions/styles.d.ts +1 -1
- package/node/components/Tree/TreeItem/MobileSlidePanel/MobileSlidePanelContent/useLogic/hooks/index.d.ts +0 -1
- package/node/components/Tree/TreeItem/MobileSlidePanel/MobileSlidePanelContent/useLogic/hooks/index.js +0 -1
- package/node/components/Tree/TreeItem/MobileSlidePanel/MobileSlidePanelContent/useLogic/useLogic.js +2 -1
- package/node/hook-form/FormToggleButtonGroup/FormToggleButtonGroup.d.ts +1 -1
- package/node/hook-form/FormToggleButtonGroup/FormToggleButtonGroup.js +2 -2
- package/package.json +1 -1
- /package/components/{Tree/TreeItem/MobileSlidePanel/MobileSlidePanelContent/useLogic/hooks/useDelayedUnmount → useDelayedUnmount}/index.d.ts +0 -0
- /package/components/{Tree/TreeItem/MobileSlidePanel/MobileSlidePanelContent/useLogic/hooks/useDelayedUnmount → useDelayedUnmount}/index.js +0 -0
- /package/components/{Tree/TreeItem/MobileSlidePanel/MobileSlidePanelContent/useLogic/hooks/useDelayedUnmount → useDelayedUnmount}/useDelayedUnmount.d.ts +0 -0
- /package/components/{Tree/TreeItem/MobileSlidePanel/MobileSlidePanelContent/useLogic/hooks/useDelayedUnmount → useDelayedUnmount}/useDelayedUnmount.js +0 -0
- /package/node/components/{Tree/TreeItem/MobileSlidePanel/MobileSlidePanelContent/useLogic/hooks/useDelayedUnmount → useDelayedUnmount}/index.d.ts +0 -0
- /package/node/components/{Tree/TreeItem/MobileSlidePanel/MobileSlidePanelContent/useLogic/hooks/useDelayedUnmount → useDelayedUnmount}/index.js +0 -0
- /package/node/components/{Tree/TreeItem/MobileSlidePanel/MobileSlidePanelContent/useLogic/hooks/useDelayedUnmount → useDelayedUnmount}/useDelayedUnmount.d.ts +0 -0
- /package/node/components/{Tree/TreeItem/MobileSlidePanel/MobileSlidePanelContent/useLogic/hooks/useDelayedUnmount → useDelayedUnmount}/useDelayedUnmount.js +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Footer"), exports);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type FooterContext = {
|
|
2
|
+
/**
|
|
3
|
+
* Флаг состояния загрузки
|
|
4
|
+
*/
|
|
5
|
+
isLoading?: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Флаг состояния ошибки
|
|
8
|
+
*/
|
|
9
|
+
isError?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Флаг достижения конца списка
|
|
12
|
+
*/
|
|
13
|
+
isEndReached?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Текст достижения конца списка
|
|
16
|
+
*/
|
|
17
|
+
endOfScrollMsg?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Обработчик повторной загрузки при ошибке
|
|
20
|
+
*/
|
|
21
|
+
onRetry: () => void;
|
|
22
|
+
/**
|
|
23
|
+
* Флаг наличия массовых действий
|
|
24
|
+
*/
|
|
25
|
+
hasMassActions: boolean;
|
|
26
|
+
};
|
|
@@ -9,4 +9,5 @@ exports.VIRTUOSO_LIST_ID = 'virtuoso-list';
|
|
|
9
9
|
exports.dataGridInfiniteClassnames = {
|
|
10
10
|
scrollToTopButton: (0, createUIKitClassname_1.createUIKitClassname)('data-grid-infinite__scroll-to-top-button'),
|
|
11
11
|
visibleScrollToTopButton: (0, createUIKitClassname_1.createUIKitClassname)('data-grid-infinite__scroll-to-top-button_visible'),
|
|
12
|
+
massActionsSpacer: (0, createUIKitClassname_1.createUIKitClassname)('data-grid-infinite__mass-actions-spacer'),
|
|
12
13
|
};
|
|
@@ -30,3 +30,7 @@ export declare const StyledContainer: import("@emotion/styled/dist/declarations/
|
|
|
30
30
|
} & import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
31
31
|
theme?: import("@emotion/react").Theme | undefined;
|
|
32
32
|
}, {}, {}>;
|
|
33
|
+
export declare const MassActionsSpacer: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
|
|
34
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
35
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
36
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StyledContainer = exports.StyledScrollToTopButton = exports.Backdrop = exports.HeaderRow = exports.FooterRow = exports.DisabledDataGridWrapper = exports.DataGridWrapper = void 0;
|
|
3
|
+
exports.MassActionsSpacer = exports.StyledContainer = exports.StyledScrollToTopButton = exports.Backdrop = exports.HeaderRow = exports.FooterRow = exports.DisabledDataGridWrapper = exports.DataGridWrapper = void 0;
|
|
4
|
+
const constants_1 = require("../DataGrid/constants");
|
|
4
5
|
const styles_1 = require("../DataGrid/styles");
|
|
5
6
|
const ScrollToTopButton_1 = require("../ScrollToTopButton");
|
|
6
7
|
const styled_1 = require("../styled");
|
|
7
|
-
const
|
|
8
|
+
const constants_2 = require("./constants");
|
|
8
9
|
const List_1 = require("./List");
|
|
9
10
|
exports.DataGridWrapper = styled_1.styled.div `
|
|
10
11
|
position: relative;
|
|
@@ -50,11 +51,31 @@ exports.Backdrop = styled_1.styled.div `
|
|
|
50
51
|
exports.StyledScrollToTopButton = (0, styled_1.styled)(ScrollToTopButton_1.ScrollToTopButton) `
|
|
51
52
|
display: none;
|
|
52
53
|
|
|
53
|
-
&.${
|
|
54
|
+
&.${constants_2.dataGridInfiniteClassnames.visibleScrollToTopButton} {
|
|
54
55
|
display: inline-flex;
|
|
55
56
|
}
|
|
56
57
|
`;
|
|
57
58
|
exports.StyledContainer = (0, styled_1.styled)(styles_1.Container) `
|
|
59
|
+
&.${constants_1.dataGridClassnames.hasMassActions} {
|
|
60
|
+
/* Резерв места под панель массовых действий убирается одновременно с анимацией её скрытия, чтобы строки не прыгали */
|
|
61
|
+
& .${constants_2.dataGridInfiniteClassnames.massActionsSpacer} {
|
|
62
|
+
transition: height
|
|
63
|
+
${({ theme }) => theme.transitions.duration.leavingScreen}ms
|
|
64
|
+
${({ theme }) => theme.transitions.easing.easeIn};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&.${constants_1.dataGridClassnames.massActionsOpen} {
|
|
68
|
+
& .${constants_2.dataGridInfiniteClassnames.massActionsSpacer} {
|
|
69
|
+
height: var(--mass-actions-reserved-space);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* Кнопка «Наверх» скрыта при открытой панели, чтобы не перегружать интерфейс */
|
|
73
|
+
& .${constants_2.dataGridInfiniteClassnames.scrollToTopButton} {
|
|
74
|
+
display: none;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
58
79
|
${({ theme }) => theme.breakpoints.down('mobile')} {
|
|
59
80
|
& .${List_1.dataGridInfiniteListClassnames.root} {
|
|
60
81
|
display: flex;
|
|
@@ -63,3 +84,6 @@ exports.StyledContainer = (0, styled_1.styled)(styles_1.Container) `
|
|
|
63
84
|
}
|
|
64
85
|
}
|
|
65
86
|
`;
|
|
87
|
+
exports.MassActionsSpacer = styled_1.styled.div `
|
|
88
|
+
height: 0;
|
|
89
|
+
`;
|
|
@@ -2,9 +2,13 @@ import { type ChangeEvent } from 'react';
|
|
|
2
2
|
import type { ListRange } from 'react-virtuoso';
|
|
3
3
|
import { type DataGridRow } from '../../DataGrid';
|
|
4
4
|
import { type CellValue } from '../../DataGrid/types';
|
|
5
|
+
import { type FooterContext } from '../Footer';
|
|
5
6
|
import { type DataGridInfiniteProps, type DataGridInfiniteVirtuosoHandle } from '../types';
|
|
6
7
|
type UseLogicParams<TData extends Record<string, CellValue> = DataGridRow, TSortField extends keyof TData = keyof TData> = DataGridInfiniteProps<TData, TSortField>;
|
|
7
|
-
export declare const useLogic: <TData extends Record<string, unknown> = DataGridRow, TSortField extends keyof TData = keyof TData>({ keyId, columns, rows, variant, tree, subrows, selectedRows, maxHeight, isLoading, isError, isDisabled, isEndReached, onEndReached, onStartReached, isStartReached, onSelectRow, isHideSelectAll, initialVisibleItemIndex, isHideHeaderIfNoData, gridViewMode: gridViewModeProp, mobileDisplayVariant, virtuosoRef, }: UseLogicParams<TData, TSortField>) => {
|
|
8
|
+
export declare const useLogic: <TData extends Record<string, unknown> = DataGridRow, TSortField extends keyof TData = keyof TData>({ keyId, columns, rows, variant, tree, subrows, selectedRows, maxHeight, isLoading, isError, isDisabled, isEndReached, endOfScrollMsg, onRetry, onEndReached, onStartReached, isStartReached, onSelectRow, isHideSelectAll, initialVisibleItemIndex, isHideHeaderIfNoData, gridViewMode: gridViewModeProp, massActions, mobileDisplayVariant, virtuosoRef, }: UseLogicParams<TData, TSortField>) => {
|
|
9
|
+
footerContext: FooterContext;
|
|
10
|
+
hasMassActions: boolean;
|
|
11
|
+
isMassActionsOpen: boolean;
|
|
8
12
|
containerCssVars: import("react").CSSProperties;
|
|
9
13
|
mobileSkeletonProps: {
|
|
10
14
|
cellsCount: number;
|
|
@@ -19,7 +23,6 @@ export declare const useLogic: <TData extends Record<string, unknown> = DataGrid
|
|
|
19
23
|
expandedLevel?: number | undefined;
|
|
20
24
|
initialVisibleChildrenCount?: number | undefined;
|
|
21
25
|
} | undefined;
|
|
22
|
-
isEndReached: boolean | undefined;
|
|
23
26
|
isHideHead: boolean;
|
|
24
27
|
hasGroupedColumns: boolean;
|
|
25
28
|
gridViewMode: "standard" | "full";
|
|
@@ -32,7 +35,7 @@ export declare const useLogic: <TData extends Record<string, unknown> = DataGrid
|
|
|
32
35
|
ref: (node: DataGridInfiniteVirtuosoHandle | null) => void;
|
|
33
36
|
endReached: () => void;
|
|
34
37
|
rangeChanged: (range: ListRange) => void;
|
|
35
|
-
totalListHeightChanged: () => void;
|
|
38
|
+
totalListHeightChanged: (listHeight: number) => void;
|
|
36
39
|
startReached: () => void;
|
|
37
40
|
firstItemIndex: number;
|
|
38
41
|
};
|
|
@@ -10,7 +10,7 @@ const useViewportType_1 = require("../../useViewportType");
|
|
|
10
10
|
const prop_1 = require("../../utils/prop");
|
|
11
11
|
const uniqueBy_1 = require("../../utils/uniqueBy");
|
|
12
12
|
const constants_2 = require("../constants");
|
|
13
|
-
const useLogic = ({ keyId, columns, rows, variant, tree, subrows, selectedRows = [], maxHeight, isLoading, isError, isDisabled, isEndReached, onEndReached, onStartReached, isStartReached, onSelectRow, isHideSelectAll, initialVisibleItemIndex, isHideHeaderIfNoData = false, gridViewMode: gridViewModeProp = 'standard', mobileDisplayVariant = variant === 'subrows' ? 'cards' : 'list', virtuosoRef, }) => {
|
|
13
|
+
const useLogic = ({ keyId, columns, rows, variant, tree, subrows, selectedRows = [], maxHeight, isLoading, isError, isDisabled, isEndReached, endOfScrollMsg, onRetry, onEndReached, onStartReached, isStartReached, onSelectRow, isHideSelectAll, initialVisibleItemIndex, isHideHeaderIfNoData = false, gridViewMode: gridViewModeProp = 'standard', massActions, mobileDisplayVariant = variant === 'subrows' ? 'cards' : 'list', virtuosoRef, }) => {
|
|
14
14
|
const virtuoso = (0, react_1.useRef)(null);
|
|
15
15
|
const handleVirtuosoRef = (0, react_1.useCallback)((node) => {
|
|
16
16
|
virtuoso.current = node;
|
|
@@ -115,11 +115,11 @@ const useLogic = ({ keyId, columns, rows, variant, tree, subrows, selectedRows =
|
|
|
115
115
|
const handleScrollToTop = () => {
|
|
116
116
|
virtuoso.current?.scrollIntoView({ index: 0, behavior: 'smooth' });
|
|
117
117
|
};
|
|
118
|
-
const recalculateVerticalScroll = () => {
|
|
118
|
+
const recalculateVerticalScroll = (listHeight) => {
|
|
119
119
|
const container = document.getElementById(constants_2.VIRTUOSO_CONTAINER_ID);
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
setHasVerticalScroll(
|
|
120
|
+
if (container) {
|
|
121
|
+
const massActionsSpacerHeight = container.querySelector(`.${constants_2.dataGridInfiniteClassnames.massActionsSpacer}`)?.clientHeight ?? 0;
|
|
122
|
+
setHasVerticalScroll(listHeight - massActionsSpacerHeight > container.clientHeight);
|
|
123
123
|
}
|
|
124
124
|
};
|
|
125
125
|
const isHideHead = isHideHeaderIfNoData && rows.length === 0;
|
|
@@ -133,14 +133,38 @@ const useLogic = ({ keyId, columns, rows, variant, tree, subrows, selectedRows =
|
|
|
133
133
|
const isNotRenderHeader = (!isLoading && !isError && !isStartReached) ||
|
|
134
134
|
!onStartReached ||
|
|
135
135
|
isStartReached;
|
|
136
|
+
const hasMassActions = Boolean(massActions);
|
|
137
|
+
const isMassActionsOpen = (0, utils_1.checkIsMassActionsOpen)({
|
|
138
|
+
hasMassActions,
|
|
139
|
+
selectedRowsCount: selectedRows.length,
|
|
140
|
+
isMobile,
|
|
141
|
+
});
|
|
142
|
+
const footerContext = (0, react_1.useMemo)(() => ({
|
|
143
|
+
isLoading,
|
|
144
|
+
isError,
|
|
145
|
+
isEndReached: isEndReached && hasVerticalScroll,
|
|
146
|
+
endOfScrollMsg,
|
|
147
|
+
onRetry,
|
|
148
|
+
hasMassActions,
|
|
149
|
+
}), [
|
|
150
|
+
isLoading,
|
|
151
|
+
isError,
|
|
152
|
+
isEndReached,
|
|
153
|
+
hasVerticalScroll,
|
|
154
|
+
endOfScrollMsg,
|
|
155
|
+
onRetry,
|
|
156
|
+
hasMassActions,
|
|
157
|
+
]);
|
|
136
158
|
return {
|
|
159
|
+
footerContext,
|
|
160
|
+
hasMassActions,
|
|
161
|
+
isMassActionsOpen,
|
|
137
162
|
containerCssVars,
|
|
138
163
|
mobileSkeletonProps,
|
|
139
164
|
isNoData,
|
|
140
165
|
isMobile,
|
|
141
166
|
isDataGridDisabled,
|
|
142
167
|
treeRenderConfig,
|
|
143
|
-
isEndReached: isEndReached && hasVerticalScroll,
|
|
144
168
|
isHideHead,
|
|
145
169
|
hasGroupedColumns,
|
|
146
170
|
gridViewMode,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type DataGridMassActionsProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Панель массовых действий над выбранными строками `DataGrid` и `DataGridInfinite`.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* <DataGrid
|
|
7
|
+
* massActions={
|
|
8
|
+
* <DataGridMassActions
|
|
9
|
+
* entityDeclension={['документ', 'документа', 'документов']}
|
|
10
|
+
* main={[{ text: 'Отправить', onClick: handleSend }]}
|
|
11
|
+
* />
|
|
12
|
+
* }
|
|
13
|
+
* />
|
|
14
|
+
*/
|
|
15
|
+
export declare const DataGridMassActions: ({ className, ...props }: DataGridMassActionsProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataGridMassActions = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const cva_1 = require("../utils/cva");
|
|
6
|
+
const constants_1 = require("./constants");
|
|
7
|
+
const styles_1 = require("./styles");
|
|
8
|
+
const useLogic_1 = require("./useLogic");
|
|
9
|
+
const rootCva = (0, cva_1.cva)(constants_1.dataGridMassActionsClassnames.root, {
|
|
10
|
+
variants: {
|
|
11
|
+
isOpen: {
|
|
12
|
+
true: constants_1.dataGridMassActionsClassnames.open,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
/**
|
|
17
|
+
* Панель массовых действий над выбранными строками `DataGrid` и `DataGridInfinite`.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* <DataGrid
|
|
21
|
+
* massActions={
|
|
22
|
+
* <DataGridMassActions
|
|
23
|
+
* entityDeclension={['документ', 'документа', 'документов']}
|
|
24
|
+
* main={[{ text: 'Отправить', onClick: handleSend }]}
|
|
25
|
+
* />
|
|
26
|
+
* }
|
|
27
|
+
* />
|
|
28
|
+
*/
|
|
29
|
+
const DataGridMassActions = ({ className, ...props }) => {
|
|
30
|
+
const { isOpen, isMounted, selectedCount, handleClose } = (0, useLogic_1.useLogic)();
|
|
31
|
+
if (!isOpen && !isMounted) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
return ((0, jsx_runtime_1.jsx)(styles_1.StyledMassActions, { ...props, className: rootCva({ isOpen, className }), selectedCount: selectedCount, onClose: handleClose }));
|
|
35
|
+
};
|
|
36
|
+
exports.DataGridMassActions = DataGridMassActions;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dataGridMassActionsClassnames = void 0;
|
|
4
|
+
const createUIKitClassname_1 = require("../utils/createUIKitClassname");
|
|
5
|
+
exports.dataGridMassActionsClassnames = {
|
|
6
|
+
root: (0, createUIKitClassname_1.createUIKitClassname)('data-grid-mass-actions'),
|
|
7
|
+
open: (0, createUIKitClassname_1.createUIKitClassname)('data-grid-mass-actions_open'),
|
|
8
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataGridMassActions = void 0;
|
|
4
|
+
var DataGridMassActions_1 = require("./DataGridMassActions");
|
|
5
|
+
Object.defineProperty(exports, "DataGridMassActions", { enumerable: true, get: function () { return DataGridMassActions_1.DataGridMassActions; } });
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataGridMassActions = void 0;
|
|
4
|
+
var DataGridMassActions_1 = require("./DataGridMassActions");
|
|
5
|
+
Object.defineProperty(exports, "DataGridMassActions", { enumerable: true, get: function () { return DataGridMassActions_1.DataGridMassActions; } });
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const StyledMassActions: import("@emotion/styled/dist/declarations/src/types").StyledComponent<Pick<import("..").ActionGroupProps, "main" | "secondary"> & {
|
|
2
|
+
selectedCount: number;
|
|
3
|
+
entityDeclension: [string, string, string];
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
className?: string | undefined;
|
|
6
|
+
} & {
|
|
7
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
8
|
+
}, {}, {}>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StyledMassActions = void 0;
|
|
4
|
+
const MassActions_1 = require("../MassActions");
|
|
5
|
+
const styled_1 = require("../styled");
|
|
6
|
+
const constants_1 = require("./constants");
|
|
7
|
+
const slideIn = (0, styled_1.keyframes) `
|
|
8
|
+
from {
|
|
9
|
+
transform: translateY(100%);
|
|
10
|
+
|
|
11
|
+
opacity: 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
to {
|
|
15
|
+
transform: translateY(0);
|
|
16
|
+
|
|
17
|
+
opacity: 1;
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
const slideOut = (0, styled_1.keyframes) `
|
|
21
|
+
from {
|
|
22
|
+
transform: translateY(0);
|
|
23
|
+
|
|
24
|
+
opacity: 1;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
to {
|
|
28
|
+
transform: translateY(100%);
|
|
29
|
+
|
|
30
|
+
opacity: 0;
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
exports.StyledMassActions = (0, styled_1.styled)(MassActions_1.MassActions) `
|
|
34
|
+
position: absolute;
|
|
35
|
+
z-index: ${({ theme }) => theme.zIndex.appBar};
|
|
36
|
+
right: 0;
|
|
37
|
+
bottom: ${({ theme }) => theme.spacing(3)};
|
|
38
|
+
left: 0;
|
|
39
|
+
|
|
40
|
+
max-width: calc(100% - ${({ theme }) => theme.spacing(8)});
|
|
41
|
+
margin-inline: auto;
|
|
42
|
+
|
|
43
|
+
animation: ${slideOut}
|
|
44
|
+
${({ theme }) => theme.transitions.duration.leavingScreen}ms
|
|
45
|
+
${({ theme }) => theme.transitions.easing.easeIn} forwards;
|
|
46
|
+
|
|
47
|
+
&.${constants_1.dataGridMassActionsClassnames.open} {
|
|
48
|
+
animation: ${slideIn}
|
|
49
|
+
${({ theme }) => theme.transitions.duration.standard}ms
|
|
50
|
+
${({ theme }) => theme.transitions.easing.easeOut} forwards;
|
|
51
|
+
}
|
|
52
|
+
`;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type ReactElement, type ReactNode } from 'react';
|
|
2
|
+
import { type DataGridColumns } from '../../DataGrid/types';
|
|
3
|
+
type DataItem = {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
};
|
|
7
|
+
type GridRenderProps = {
|
|
8
|
+
rows: DataItem[];
|
|
9
|
+
columns: DataGridColumns<DataItem>[];
|
|
10
|
+
selectedRows: DataItem[];
|
|
11
|
+
onSelectRow: (rows: DataItem[]) => void;
|
|
12
|
+
massActions: ReactNode;
|
|
13
|
+
onRetry: () => void;
|
|
14
|
+
};
|
|
15
|
+
type TestDataGridMassActionsParams = {
|
|
16
|
+
render: (ui: ReactElement) => void;
|
|
17
|
+
renderGrid: (props: GridRenderProps) => ReactNode;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Общие тесты связки таблицы и DataGridMassActions для DataGrid и DataGridInfinite
|
|
21
|
+
*/
|
|
22
|
+
export declare const testDataGridMassActions: ({ render, renderGrid, }: TestDataGridMassActionsParams) => void;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.testDataGridMassActions = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const tests_1 = require("@ui/dev/tests");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const vitest_1 = require("vitest");
|
|
8
|
+
const DataGridMassActions_1 = require("../DataGridMassActions");
|
|
9
|
+
const TEST_ROWS = [
|
|
10
|
+
{ id: '1', name: 'Договор поставки' },
|
|
11
|
+
{ id: '2', name: 'Счёт-фактура' },
|
|
12
|
+
];
|
|
13
|
+
const TEST_COLUMNS = [
|
|
14
|
+
{
|
|
15
|
+
field: 'name',
|
|
16
|
+
label: 'Наименование',
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
/**
|
|
20
|
+
* Общие тесты связки таблицы и DataGridMassActions для DataGrid и DataGridInfinite
|
|
21
|
+
*/
|
|
22
|
+
const testDataGridMassActions = ({ render, renderGrid, }) => {
|
|
23
|
+
const TestComponent = ({ initialSelectedRows, }) => {
|
|
24
|
+
const [selectedRows, setSelectedRows] = (0, react_1.useState)(initialSelectedRows);
|
|
25
|
+
return renderGrid({
|
|
26
|
+
rows: TEST_ROWS,
|
|
27
|
+
columns: TEST_COLUMNS,
|
|
28
|
+
selectedRows,
|
|
29
|
+
onSelectRow: setSelectedRows,
|
|
30
|
+
massActions: ((0, jsx_runtime_1.jsx)(DataGridMassActions_1.DataGridMassActions, { entityDeclension: ['документ', 'документа', 'документов'], main: [{ text: 'Отправить' }] })),
|
|
31
|
+
onRetry: () => { },
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
const setup = ({ initialSelectedRows = [], } = {}) => {
|
|
35
|
+
render((0, jsx_runtime_1.jsx)(TestComponent, { initialSelectedRows: initialSelectedRows }));
|
|
36
|
+
};
|
|
37
|
+
(0, vitest_1.beforeEach)(() => {
|
|
38
|
+
(0, tests_1.setWindowWidth)(tests_1.viewportSize.desktop.default.width);
|
|
39
|
+
});
|
|
40
|
+
(0, vitest_1.it)('Панель не отображается при пустом выборе', () => {
|
|
41
|
+
setup();
|
|
42
|
+
const closeButton = tests_1.screen.queryByRole('button', {
|
|
43
|
+
name: 'Снять выделение',
|
|
44
|
+
});
|
|
45
|
+
(0, vitest_1.expect)(closeButton).toBeNull();
|
|
46
|
+
});
|
|
47
|
+
(0, vitest_1.it)('Панель отображается при выборе строки', async () => {
|
|
48
|
+
setup();
|
|
49
|
+
// 0 - "Выбрать все", 1 - первая строка
|
|
50
|
+
await tests_1.userEvents.click(tests_1.screen.getAllByRole('checkbox')[1]);
|
|
51
|
+
(0, vitest_1.expect)(tests_1.screen.getByText('Выбрано: 1 документ')).toBeVisible();
|
|
52
|
+
});
|
|
53
|
+
(0, vitest_1.it)('Панель остаётся открытой после нажатия на действие, если выбор не очищен', async () => {
|
|
54
|
+
setup({ initialSelectedRows: TEST_ROWS });
|
|
55
|
+
await tests_1.userEvents.click(tests_1.screen.getByRole('button', { name: 'Отправить' }));
|
|
56
|
+
(0, vitest_1.expect)(tests_1.screen.getByText('Выбрано: 2 документа')).toBeVisible();
|
|
57
|
+
});
|
|
58
|
+
(0, vitest_1.it)('Выбор строк снимается при закрытии панели', async () => {
|
|
59
|
+
setup({ initialSelectedRows: TEST_ROWS });
|
|
60
|
+
await tests_1.userEvents.click(tests_1.screen.getByRole('button', { name: 'Снять выделение' }));
|
|
61
|
+
const checkedCheckboxes = tests_1.screen.queryAllByRole('checkbox', {
|
|
62
|
+
checked: true,
|
|
63
|
+
});
|
|
64
|
+
(0, vitest_1.expect)(checkedCheckboxes).toHaveLength(0);
|
|
65
|
+
});
|
|
66
|
+
(0, vitest_1.it)('Панель скрывается при закрытии', async () => {
|
|
67
|
+
setup({ initialSelectedRows: TEST_ROWS });
|
|
68
|
+
await tests_1.userEvents.click(tests_1.screen.getByRole('button', { name: 'Снять выделение' }));
|
|
69
|
+
// Панель размонтируется после анимации скрытия
|
|
70
|
+
await (0, vitest_1.expect)((0, tests_1.waitForElementToBeRemoved)(() => tests_1.screen.queryByRole('button', { name: 'Снять выделение' }))).resolves.toBeUndefined();
|
|
71
|
+
});
|
|
72
|
+
(0, vitest_1.it)('Панель не отображается на мобильных разрешениях', () => {
|
|
73
|
+
(0, tests_1.setWindowWidth)(tests_1.viewportSize.mobile.default.width);
|
|
74
|
+
setup({ initialSelectedRows: TEST_ROWS });
|
|
75
|
+
const closeButton = tests_1.screen.queryByRole('button', {
|
|
76
|
+
name: 'Снять выделение',
|
|
77
|
+
});
|
|
78
|
+
(0, vitest_1.expect)(closeButton).toBeNull();
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
exports.testDataGridMassActions = testDataGridMassActions;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useLogic';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./useLogic"), exports);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useLogic = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const DataGridSelectionContext_1 = require("../../DataGrid/DataGridSelectionContext");
|
|
6
|
+
const hooks_1 = require("../../theme/hooks");
|
|
7
|
+
const useDelayedUnmount_1 = require("../../useDelayedUnmount");
|
|
8
|
+
const useLogic = () => {
|
|
9
|
+
const { selectedRows, onSelectRow, isMassActionsOpen: isOpen, } = (0, react_1.useContext)(DataGridSelectionContext_1.DataGridSelectionContext);
|
|
10
|
+
const { transitions: { duration: { leavingScreen }, }, } = (0, hooks_1.useTheme)();
|
|
11
|
+
const { isMounted } = (0, useDelayedUnmount_1.useDelayedUnmount)({ isOpen, duration: leavingScreen });
|
|
12
|
+
// Во время анимации скрытия выбор уже пустой — показываем последнее количество выбранных строк
|
|
13
|
+
const [lastSelectedCount, setLastSelectedCount] = (0, react_1.useState)(selectedRows.length);
|
|
14
|
+
if (selectedRows.length > 0 && selectedRows.length !== lastSelectedCount) {
|
|
15
|
+
setLastSelectedCount(selectedRows.length);
|
|
16
|
+
}
|
|
17
|
+
const handleClose = () => onSelectRow?.([]);
|
|
18
|
+
return {
|
|
19
|
+
isOpen,
|
|
20
|
+
isMounted,
|
|
21
|
+
selectedCount: lastSelectedCount,
|
|
22
|
+
handleClose,
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
exports.useLogic = useLogic;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import { type IconButtonProps } from '../IconButton';
|
|
3
|
+
import { type MenuProps } from '../Menu';
|
|
3
4
|
export type IconDropdownButtonProps = IconButtonProps & {
|
|
4
5
|
/**
|
|
5
6
|
* Иконка кнопки
|
|
6
7
|
*/
|
|
7
8
|
icon: ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* Пропсы выпадающего меню
|
|
11
|
+
*/
|
|
12
|
+
popoverProps?: Omit<MenuProps, 'open' | 'anchorEl' | 'title' | 'children'>;
|
|
8
13
|
};
|
|
9
14
|
export declare const IconDropdownButton: import("react").ForwardRefExoticComponent<Omit<IconDropdownButtonProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -10,7 +10,7 @@ const react_1 = require("react");
|
|
|
10
10
|
const IconButton_1 = require("../IconButton");
|
|
11
11
|
const Menu_1 = require("../Menu");
|
|
12
12
|
const useMenu_1 = require("../useMenu");
|
|
13
|
-
exports.IconDropdownButton = (0, react_1.forwardRef)(({ children, icon, title, ...props }, ref) => {
|
|
13
|
+
exports.IconDropdownButton = (0, react_1.forwardRef)(({ children, icon, title, popoverProps, ...props }, ref) => {
|
|
14
14
|
const { open, anchorRef, handleOpenMenu, handleCloseMenu } = (0, useMenu_1.useMenu)(ref);
|
|
15
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ClickAwayListener_1.default, { onClickAway: handleCloseMenu, mouseEvent: "onMouseUp", children: (0, jsx_runtime_1.jsx)(IconButton_1.IconButton, { ...props, ref: anchorRef, onClick: handleOpenMenu, selected: open, title: title, children: icon }) }), (0, jsx_runtime_1.jsx)(Menu_1.Menu, { title: title, open: open, anchorEl: anchorRef.current, children: children })] }));
|
|
15
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ClickAwayListener_1.default, { onClickAway: handleCloseMenu, mouseEvent: "onMouseUp", children: (0, jsx_runtime_1.jsx)(IconButton_1.IconButton, { ...props, ref: anchorRef, onClick: handleOpenMenu, selected: open, title: title, children: icon }) }), (0, jsx_runtime_1.jsx)(Menu_1.Menu, { ...popoverProps, title: title, open: open, anchorEl: anchorRef.current, children: children })] }));
|
|
16
16
|
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type MassActionsProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Базовый компонент панели массовых действий
|
|
4
|
+
*/
|
|
5
|
+
export declare const MassActions: ({ main, secondary, selectedCount, entityDeclension, onClose, className, }: MassActionsProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MassActions = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const CrossOutlineMd_1 = require("../../icons/CrossOutlineMd");
|
|
6
|
+
const IconButton_1 = require("../IconButton");
|
|
7
|
+
const Tag_1 = require("../Tag");
|
|
8
|
+
const constants_1 = require("./constants");
|
|
9
|
+
const styles_1 = require("./styles");
|
|
10
|
+
const useLogic_1 = require("./useLogic");
|
|
11
|
+
/**
|
|
12
|
+
* Базовый компонент панели массовых действий
|
|
13
|
+
*/
|
|
14
|
+
const MassActions = ({ main, secondary, selectedCount, entityDeclension, onClose, className, }) => {
|
|
15
|
+
const { selectionLabel, reservedLabel } = (0, useLogic_1.useLogic)({
|
|
16
|
+
entityDeclension,
|
|
17
|
+
selectedCount,
|
|
18
|
+
});
|
|
19
|
+
return ((0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { className: className, children: [(0, jsx_runtime_1.jsx)(styles_1.StyledActionGroup, { main: main, secondary: secondary, secondaryPopoverProps: constants_1.SECONDARY_POPOVER_PROPS, size: "large" }), (0, jsx_runtime_1.jsxs)(styles_1.Selection, { children: [(0, jsx_runtime_1.jsxs)(styles_1.SelectionLabel, { children: [(0, jsx_runtime_1.jsx)(styles_1.ReservedLabel, { variant: "text", size: "large", label: reservedLabel, "aria-hidden": true }), (0, jsx_runtime_1.jsx)(Tag_1.Tag, { variant: "text", size: "large", label: selectionLabel, "aria-live": "polite" })] }), (0, jsx_runtime_1.jsx)(IconButton_1.IconButton, { variant: "text", "aria-label": "\u0421\u043D\u044F\u0442\u044C \u0432\u044B\u0434\u0435\u043B\u0435\u043D\u0438\u0435", onClick: onClose, children: (0, jsx_runtime_1.jsx)(CrossOutlineMd_1.CrossOutlineMd, {}) })] })] }));
|
|
20
|
+
};
|
|
21
|
+
exports.MassActions = MassActions;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type IconDropdownButtonProps } from '../IconDropdownButton';
|
|
2
|
+
export declare const SECONDARY_POPOVER_PROPS: IconDropdownButtonProps['popoverProps'];
|
|
3
|
+
/**
|
|
4
|
+
* Количество выбранных строк, под которое заранее резервируется ширина счётчика
|
|
5
|
+
*/
|
|
6
|
+
export declare const RESERVED_SELECTED_COUNT = 999;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RESERVED_SELECTED_COUNT = exports.SECONDARY_POPOVER_PROPS = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Смещение меню вверх от кнопки. Компенсирует margin-top 8px у меню из темы и оставляет отступ 8px до кнопки
|
|
6
|
+
*/
|
|
7
|
+
const ANCHOR_VERTICAL_POSITION = -16;
|
|
8
|
+
exports.SECONDARY_POPOVER_PROPS = {
|
|
9
|
+
anchorOrigin: { vertical: ANCHOR_VERTICAL_POSITION, horizontal: 'left' },
|
|
10
|
+
transformOrigin: { vertical: 'bottom', horizontal: 'left' },
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Количество выбранных строк, под которое заранее резервируется ширина счётчика
|
|
14
|
+
*/
|
|
15
|
+
exports.RESERVED_SELECTED_COUNT = 999;
|