@astral/ui 4.55.4 → 4.57.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/BottomDrawer/styles.js +1 -1
- package/components/CardGridInfinite/Footer/styles.js +1 -1
- package/components/CheckableTag/styles.js +1 -1
- package/components/Checkbox/styles.js +4 -2
- package/components/Chip/styles.js +1 -1
- package/components/CodeField/styles.js +1 -1
- package/components/ComplianceStatus/styles.js +1 -1
- package/components/ContentState/ContentState.d.ts +1 -1
- package/components/ContentState/ContentState.js +2 -2
- package/components/ContentState/types.d.ts +4 -0
- package/components/DashboardLayout/DashboardWrapper/styles.js +1 -1
- package/components/DashboardLayout/Header/styles.js +4 -4
- package/components/DashboardLayoutSkeleton/styles.js +1 -1
- package/components/DashboardSidebar/styles.js +2 -2
- package/components/DashboardSidebarSkeleton/styles.js +1 -1
- package/components/DataGrid/Body/Body.d.ts +1 -1
- package/components/DataGrid/Body/Body.js +14 -7
- package/components/DataGrid/Body/constants.d.ts +4 -0
- package/components/DataGrid/Body/constants.js +5 -0
- package/components/DataGrid/Body/styles.d.ts +0 -3
- package/components/DataGrid/Body/styles.js +14 -1
- package/components/DataGrid/Body/useLogic/index.d.ts +1 -0
- package/components/DataGrid/Body/useLogic/index.js +1 -0
- package/components/DataGrid/Body/useLogic/useLogic.d.ts +9 -0
- package/components/DataGrid/Body/useLogic/useLogic.js +15 -0
- package/components/DataGrid/Cell/Cell.js +20 -4
- package/components/DataGrid/Cell/constants.d.ts +7 -0
- package/components/DataGrid/Cell/constants.js +8 -0
- package/components/DataGrid/Cell/styles.d.ts +14 -0
- package/components/DataGrid/Cell/styles.js +47 -0
- package/components/DataGrid/Cell/useLogic/useLogic.d.ts +2 -0
- package/components/DataGrid/Cell/useLogic/useLogic.js +3 -2
- package/components/DataGrid/DataGrid.js +42 -8
- package/components/DataGrid/Head/Head.js +1 -1
- package/components/DataGrid/Head/styles.js +5 -1
- package/components/DataGrid/Loader/styles.js +4 -0
- package/components/DataGrid/MobileSkeleton/MobileSkeleton.d.ts +6 -0
- package/components/DataGrid/MobileSkeleton/MobileSkeleton.js +10 -0
- package/components/DataGrid/MobileSkeleton/index.d.ts +1 -0
- package/components/DataGrid/MobileSkeleton/index.js +1 -0
- package/components/DataGrid/MobileSkeleton/styles.d.ts +17 -0
- package/components/DataGrid/MobileSkeleton/styles.js +37 -0
- package/components/DataGrid/PinnedSections/Section/styles.js +2 -2
- package/components/DataGrid/Row/NestedChildren/styles.js +8 -3
- package/components/DataGrid/Row/Row.js +25 -8
- package/components/DataGrid/Row/constants.d.ts +8 -0
- package/components/DataGrid/Row/constants.js +8 -0
- package/components/DataGrid/Row/styles.d.ts +4 -9
- package/components/DataGrid/Row/styles.js +69 -17
- package/components/DataGrid/Row/types.d.ts +5 -1
- package/components/DataGrid/Row/useLogic/hooks/index.d.ts +1 -0
- package/components/DataGrid/Row/useLogic/hooks/index.js +1 -0
- package/components/DataGrid/Row/useLogic/hooks/useMobileLogic.d.ts +5 -0
- package/components/DataGrid/Row/useLogic/hooks/useMobileLogic.js +15 -0
- package/components/DataGrid/Row/useLogic/useLogic.d.ts +868 -3
- package/components/DataGrid/Row/useLogic/useLogic.js +28 -13
- package/components/DataGrid/constants.d.ts +4 -0
- package/components/DataGrid/constants.js +4 -0
- package/components/DataGrid/index.d.ts +1 -0
- package/components/DataGrid/index.js +1 -0
- package/components/DataGrid/styles.d.ts +0 -9
- package/components/DataGrid/styles.js +43 -12
- package/components/DataGrid/types.d.ts +7 -0
- package/components/DataGrid/useLogic/hooks/index.d.ts +1 -1
- package/components/DataGrid/useLogic/hooks/index.js +1 -1
- package/components/DataGrid/useLogic/hooks/useDataGridMobileLogic/index.d.ts +1 -0
- package/components/DataGrid/useLogic/hooks/useDataGridMobileLogic/index.js +1 -0
- package/components/DataGrid/useLogic/hooks/useDataGridMobileLogic/useDataGridMobileLogic.d.ts +16 -0
- package/components/DataGrid/useLogic/hooks/useDataGridMobileLogic/useDataGridMobileLogic.js +32 -0
- package/components/DataGrid/useLogic/hooks/usePinnedColumns/usePinnedColumns.js +11 -3
- package/components/DataGrid/useLogic/useLogic.d.ts +10 -4
- package/components/DataGrid/useLogic/useLogic.js +17 -12
- package/components/DataGrid/useLogic/utils/getIsAllowHorizontalScroll/getIsAllowHorizontalScroll.js +1 -1
- package/components/DataGrid/utils/getDataGridCssVars/getDataGridCssVars.d.ts +2 -0
- package/components/DataGrid/utils/getDataGridCssVars/getDataGridCssVars.js +5 -0
- package/components/DataGrid/utils/getDataGridCssVars/index.d.ts +1 -0
- package/components/DataGrid/utils/getDataGridCssVars/index.js +1 -0
- package/components/DataGrid/utils/index.d.ts +1 -0
- package/components/DataGrid/utils/index.js +1 -0
- package/components/DataGridActionCell/DataGridSecondaryActions/DataGridSecondaryActions.js +1 -1
- package/components/DataGridInfinite/DataGridInfinite.js +5 -4
- package/components/DataGridInfinite/useLogic/useLogic.d.ts +7 -1
- package/components/DataGridInfinite/useLogic/useLogic.js +12 -2
- package/components/DateRangePicker/styles.js +1 -1
- package/components/Description/Name/styles.js +1 -1
- package/components/DescriptionCell/styles.js +12 -3
- package/components/DescriptionList/styles.js +4 -2
- package/components/ExpansionPanel/styles.js +1 -1
- package/components/InfiniteDataList/styles.js +1 -1
- package/components/InfiniteTreeList/TreeItem/styles.js +1 -1
- package/components/MenuOrganization/styles.js +2 -2
- package/components/NewStepper/Step/Description/styles.js +1 -1
- package/components/NewStepper/Step/styles.js +2 -2
- package/components/NewStepper/index.d.ts +1 -0
- package/components/NewStepper/index.js +1 -0
- package/components/NewStepper/public.d.ts +1 -0
- package/components/NewStepper/public.js +1 -0
- package/components/PageAside/styles.js +3 -3
- package/components/PageContent/PageContentHeader/styles.js +2 -2
- package/components/PageContent/styles.js +4 -2
- package/components/PageHeader/HeaderContent/styles.js +1 -1
- package/components/PageHeader/styles.js +2 -2
- package/components/PageLayoutLoader/styles.js +1 -1
- package/components/PageLayoutSection/PageLayoutSection.d.ts +4 -0
- package/components/PageLayoutSection/PageLayoutSection.js +13 -4
- package/components/PageLayoutSection/PageLayoutSectionContainer/styles.js +1 -1
- package/components/PageLayoutSection/constants.d.ts +5 -0
- package/components/PageLayoutSection/constants.js +6 -0
- package/components/PageLayoutSection/styles.d.ts +1 -1
- package/components/PageLayoutSection/styles.js +7 -2
- package/components/PagePinnableAside/styles.js +6 -6
- package/components/PdfViewer/PdfPage/styles.js +2 -2
- package/components/Radio/styles.js +4 -2
- package/components/RadioCard/styles.js +13 -5
- package/components/SideDialogActions/styles.js +1 -1
- package/components/SideDialogHeader/styles.js +1 -1
- package/components/SideDialogTitle/styles.js +1 -1
- package/components/Stepper/styles.js +2 -2
- package/components/Tag/styles.js +1 -1
- package/components/Tree/TreeItem/styles.js +3 -3
- package/components/fileUploading/FileUploaderDropzone/DropzoneWrapper/styles.js +1 -1
- package/components/fileUploading/FileUploaderFile/styles.js +1 -1
- package/components/placeholders/LoadingPlaceholder/LoadingPlaceholder.d.ts +5 -1
- package/components/placeholders/LoadingPlaceholder/LoadingPlaceholder.js +5 -4
- package/components/theme/components/MuiButton.js +1 -1
- package/components/theme/components/MuiDivider.d.ts +3 -0
- package/components/theme/components/MuiDivider.js +9 -0
- package/components/theme/components/MuiListItem.d.ts +3 -0
- package/components/theme/components/MuiListItem.js +9 -0
- package/components/theme/components/MuiOutlinedInput.js +2 -2
- package/components/theme/components/MuiPaper.js +1 -1
- package/components/theme/components/MuiStepConnector.js +4 -1
- package/components/theme/components/components.js +4 -0
- package/components/theme/palette/componentsColors/componentsColors.d.ts +3 -0
- package/components/theme/palette/componentsColors/componentsColors.js +3 -0
- package/node/components/BottomDrawer/styles.js +1 -1
- package/node/components/CardGridInfinite/Footer/styles.js +1 -1
- package/node/components/CheckableTag/styles.js +1 -1
- package/node/components/Checkbox/styles.js +4 -2
- package/node/components/Chip/styles.js +1 -1
- package/node/components/CodeField/styles.js +1 -1
- package/node/components/ComplianceStatus/styles.js +1 -1
- package/node/components/ContentState/ContentState.d.ts +1 -1
- package/node/components/ContentState/ContentState.js +2 -2
- package/node/components/ContentState/types.d.ts +4 -0
- package/node/components/DashboardLayout/DashboardWrapper/styles.js +1 -1
- package/node/components/DashboardLayout/Header/styles.js +4 -4
- package/node/components/DashboardLayoutSkeleton/styles.js +1 -1
- package/node/components/DashboardSidebar/styles.js +2 -2
- package/node/components/DashboardSidebarSkeleton/styles.js +1 -1
- package/node/components/DataGrid/Body/Body.d.ts +1 -1
- package/node/components/DataGrid/Body/Body.js +14 -7
- package/node/components/DataGrid/Body/constants.d.ts +4 -0
- package/node/components/DataGrid/Body/constants.js +8 -0
- package/node/components/DataGrid/Body/styles.d.ts +0 -3
- package/node/components/DataGrid/Body/styles.js +14 -1
- package/node/components/DataGrid/Body/useLogic/index.d.ts +1 -0
- package/node/components/DataGrid/{useLogic/hooks/useClassnames → Body/useLogic}/index.js +1 -1
- package/node/components/DataGrid/Body/useLogic/useLogic.d.ts +9 -0
- package/node/components/DataGrid/Body/useLogic/useLogic.js +19 -0
- package/node/components/DataGrid/Cell/Cell.js +18 -2
- package/node/components/DataGrid/Cell/constants.d.ts +7 -0
- package/node/components/DataGrid/Cell/constants.js +11 -0
- package/node/components/DataGrid/Cell/styles.d.ts +14 -0
- package/node/components/DataGrid/Cell/styles.js +48 -1
- package/node/components/DataGrid/Cell/useLogic/useLogic.d.ts +2 -0
- package/node/components/DataGrid/Cell/useLogic/useLogic.js +3 -2
- package/node/components/DataGrid/DataGrid.js +41 -7
- package/node/components/DataGrid/Head/Head.js +1 -1
- package/node/components/DataGrid/Head/styles.js +5 -1
- package/node/components/DataGrid/Loader/styles.js +4 -0
- package/node/components/DataGrid/MobileSkeleton/MobileSkeleton.d.ts +6 -0
- package/node/components/DataGrid/MobileSkeleton/MobileSkeleton.js +14 -0
- package/node/components/DataGrid/MobileSkeleton/index.d.ts +1 -0
- package/node/components/DataGrid/MobileSkeleton/index.js +17 -0
- package/node/components/DataGrid/MobileSkeleton/styles.d.ts +17 -0
- package/node/components/DataGrid/MobileSkeleton/styles.js +40 -0
- package/node/components/DataGrid/PinnedSections/Section/styles.js +2 -2
- package/node/components/DataGrid/Row/NestedChildren/styles.js +8 -3
- package/node/components/DataGrid/Row/Row.js +23 -6
- package/node/components/DataGrid/Row/constants.d.ts +8 -0
- package/node/components/DataGrid/Row/constants.js +9 -1
- package/node/components/DataGrid/Row/styles.d.ts +4 -9
- package/node/components/DataGrid/Row/styles.js +69 -17
- package/node/components/DataGrid/Row/types.d.ts +5 -1
- package/node/components/DataGrid/Row/useLogic/hooks/index.d.ts +1 -0
- package/node/components/DataGrid/Row/useLogic/hooks/index.js +17 -0
- package/node/components/DataGrid/Row/useLogic/hooks/useMobileLogic.d.ts +5 -0
- package/node/components/DataGrid/Row/useLogic/hooks/useMobileLogic.js +19 -0
- package/node/components/DataGrid/Row/useLogic/useLogic.d.ts +868 -3
- package/node/components/DataGrid/Row/useLogic/useLogic.js +28 -13
- package/node/components/DataGrid/constants.d.ts +4 -0
- package/node/components/DataGrid/constants.js +5 -1
- package/node/components/DataGrid/index.d.ts +1 -0
- package/node/components/DataGrid/index.js +3 -1
- package/node/components/DataGrid/styles.d.ts +0 -9
- package/node/components/DataGrid/styles.js +43 -12
- package/node/components/DataGrid/types.d.ts +7 -0
- package/node/components/DataGrid/useLogic/hooks/index.d.ts +1 -1
- package/node/components/DataGrid/useLogic/hooks/index.js +1 -1
- package/node/components/DataGrid/useLogic/hooks/useDataGridMobileLogic/index.d.ts +1 -0
- package/node/components/DataGrid/useLogic/hooks/useDataGridMobileLogic/index.js +17 -0
- package/node/components/DataGrid/useLogic/hooks/useDataGridMobileLogic/useDataGridMobileLogic.d.ts +16 -0
- package/node/components/DataGrid/useLogic/hooks/useDataGridMobileLogic/useDataGridMobileLogic.js +36 -0
- package/node/components/DataGrid/useLogic/hooks/usePinnedColumns/usePinnedColumns.js +11 -3
- package/node/components/DataGrid/useLogic/useLogic.d.ts +10 -4
- package/node/components/DataGrid/useLogic/useLogic.js +19 -14
- package/node/components/DataGrid/useLogic/utils/getIsAllowHorizontalScroll/getIsAllowHorizontalScroll.js +1 -1
- package/node/components/DataGrid/utils/getDataGridCssVars/getDataGridCssVars.d.ts +2 -0
- package/node/components/DataGrid/utils/getDataGridCssVars/getDataGridCssVars.js +9 -0
- package/node/components/DataGrid/utils/getDataGridCssVars/index.d.ts +1 -0
- package/node/components/DataGrid/utils/getDataGridCssVars/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/DataGridActionCell/DataGridSecondaryActions/DataGridSecondaryActions.js +1 -1
- package/node/components/DataGridInfinite/DataGridInfinite.js +5 -4
- package/node/components/DataGridInfinite/useLogic/useLogic.d.ts +7 -1
- package/node/components/DataGridInfinite/useLogic/useLogic.js +11 -1
- package/node/components/DateRangePicker/styles.js +1 -1
- package/node/components/Description/Name/styles.js +1 -1
- package/node/components/DescriptionCell/styles.js +15 -6
- package/node/components/DescriptionList/styles.js +4 -2
- package/node/components/ExpansionPanel/styles.js +1 -1
- package/node/components/InfiniteDataList/styles.js +1 -1
- package/node/components/InfiniteTreeList/TreeItem/styles.js +1 -1
- package/node/components/MenuOrganization/styles.js +2 -2
- package/node/components/NewStepper/Step/Description/styles.js +1 -1
- package/node/components/NewStepper/Step/styles.js +2 -2
- package/node/components/NewStepper/index.d.ts +1 -0
- package/node/components/NewStepper/index.js +3 -1
- package/node/components/NewStepper/public.d.ts +1 -0
- package/node/components/NewStepper/public.js +3 -1
- package/node/components/PageAside/styles.js +3 -3
- package/node/components/PageContent/PageContentHeader/styles.js +2 -2
- package/node/components/PageContent/styles.js +4 -2
- package/node/components/PageHeader/HeaderContent/styles.js +1 -1
- package/node/components/PageHeader/styles.js +2 -2
- package/node/components/PageLayoutLoader/styles.js +1 -1
- package/node/components/PageLayoutSection/PageLayoutSection.d.ts +4 -0
- package/node/components/PageLayoutSection/PageLayoutSection.js +12 -3
- package/node/components/PageLayoutSection/PageLayoutSectionContainer/styles.js +1 -1
- package/node/components/PageLayoutSection/constants.d.ts +5 -0
- package/node/components/PageLayoutSection/constants.js +9 -0
- package/node/components/PageLayoutSection/styles.d.ts +1 -1
- package/node/components/PageLayoutSection/styles.js +8 -3
- package/node/components/PagePinnableAside/styles.js +6 -6
- package/node/components/PdfViewer/PdfPage/styles.js +2 -2
- package/node/components/Radio/styles.js +4 -2
- package/node/components/RadioCard/styles.js +13 -5
- package/node/components/SideDialogActions/styles.js +1 -1
- package/node/components/SideDialogHeader/styles.js +1 -1
- package/node/components/SideDialogTitle/styles.js +1 -1
- package/node/components/Stepper/styles.js +2 -2
- package/node/components/Tag/styles.js +1 -1
- package/node/components/Tree/TreeItem/styles.js +3 -3
- package/node/components/fileUploading/FileUploaderDropzone/DropzoneWrapper/styles.js +1 -1
- package/node/components/fileUploading/FileUploaderFile/styles.js +1 -1
- package/node/components/placeholders/LoadingPlaceholder/LoadingPlaceholder.d.ts +5 -1
- package/node/components/placeholders/LoadingPlaceholder/LoadingPlaceholder.js +5 -4
- package/node/components/theme/components/MuiButton.js +1 -1
- package/node/components/theme/components/MuiDivider.d.ts +3 -0
- package/node/components/theme/components/MuiDivider.js +12 -0
- package/node/components/theme/components/MuiListItem.d.ts +3 -0
- package/node/components/theme/components/MuiListItem.js +12 -0
- package/node/components/theme/components/MuiOutlinedInput.js +2 -2
- package/node/components/theme/components/MuiPaper.js +1 -1
- package/node/components/theme/components/MuiStepConnector.js +4 -1
- package/node/components/theme/components/components.js +4 -0
- package/node/components/theme/palette/componentsColors/componentsColors.d.ts +3 -0
- package/node/components/theme/palette/componentsColors/componentsColors.js +3 -0
- package/package.json +20 -1
- package/components/DataGrid/useLogic/hooks/useClassnames/index.d.ts +0 -1
- package/components/DataGrid/useLogic/hooks/useClassnames/index.js +0 -1
- package/components/DataGrid/useLogic/hooks/useClassnames/useClassnames.d.ts +0 -12
- package/components/DataGrid/useLogic/hooks/useClassnames/useClassnames.js +0 -14
- package/node/components/DataGrid/useLogic/hooks/useClassnames/index.d.ts +0 -1
- package/node/components/DataGrid/useLogic/hooks/useClassnames/useClassnames.d.ts +0 -12
- package/node/components/DataGrid/useLogic/hooks/useClassnames/useClassnames.js +0 -18
|
@@ -7,8 +7,10 @@ const DataGridContext_1 = require("../../DataGridContext");
|
|
|
7
7
|
const enums_1 = require("../../enums");
|
|
8
8
|
const constants_1 = require("../constants");
|
|
9
9
|
const RowContext_1 = require("../RowContext");
|
|
10
|
+
const hooks_1 = require("./hooks");
|
|
10
11
|
const utils_1 = require("./utils");
|
|
11
|
-
const useLogic = ({ keyId, columns, row, nestedChildren, level, variant,
|
|
12
|
+
const useLogic = ({ keyId, columns, row, nestedChildren, level, variant, options, isInitialExpanded = false, expandedLevel, isSelectable, selectedRows, onSelectRow, onRowClick, isVisibleCollapseButton, registerRowElement, unregisterRowElement, style, }) => {
|
|
13
|
+
const { isDrawerOpen, handleOpenDrawer, handleCloseDrawer } = (0, hooks_1.useMobileLogic)();
|
|
12
14
|
const isDefaultExpanded = isInitialExpanded && level <= expandedLevel - 1 && nestedChildren?.length;
|
|
13
15
|
const { checkIsOpened, toggleOpenItems } = (0, react_1.useContext)(DataGridContext_1.DataGridContext);
|
|
14
16
|
const { isDisabled, disabledReason } = (0, react_1.useContext)(RowContext_1.RowContext);
|
|
@@ -28,6 +30,16 @@ const useLogic = ({ keyId, columns, row, nestedChildren, level, variant, activeR
|
|
|
28
30
|
const { isDisabled: isExternalDisabled, disabledReason: externalDisabledReason, href, target, } = options || {};
|
|
29
31
|
const disabled = isDisabled || isExternalDisabled;
|
|
30
32
|
const isOpen = checkIsOpened(rowId);
|
|
33
|
+
const handleRowClick = () => {
|
|
34
|
+
if (disabled) {
|
|
35
|
+
handleOpenDrawer();
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
if (href) {
|
|
39
|
+
return (0, redirectToLink_1.redirectToLink)(href, target);
|
|
40
|
+
}
|
|
41
|
+
onRowClick?.(row);
|
|
42
|
+
};
|
|
31
43
|
(0, react_1.useEffect)(() => {
|
|
32
44
|
// Проверка на isOpen необходима для infinite версии с виртуализацией, когда происходит размонтировании компонента
|
|
33
45
|
if (isDefaultExpanded && !isOpen) {
|
|
@@ -60,17 +72,16 @@ const useLogic = ({ keyId, columns, row, nestedChildren, level, variant, activeR
|
|
|
60
72
|
setVisibleTooltip(false);
|
|
61
73
|
}
|
|
62
74
|
};
|
|
63
|
-
const handleRowClick = () => {
|
|
64
|
-
if (disabled) {
|
|
65
|
-
return undefined;
|
|
66
|
-
}
|
|
67
|
-
if (href) {
|
|
68
|
-
return (0, redirectToLink_1.redirectToLink)(href, target);
|
|
69
|
-
}
|
|
70
|
-
onRowClick?.(row);
|
|
71
|
-
};
|
|
72
75
|
const isRenderCollapseButton = Boolean(nestedChildren?.length) && isVisibleCollapseButton;
|
|
76
|
+
const rowStyles = (0, react_1.useMemo)(() => ({
|
|
77
|
+
'--level': level,
|
|
78
|
+
...style,
|
|
79
|
+
}), [level, style]);
|
|
80
|
+
const isHovered = Boolean(!disabled && (onRowClick || href));
|
|
81
|
+
const disabledReasonText = externalDisabledReason || disabledReason;
|
|
73
82
|
return {
|
|
83
|
+
disabledReasonText,
|
|
84
|
+
rowStyles,
|
|
74
85
|
isOpen,
|
|
75
86
|
isShowConnector,
|
|
76
87
|
childrenColumns,
|
|
@@ -79,15 +90,19 @@ const useLogic = ({ keyId, columns, row, nestedChildren, level, variant, activeR
|
|
|
79
90
|
disabled,
|
|
80
91
|
isRenderCollapseButton,
|
|
81
92
|
handleToggle,
|
|
93
|
+
isHovered,
|
|
82
94
|
rowProps: {
|
|
83
|
-
$isHovered: Boolean(!disabled && (onRowClick || href)),
|
|
84
|
-
$isSelected: activeRowId === rowId,
|
|
85
95
|
onClick: handleRowClick,
|
|
86
96
|
onMouseMove: handleMouseMove,
|
|
87
97
|
},
|
|
98
|
+
drawerProps: {
|
|
99
|
+
open: isDrawerOpen,
|
|
100
|
+
onClose: handleCloseDrawer,
|
|
101
|
+
title: 'Заблокировано',
|
|
102
|
+
},
|
|
88
103
|
tooltipProps: {
|
|
89
104
|
open: isVisibleTooltip,
|
|
90
|
-
title: disabled ?
|
|
105
|
+
title: disabled ? disabledReasonText : undefined,
|
|
91
106
|
onOpen: handleOpenTooltip,
|
|
92
107
|
onClose: handleCloseTooltip,
|
|
93
108
|
},
|
|
@@ -2,9 +2,11 @@ export declare const MIN_ROW_HEIGHT = 44;
|
|
|
2
2
|
export declare const ROOT_ACTION_CELL_WIDTH = 32;
|
|
3
3
|
export declare const TREE_LINE_WIDTH: number;
|
|
4
4
|
export declare const MIN_DISPLAY_ROWS_BY_DEFAULT = 10;
|
|
5
|
+
export declare const DEFAULT_MOBILE_SKELETON_ROWS_COUNT = 5;
|
|
5
6
|
export declare const EXPANDED_LEVEL_BY_DEFAULT = 1;
|
|
6
7
|
export declare const INITIAL_OPENED_NESTED_CHILDREN_COUNT_BY_DEFAULT = 2;
|
|
7
8
|
export declare const dataGridClassnames: {
|
|
9
|
+
loadingPlaceholder: string;
|
|
8
10
|
header: string;
|
|
9
11
|
root: string;
|
|
10
12
|
body: string;
|
|
@@ -16,4 +18,6 @@ export declare const dataGridClassnames: {
|
|
|
16
18
|
leftPinnedSection: string;
|
|
17
19
|
rightPinnedSection: string;
|
|
18
20
|
overflowed: string;
|
|
21
|
+
wrapper: string;
|
|
22
|
+
isAllowHorizontalScroll: string;
|
|
19
23
|
};
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dataGridClassnames = exports.INITIAL_OPENED_NESTED_CHILDREN_COUNT_BY_DEFAULT = exports.EXPANDED_LEVEL_BY_DEFAULT = exports.MIN_DISPLAY_ROWS_BY_DEFAULT = exports.TREE_LINE_WIDTH = exports.ROOT_ACTION_CELL_WIDTH = exports.MIN_ROW_HEIGHT = void 0;
|
|
3
|
+
exports.dataGridClassnames = exports.INITIAL_OPENED_NESTED_CHILDREN_COUNT_BY_DEFAULT = exports.EXPANDED_LEVEL_BY_DEFAULT = exports.DEFAULT_MOBILE_SKELETON_ROWS_COUNT = exports.MIN_DISPLAY_ROWS_BY_DEFAULT = exports.TREE_LINE_WIDTH = exports.ROOT_ACTION_CELL_WIDTH = exports.MIN_ROW_HEIGHT = void 0;
|
|
4
4
|
const createUIKitClassname_1 = require("../utils/createUIKitClassname");
|
|
5
5
|
exports.MIN_ROW_HEIGHT = 44;
|
|
6
6
|
exports.ROOT_ACTION_CELL_WIDTH = 32;
|
|
7
7
|
exports.TREE_LINE_WIDTH = exports.ROOT_ACTION_CELL_WIDTH / 2;
|
|
8
8
|
exports.MIN_DISPLAY_ROWS_BY_DEFAULT = 10;
|
|
9
|
+
exports.DEFAULT_MOBILE_SKELETON_ROWS_COUNT = 5;
|
|
9
10
|
exports.EXPANDED_LEVEL_BY_DEFAULT = 1;
|
|
10
11
|
exports.INITIAL_OPENED_NESTED_CHILDREN_COUNT_BY_DEFAULT = 2;
|
|
11
12
|
exports.dataGridClassnames = {
|
|
13
|
+
loadingPlaceholder: (0, createUIKitClassname_1.createUIKitClassname)('data-grid__loading-placeholder'),
|
|
12
14
|
header: (0, createUIKitClassname_1.createUIKitClassname)('data-grid__header'),
|
|
13
15
|
root: (0, createUIKitClassname_1.createUIKitClassname)('data-grid'),
|
|
14
16
|
body: (0, createUIKitClassname_1.createUIKitClassname)('data-grid__body'),
|
|
@@ -20,4 +22,6 @@ exports.dataGridClassnames = {
|
|
|
20
22
|
leftPinnedSection: (0, createUIKitClassname_1.createUIKitClassname)('data-grid__left-pinned-section'),
|
|
21
23
|
rightPinnedSection: (0, createUIKitClassname_1.createUIKitClassname)('data-grid__right-pinned-section'),
|
|
22
24
|
overflowed: (0, createUIKitClassname_1.createUIKitClassname)('data-grid_overflowed'),
|
|
25
|
+
wrapper: (0, createUIKitClassname_1.createUIKitClassname)('data-grid__wrapper'),
|
|
26
|
+
isAllowHorizontalScroll: (0, createUIKitClassname_1.createUIKitClassname)('data-grid_is-allow-horizontal-scroll'),
|
|
23
27
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { DataGrid } from './DataGrid';
|
|
2
2
|
export type { DataGridProps, DataGridColumns, DataGridRow, DataGridRowOptions, DataGridSort, DataGridRowWithOptions, DataGridRowOptionColumns, } from './types';
|
|
3
3
|
export { dataGridClassnames } from './constants';
|
|
4
|
+
export { MobileSkeleton } from './MobileSkeleton';
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dataGridClassnames = exports.DataGrid = void 0;
|
|
3
|
+
exports.MobileSkeleton = exports.dataGridClassnames = exports.DataGrid = void 0;
|
|
4
4
|
var DataGrid_1 = require("./DataGrid");
|
|
5
5
|
Object.defineProperty(exports, "DataGrid", { enumerable: true, get: function () { return DataGrid_1.DataGrid; } });
|
|
6
6
|
var constants_1 = require("./constants");
|
|
7
7
|
Object.defineProperty(exports, "dataGridClassnames", { enumerable: true, get: function () { return constants_1.dataGridClassnames; } });
|
|
8
|
+
var MobileSkeleton_1 = require("./MobileSkeleton");
|
|
9
|
+
Object.defineProperty(exports, "MobileSkeleton", { enumerable: true, get: function () { return MobileSkeleton_1.MobileSkeleton; } });
|
|
@@ -2,23 +2,14 @@
|
|
|
2
2
|
export declare const Container: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
|
|
3
3
|
theme?: import("@emotion/react").Theme | undefined;
|
|
4
4
|
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
5
|
-
} & {
|
|
6
|
-
$maxHeight?: number | undefined;
|
|
7
|
-
$isAllowHorizontalScroll?: boolean | undefined;
|
|
8
5
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
9
6
|
export declare const DataGridWrapper: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
|
|
10
7
|
theme?: import("@emotion/react").Theme | undefined;
|
|
11
8
|
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
12
|
-
} & {
|
|
13
|
-
$isAllowHorizontalScroll?: boolean | undefined;
|
|
14
9
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
15
10
|
export declare const DisabledDataGridWrapper: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
|
|
16
11
|
theme?: import("@emotion/react").Theme | undefined;
|
|
17
12
|
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
18
|
-
} & {
|
|
19
|
-
$isAllowHorizontalScroll?: boolean | undefined;
|
|
20
13
|
} & import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
21
14
|
theme?: import("@emotion/react").Theme | undefined;
|
|
22
|
-
} & {
|
|
23
|
-
$isAllowHorizontalScroll: boolean;
|
|
24
15
|
}, {}, {}>;
|
|
@@ -3,18 +3,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DisabledDataGridWrapper = exports.DataGridWrapper = exports.Container = void 0;
|
|
4
4
|
const styled_1 = require("../styled");
|
|
5
5
|
const constants_1 = require("./constants");
|
|
6
|
-
exports.Container =
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
exports.Container = styled_1.styled.div `
|
|
7
|
+
--max-height: initial;
|
|
8
|
+
|
|
9
9
|
position: relative;
|
|
10
10
|
|
|
11
|
-
overflow:
|
|
11
|
+
overflow: hidden;
|
|
12
12
|
display: flex;
|
|
13
13
|
flex-direction: column;
|
|
14
14
|
|
|
15
15
|
width: 100%;
|
|
16
16
|
height: 100%;
|
|
17
|
-
max-height:
|
|
17
|
+
max-height: var(--max-height);
|
|
18
|
+
|
|
19
|
+
&.${constants_1.dataGridClassnames.isAllowHorizontalScroll} {
|
|
20
|
+
overflow: auto hidden;
|
|
21
|
+
|
|
22
|
+
& .${constants_1.dataGridClassnames.wrapper} {
|
|
23
|
+
overflow: auto hidden;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
18
26
|
|
|
19
27
|
&.${constants_1.dataGridClassnames.dataGridHasPinnedSections} {
|
|
20
28
|
overflow: hidden;
|
|
@@ -31,21 +39,44 @@ exports.Container = (0, styled_1.styled)('div', {
|
|
|
31
39
|
}
|
|
32
40
|
}
|
|
33
41
|
}
|
|
42
|
+
|
|
43
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
44
|
+
/* Нужен для того что бы scroll доходил до вверха страницы на мобильных устройствах после пагинации */
|
|
45
|
+
scroll-margin-top: ${({ theme }) => theme.spacing(8)};
|
|
46
|
+
|
|
47
|
+
overflow: initial;
|
|
48
|
+
|
|
49
|
+
& .${constants_1.dataGridClassnames.loadingPlaceholder} {
|
|
50
|
+
justify-content: flex-start;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&.${constants_1.dataGridClassnames.dataGridHasPinnedSections} {
|
|
54
|
+
overflow: initial;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&.${constants_1.dataGridClassnames.isAllowHorizontalScroll} {
|
|
58
|
+
overflow: initial;
|
|
59
|
+
|
|
60
|
+
& .${constants_1.dataGridClassnames.wrapper} {
|
|
61
|
+
overflow: initial;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
34
65
|
`;
|
|
35
|
-
exports.DataGridWrapper =
|
|
36
|
-
shouldForwardProp: (prop) => !['$isAllowHorizontalScroll'].includes(prop),
|
|
37
|
-
}) `
|
|
66
|
+
exports.DataGridWrapper = styled_1.styled.div `
|
|
38
67
|
position: relative;
|
|
39
68
|
|
|
40
|
-
overflow:
|
|
69
|
+
overflow: hidden;
|
|
41
70
|
display: flex;
|
|
42
71
|
flex-direction: column;
|
|
43
72
|
|
|
44
73
|
height: 100%;
|
|
74
|
+
|
|
75
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
76
|
+
overflow: initial;
|
|
77
|
+
}
|
|
45
78
|
`;
|
|
46
|
-
exports.DisabledDataGridWrapper = (0, styled_1.styled)(exports.DataGridWrapper
|
|
47
|
-
shouldForwardProp: (prop) => !['$isAllowHorizontalScroll'].includes(prop),
|
|
48
|
-
}) `
|
|
79
|
+
exports.DisabledDataGridWrapper = (0, styled_1.styled)(exports.DataGridWrapper) `
|
|
49
80
|
pointer-events: none;
|
|
50
81
|
|
|
51
82
|
background: ${({ theme }) => theme.palette.background.element};
|
|
@@ -27,6 +27,9 @@ export type DataGridProps<TData extends Record<string, CellValue> = DataGridRow,
|
|
|
27
27
|
columns: DataGridColumns<TData>[];
|
|
28
28
|
/**
|
|
29
29
|
* Идентификатор активного элемента массива rows. Выделяет активную строку в таблице
|
|
30
|
+
*
|
|
31
|
+
* @deprecated Не поддерживается, параметр будет удален в следующей major версии пакета.
|
|
32
|
+
* Мотивация: Использование активного элемента не является типичным сценарием использования таблицы.
|
|
30
33
|
*/
|
|
31
34
|
activeRowId?: string;
|
|
32
35
|
/**
|
|
@@ -236,6 +239,10 @@ export type DataGridColumns<TData extends Record<string, CellValue>> = {
|
|
|
236
239
|
* Закрепление колонки в таблице
|
|
237
240
|
*/
|
|
238
241
|
pinned?: 'left' | 'right';
|
|
242
|
+
/**
|
|
243
|
+
* Скрывает колонку на мобильных устройствах
|
|
244
|
+
*/
|
|
245
|
+
isHideOnMobile?: boolean;
|
|
239
246
|
};
|
|
240
247
|
export type DataGridRowOptionColumns<TData extends Record<string, CellValue>> = {
|
|
241
248
|
/**
|
|
@@ -14,5 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./useDataGridMobileLogic"), exports);
|
|
17
18
|
__exportStar(require("./usePinnedColumns"), exports);
|
|
18
|
-
__exportStar(require("./useClassnames"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useDataGridMobileLogic';
|
|
@@ -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("./useDataGridMobileLogic"), exports);
|
package/node/components/DataGrid/useLogic/hooks/useDataGridMobileLogic/useDataGridMobileLogic.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
import { type CellValue, type DataGridColumns, type DataGridRow } from '../../../types';
|
|
3
|
+
type UseDataGridMobileLogicParams<TData extends Record<string, CellValue> = DataGridRow> = {
|
|
4
|
+
containerRef?: RefObject<HTMLDivElement | null>;
|
|
5
|
+
isLoading?: boolean;
|
|
6
|
+
columns?: DataGridColumns<TData>[];
|
|
7
|
+
rows?: TData[];
|
|
8
|
+
};
|
|
9
|
+
export declare const useDataGridMobileLogic: <TData extends Record<string, unknown> = DataGridRow>({ containerRef, isLoading, columns, rows, }: UseDataGridMobileLogicParams<TData>) => {
|
|
10
|
+
isMobile: boolean;
|
|
11
|
+
mobileSkeletonProps: {
|
|
12
|
+
cellsCount: number;
|
|
13
|
+
rowsCount: number;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export {};
|
package/node/components/DataGrid/useLogic/hooks/useDataGridMobileLogic/useDataGridMobileLogic.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useDataGridMobileLogic = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useViewportType_1 = require("../../../../useViewportType");
|
|
6
|
+
const constants_1 = require("../../../constants");
|
|
7
|
+
const useDataGridMobileLogic = ({ containerRef, isLoading, columns, rows, }) => {
|
|
8
|
+
const { isMobile } = (0, useViewportType_1.useViewportType)();
|
|
9
|
+
const firstLoadedRowsCountRef = (0, react_1.useRef)(null);
|
|
10
|
+
const mobileSkeletonCellsCount = (0, react_1.useMemo)(() => columns?.filter((column) => !column.isHideOnMobile).length ?? 0, [columns]);
|
|
11
|
+
(0, react_1.useEffect)(() => {
|
|
12
|
+
if (!isLoading &&
|
|
13
|
+
rows &&
|
|
14
|
+
rows.length > 0 &&
|
|
15
|
+
firstLoadedRowsCountRef.current === null) {
|
|
16
|
+
firstLoadedRowsCountRef.current = rows.length;
|
|
17
|
+
}
|
|
18
|
+
}, [rows, isLoading]);
|
|
19
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
20
|
+
if (!isMobile) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (isLoading && containerRef?.current) {
|
|
24
|
+
containerRef.current.scrollIntoView({
|
|
25
|
+
block: 'start',
|
|
26
|
+
behavior: 'instant',
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}, [containerRef, isLoading, isMobile]);
|
|
30
|
+
const mobileSkeletonProps = {
|
|
31
|
+
cellsCount: mobileSkeletonCellsCount,
|
|
32
|
+
rowsCount: firstLoadedRowsCountRef.current ?? constants_1.DEFAULT_MOBILE_SKELETON_ROWS_COUNT,
|
|
33
|
+
};
|
|
34
|
+
return { isMobile, mobileSkeletonProps };
|
|
35
|
+
};
|
|
36
|
+
exports.useDataGridMobileLogic = useDataGridMobileLogic;
|
|
@@ -2,14 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.usePinnedColumns = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
+
const useViewportType_1 = require("../../../../useViewportType");
|
|
5
6
|
const constants_1 = require("../../../constants");
|
|
6
7
|
const useRowHover_1 = require("../../../hooks/useRowHover");
|
|
7
8
|
const getColumnSections_1 = require("../../utils/getColumnSections");
|
|
8
9
|
const syncRowsHeight_1 = require("../../utils/syncRowsHeight");
|
|
9
10
|
const usePinnedColumns = ({ isLoading, columns, }) => {
|
|
10
11
|
const containerRef = (0, react_1.useRef)(null);
|
|
12
|
+
const { isMobile } = (0, useViewportType_1.useViewportType)();
|
|
11
13
|
const hasPinnedColumns = (0, react_1.useMemo)(() => columns.some((column) => column.pinned), [columns]);
|
|
12
|
-
const
|
|
14
|
+
const isRowHoverSyncEnabled = hasPinnedColumns && !isMobile;
|
|
15
|
+
const { rowsMapRef, ...rowHoverProps } = (0, useRowHover_1.useRowHover)({
|
|
16
|
+
hasPinnedColumns: isRowHoverSyncEnabled,
|
|
17
|
+
});
|
|
13
18
|
const isScrollStateSupported = CSS.supports('container-type', 'scroll-state');
|
|
14
19
|
const checkOverflow = (0, react_1.useCallback)((element) => {
|
|
15
20
|
if (element) {
|
|
@@ -19,7 +24,10 @@ const usePinnedColumns = ({ isLoading, columns, }) => {
|
|
|
19
24
|
}, []);
|
|
20
25
|
const { sections } = (0, react_1.useMemo)(() => (0, getColumnSections_1.getColumnSections)(columns), [columns]);
|
|
21
26
|
(0, react_1.useLayoutEffect)(() => {
|
|
22
|
-
if (isLoading ||
|
|
27
|
+
if (isLoading ||
|
|
28
|
+
!hasPinnedColumns ||
|
|
29
|
+
isMobile ||
|
|
30
|
+
typeof window === 'undefined') {
|
|
23
31
|
return;
|
|
24
32
|
}
|
|
25
33
|
const resizeObserver = new ResizeObserver(() => {
|
|
@@ -41,7 +49,7 @@ const usePinnedColumns = ({ isLoading, columns, }) => {
|
|
|
41
49
|
return () => {
|
|
42
50
|
resizeObserver.disconnect();
|
|
43
51
|
};
|
|
44
|
-
}, [hasPinnedColumns, isLoading]);
|
|
52
|
+
}, [hasPinnedColumns, isLoading, isMobile]);
|
|
45
53
|
return { containerRef, rowHoverProps, sections, hasPinnedColumns };
|
|
46
54
|
};
|
|
47
55
|
exports.usePinnedColumns = usePinnedColumns;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type ChangeEvent } from 'react';
|
|
2
2
|
import type { CellValue, DataGridProps, DataGridRow } from '../types';
|
|
3
3
|
type UseLogicParams<TData extends Record<string, CellValue> = DataGridRow, TSortField extends keyof TData = keyof TData> = DataGridProps<TData, TSortField>;
|
|
4
|
-
export declare const useLogic: <TData extends Record<string, unknown> = DataGridRow, TSortField extends keyof TData = keyof TData>({ keyId, columns, rows, variant, tree, subrows, selectedRows, isLoading, isDisabled, onSelectRow, isError, onRetry, errorMsg, isHideSelectAll, isHideHeaderIfNoData, sorting, className, onSort, }: UseLogicParams<TData, TSortField>) => {
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
export declare const useLogic: <TData extends Record<string, unknown> = DataGridRow, TSortField extends keyof TData = keyof TData>({ keyId, columns, rows, variant, tree, subrows, selectedRows, isLoading, isDisabled, onSelectRow, isError, onRetry, errorMsg, isHideSelectAll, isHideHeaderIfNoData, sorting, className, onSort, maxHeight, }: UseLogicParams<TData, TSortField>) => {
|
|
5
|
+
dataGridClassName: string | undefined;
|
|
6
|
+
containerCssVars: import("react").CSSProperties;
|
|
7
7
|
isDataGridDisabled: boolean | undefined;
|
|
8
8
|
treeRenderConfig: {
|
|
9
9
|
isInitialExpanded?: boolean | undefined;
|
|
@@ -25,6 +25,7 @@ export declare const useLogic: <TData extends Record<string, unknown> = DataGrid
|
|
|
25
25
|
onRetry: () => void;
|
|
26
26
|
};
|
|
27
27
|
isSmoothLoading: boolean;
|
|
28
|
+
loadingPlaceholderClassname: string;
|
|
28
29
|
};
|
|
29
30
|
rowHoverProps: {
|
|
30
31
|
registerRowElement: (rowId: string, el: HTMLElement) => void;
|
|
@@ -32,10 +33,16 @@ export declare const useLogic: <TData extends Record<string, unknown> = DataGrid
|
|
|
32
33
|
onRowEnter: (rowId: string) => void;
|
|
33
34
|
onRowLeave: (rowId: string, e: PointerEvent) => void;
|
|
34
35
|
};
|
|
36
|
+
isMobile: boolean;
|
|
35
37
|
containerRef: import("react").RefObject<HTMLDivElement | null>;
|
|
36
38
|
gridColumns: string;
|
|
37
39
|
isNoData: boolean;
|
|
38
40
|
headColumns: import("../types").DataGridColumns<TData>[];
|
|
41
|
+
isLoading: boolean | undefined;
|
|
42
|
+
mobileSkeletonProps: {
|
|
43
|
+
cellsCount: number;
|
|
44
|
+
rowsCount: number;
|
|
45
|
+
};
|
|
39
46
|
headProps: {
|
|
40
47
|
rowsCount: number;
|
|
41
48
|
uncheckedRowsCount: number;
|
|
@@ -49,7 +56,6 @@ export declare const useLogic: <TData extends Record<string, unknown> = DataGrid
|
|
|
49
56
|
isSelectable: boolean;
|
|
50
57
|
onSelectRow: (row: TData) => (event: ChangeEvent<HTMLInputElement>) => void;
|
|
51
58
|
};
|
|
52
|
-
bodyClassName: string;
|
|
53
59
|
sections: import("../PinnedSections/types").PinnedSection<TData>[];
|
|
54
60
|
loaderProps: {
|
|
55
61
|
isLoading: boolean | undefined;
|
|
@@ -6,11 +6,12 @@ const ConfigProvider_1 = require("../../ConfigProvider");
|
|
|
6
6
|
const useFirstMountState_1 = require("../../useFirstMountState");
|
|
7
7
|
const prop_1 = require("../../utils/prop");
|
|
8
8
|
const uniqueBy_1 = require("../../utils/uniqueBy");
|
|
9
|
+
const constants_1 = require("../constants");
|
|
9
10
|
const enums_1 = require("../enums");
|
|
10
|
-
const
|
|
11
|
+
const utils_1 = require("../utils");
|
|
11
12
|
const hooks_1 = require("./hooks");
|
|
12
|
-
const
|
|
13
|
-
const useLogic = ({ keyId, columns, rows = [], variant, tree, subrows, selectedRows = [], isLoading, isDisabled, onSelectRow, isError, onRetry, errorMsg, isHideSelectAll, isHideHeaderIfNoData = false, sorting, className, onSort, }) => {
|
|
13
|
+
const utils_2 = require("./utils");
|
|
14
|
+
const useLogic = ({ keyId, columns, rows = [], variant, tree, subrows, selectedRows = [], isLoading, isDisabled, onSelectRow, isError, onRetry, errorMsg, isHideSelectAll, isHideHeaderIfNoData = false, sorting, className, onSort, maxHeight, }) => {
|
|
14
15
|
const isFirstRender = (0, useFirstMountState_1.useFirstMountState)();
|
|
15
16
|
const isSelectable = Boolean(onSelectRow);
|
|
16
17
|
const isDataGridDisabled = isLoading || isDisabled;
|
|
@@ -38,18 +39,18 @@ const useLogic = ({ keyId, columns, rows = [], variant, tree, subrows, selectedR
|
|
|
38
39
|
isLoading,
|
|
39
40
|
columns: processedColumns(),
|
|
40
41
|
});
|
|
41
|
-
const {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
const { isMobile, mobileSkeletonProps } = (0, hooks_1.useDataGridMobileLogic)({
|
|
43
|
+
containerRef,
|
|
44
|
+
isLoading,
|
|
45
|
+
columns: processedColumns(),
|
|
46
|
+
rows,
|
|
46
47
|
});
|
|
47
48
|
const treeRenderConfig = Object.is(variant, enums_1.Variant.Subrows)
|
|
48
49
|
? { ...subrows, isInitialExpanded: true }
|
|
49
50
|
: tree;
|
|
50
51
|
const availableRows = rows.filter((row) => !(row.options?.isDisabled || row.options?.isNotSelectable));
|
|
51
|
-
const gridColumns = (0,
|
|
52
|
-
const isAllowHorizontalScroll = (0,
|
|
52
|
+
const gridColumns = (0, utils_1.getGridTemplateColumns)(columns);
|
|
53
|
+
const isAllowHorizontalScroll = (0, utils_2.getIsAllowHorizontalScroll)(columns);
|
|
53
54
|
const uncheckedRowsCount = (0, react_1.useMemo)(() => {
|
|
54
55
|
return availableRows.filter((row) => !selectedRows.find((selectedRow) => selectedRow[keyId] === row[keyId])).length;
|
|
55
56
|
}, [availableRows, selectedRows, keyId]);
|
|
@@ -76,7 +77,7 @@ const useLogic = ({ keyId, columns, rows = [], variant, tree, subrows, selectedR
|
|
|
76
77
|
const isHideHead = isHideHeaderIfNoData && isNoData;
|
|
77
78
|
const contentStateProps = (0, react_1.useMemo)(() => {
|
|
78
79
|
return {
|
|
79
|
-
isLoading: isLoading && isNoData,
|
|
80
|
+
isLoading: (isLoading && isNoData) || (isMobile && isLoading),
|
|
80
81
|
isError: isError && isNoData,
|
|
81
82
|
loadingTitle: 'Загрузка данных',
|
|
82
83
|
errorState: {
|
|
@@ -86,11 +87,13 @@ const useLogic = ({ keyId, columns, rows = [], variant, tree, subrows, selectedR
|
|
|
86
87
|
onRetry,
|
|
87
88
|
},
|
|
88
89
|
isSmoothLoading: false,
|
|
90
|
+
loadingPlaceholderClassname: constants_1.dataGridClassnames.loadingPlaceholder,
|
|
89
91
|
};
|
|
90
92
|
}, [isLoading, isError, isNoData, errorMsg, onRetry, imagesMap]);
|
|
93
|
+
const containerCssVars = (0, utils_1.getDataGridCssVars)(maxHeight);
|
|
91
94
|
return {
|
|
92
|
-
|
|
93
|
-
|
|
95
|
+
dataGridClassName: className,
|
|
96
|
+
containerCssVars,
|
|
94
97
|
isDataGridDisabled,
|
|
95
98
|
treeRenderConfig,
|
|
96
99
|
renderRows,
|
|
@@ -99,10 +102,13 @@ const useLogic = ({ keyId, columns, rows = [], variant, tree, subrows, selectedR
|
|
|
99
102
|
hasPinnedColumns,
|
|
100
103
|
contentStateProps,
|
|
101
104
|
rowHoverProps,
|
|
105
|
+
isMobile,
|
|
102
106
|
containerRef,
|
|
103
107
|
gridColumns,
|
|
104
108
|
isNoData,
|
|
105
109
|
headColumns: processedColumns(),
|
|
110
|
+
isLoading,
|
|
111
|
+
mobileSkeletonProps,
|
|
106
112
|
headProps: {
|
|
107
113
|
rowsCount: availableRows.length,
|
|
108
114
|
uncheckedRowsCount,
|
|
@@ -116,7 +122,6 @@ const useLogic = ({ keyId, columns, rows = [], variant, tree, subrows, selectedR
|
|
|
116
122
|
isSelectable,
|
|
117
123
|
onSelectRow: handleSelectRow,
|
|
118
124
|
},
|
|
119
|
-
bodyClassName,
|
|
120
125
|
sections,
|
|
121
126
|
loaderProps: {
|
|
122
127
|
isLoading: !isFirstRender && isLoading,
|
|
@@ -6,7 +6,7 @@ const getIsAllowHorizontalScroll = (columns) => {
|
|
|
6
6
|
const isAllItemsHasMinWidth = columns.every(({ minWidth }) => Boolean(minWidth));
|
|
7
7
|
if (isSomeItemsHasMinWidth && !isAllItemsHasMinWidth) {
|
|
8
8
|
// biome-ignore lint/suspicious/noConsole: Ошибка для интеграторов
|
|
9
|
-
console.error('UIKIT.
|
|
9
|
+
console.error('UIKIT. DataGrid: Необходимо задать minWidth для всех колонок');
|
|
10
10
|
}
|
|
11
11
|
return isAllItemsHasMinWidth;
|
|
12
12
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDataGridCssVars = void 0;
|
|
4
|
+
const getDataGridCssVars = (maxHeight) => {
|
|
5
|
+
return maxHeight
|
|
6
|
+
? { '--max-height': `${maxHeight}px` }
|
|
7
|
+
: {};
|
|
8
|
+
};
|
|
9
|
+
exports.getDataGridCssVars = getDataGridCssVars;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getDataGridCssVars } from './getDataGridCssVars';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDataGridCssVars = void 0;
|
|
4
|
+
var getDataGridCssVars_1 = require("./getDataGridCssVars");
|
|
5
|
+
Object.defineProperty(exports, "getDataGridCssVars", { enumerable: true, get: function () { return getDataGridCssVars_1.getDataGridCssVars; } });
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getGridTemplateColumns = exports.alignToJustifyContent = void 0;
|
|
3
|
+
exports.getGridTemplateColumns = exports.getDataGridCssVars = exports.alignToJustifyContent = void 0;
|
|
4
4
|
var alignToJustifyContent_1 = require("./alignToJustifyContent");
|
|
5
5
|
Object.defineProperty(exports, "alignToJustifyContent", { enumerable: true, get: function () { return alignToJustifyContent_1.alignToJustifyContent; } });
|
|
6
|
+
var getDataGridCssVars_1 = require("./getDataGridCssVars");
|
|
7
|
+
Object.defineProperty(exports, "getDataGridCssVars", { enumerable: true, get: function () { return getDataGridCssVars_1.getDataGridCssVars; } });
|
|
6
8
|
var getGridTemplateColumns_1 = require("./getGridTemplateColumns");
|
|
7
9
|
Object.defineProperty(exports, "getGridTemplateColumns", { enumerable: true, get: function () { return getGridTemplateColumns_1.getGridTemplateColumns; } });
|
package/node/components/DataGridActionCell/DataGridSecondaryActions/DataGridSecondaryActions.js
CHANGED
|
@@ -53,6 +53,6 @@ const DataGridSecondaryActions = ({ actions, isLoading, }) => {
|
|
|
53
53
|
return ((0, react_1.createElement)(MenuItem_1.MenuItem, { ...restProps, key: name, tooltipPlacement: constants_1.TOOLTIP_PLACEMENT.secondaryActions, onClick: onActionClick(onClick) }, name));
|
|
54
54
|
});
|
|
55
55
|
};
|
|
56
|
-
return ((0, jsx_runtime_1.jsx)(Menu_1.Menu, { open: open, anchorEl: anchorEl, children: isLoading ? (0, jsx_runtime_1.jsx)(DataGridSecondaryActionsSkeleton_1.DataGridSecondaryActionsSkeleton, {}) : renderActions() }));
|
|
56
|
+
return ((0, jsx_runtime_1.jsx)(Menu_1.Menu, { open: open, anchorEl: anchorEl, title: "\u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F", children: isLoading ? (0, jsx_runtime_1.jsx)(DataGridSecondaryActionsSkeleton_1.DataGridSecondaryActionsSkeleton, {}) : renderActions() }));
|
|
57
57
|
};
|
|
58
58
|
exports.DataGridSecondaryActions = DataGridSecondaryActions;
|
|
@@ -6,6 +6,7 @@ const react_1 = require("react");
|
|
|
6
6
|
const react_virtuoso_1 = require("react-virtuoso");
|
|
7
7
|
const ConfigProvider_1 = require("../ConfigProvider");
|
|
8
8
|
const ContentState_1 = require("../ContentState");
|
|
9
|
+
const DataGrid_1 = require("../DataGrid");
|
|
9
10
|
const constants_1 = require("../DataGrid/constants");
|
|
10
11
|
const DataGridContext_1 = require("../DataGrid/DataGridContext");
|
|
11
12
|
const enums_1 = require("../DataGrid/enums");
|
|
@@ -26,12 +27,12 @@ const useLogic_1 = require("./useLogic");
|
|
|
26
27
|
const INITIAL_LEVEL = 0;
|
|
27
28
|
const DataGridInfinite = (props) => {
|
|
28
29
|
const { imagesMap, emptySymbol } = (0, react_1.useContext)(ConfigProvider_1.ConfigContext);
|
|
29
|
-
const { isNoData, isDataGridDisabled, isStickyButtonActive, treeRenderConfig, virtuosoProps, headProps, rowProps, scrollToTopButtonProps, isEndReached, isHideHead, } = (0, useLogic_1.useLogic)(props);
|
|
30
|
-
const { columns, rows = [], selectedRows = [], sorting,
|
|
30
|
+
const { isNoData, isDataGridDisabled, isStickyButtonActive, treeRenderConfig, virtuosoProps, headProps, rowProps, scrollToTopButtonProps, isEndReached, isHideHead, containerCssVars, isMobile, mobileSkeletonProps, } = (0, useLogic_1.useLogic)(props);
|
|
31
|
+
const { columns, rows = [], selectedRows = [], sorting, isLoading, isDisabled, keyId, emptyCellValue = emptySymbol, variant = enums_1.Variant.Tree, subrows, className, isError, endOfScrollMsg, errorMsg, noDataPlaceholder, onRowClick, onSort, onRetry, headPreAddon, } = props;
|
|
31
32
|
const { moreButtonColumnPosition = 1, isVisibleCollapseButton = true } = subrows || {};
|
|
32
33
|
const { isInitialExpanded = false, expandedLevel = constants_1.EXPANDED_LEVEL_BY_DEFAULT, initialVisibleChildrenCount = constants_1.INITIAL_OPENED_NESTED_CHILDREN_COUNT_BY_DEFAULT, } = treeRenderConfig || {};
|
|
33
34
|
const TableContainer = isDisabled ? styles_2.DisabledDataGridWrapper : styles_2.DataGridWrapper;
|
|
34
|
-
return ((0, jsx_runtime_1.jsx)(DataGridContext_1.DataGridContextProvider, { children: (0, jsx_runtime_1.jsxs)(styles_1.Container, {
|
|
35
|
+
return ((0, jsx_runtime_1.jsx)(DataGridContext_1.DataGridContextProvider, { children: (0, jsx_runtime_1.jsxs)(styles_1.Container, { style: containerCssVars, className: (0, classNames_1.classNames)(constants_1.dataGridClassnames.root, className), children: [headPreAddon, (0, jsx_runtime_1.jsxs)(TableContainer, { ...(0, getInertProps_1.getInertProps)(isDataGridDisabled), children: [!isHideHead && ((0, jsx_runtime_1.jsx)(Head_1.Head, { ...headProps, onSort: onSort, sorting: sorting, columns: columns })), (0, jsx_runtime_1.jsx)(ContentState_1.ContentState, { isLoading: isLoading && !isNoData, loadingTitle: "\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0434\u0430\u043D\u043D\u044B\u0445", isError: isError && !isNoData, loadingContent: isMobile && (0, jsx_runtime_1.jsx)(DataGrid_1.MobileSkeleton, { ...mobileSkeletonProps }), errorState: {
|
|
35
36
|
imgAlt: 'Что-то пошло не так',
|
|
36
37
|
errorList: [errorMsg || ''],
|
|
37
38
|
imgSrc: imagesMap.defaultErrorImgSrc,
|
|
@@ -42,7 +43,7 @@ const DataGridInfinite = (props) => {
|
|
|
42
43
|
List: List_1.List,
|
|
43
44
|
Item: ({ children, item, ...itemProps }) => {
|
|
44
45
|
const { children: nestedChildren, options, ...row } = item;
|
|
45
|
-
return ((0, jsx_runtime_1.jsx)(Row_1.RowContextProvider, { children: (0, jsx_runtime_1.jsx)(Row_1.Row, { ...rowProps, ...itemProps, row: row, columns: columns, selectedRows: selectedRows, options: options, keyId: keyId, variant: variant,
|
|
46
|
+
return ((0, jsx_runtime_1.jsx)(Row_1.RowContextProvider, { children: (0, jsx_runtime_1.jsx)(Row_1.Row, { ...rowProps, ...itemProps, row: row, columns: columns, selectedRows: selectedRows, options: options, keyId: keyId, variant: variant, level: INITIAL_LEVEL, nestedChildren: nestedChildren, isInitialExpanded: isInitialExpanded, expandedLevel: expandedLevel, initialVisibleChildrenCount: initialVisibleChildrenCount, moreButtonColumnPosition: moreButtonColumnPosition, isVisibleCollapseButton: isVisibleCollapseButton, emptyCellValue: emptyCellValue, onRowClick: onRowClick }) }));
|
|
46
47
|
},
|
|
47
48
|
EmptyPlaceholder: () => (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: noDataPlaceholder || (0, jsx_runtime_1.jsx)(NoData_1.NoData, {}) }),
|
|
48
49
|
Footer: () => {
|