@astral/ui 4.19.0 → 4.19.2
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/ConfigProvider/ConfigProvider.d.ts +9 -0
- package/components/DataGrid/Body/Body.js +3 -2
- package/components/DataGrid/Body/styles.d.ts +1 -0
- package/components/DataGrid/Body/styles.js +2 -4
- package/components/DataGrid/types.d.ts +5 -0
- package/components/DialogActions/styles.js +1 -1
- package/components/DialogContent/styles.js +0 -2
- package/components/TreeAsyncAutocomplete/OptionsModal/styles.js +0 -1
- package/components/TreeAutocomplete/OptionsModal/styles.js +0 -1
- package/components/TreeLikeAsyncAutocomplete/OptionsModal/styles.js +0 -1
- package/node/components/ConfigProvider/ConfigProvider.d.ts +9 -0
- package/node/components/DataGrid/Body/Body.js +3 -2
- package/node/components/DataGrid/Body/styles.d.ts +1 -0
- package/node/components/DataGrid/Body/styles.js +2 -4
- package/node/components/DataGrid/types.d.ts +5 -0
- package/node/components/DialogActions/styles.js +1 -1
- package/node/components/DialogContent/styles.js +0 -2
- package/node/components/TreeAsyncAutocomplete/OptionsModal/styles.js +0 -1
- package/node/components/TreeAutocomplete/OptionsModal/styles.js +0 -1
- package/node/components/TreeLikeAsyncAutocomplete/OptionsModal/styles.js +0 -1
- package/package.json +1 -1
|
@@ -117,6 +117,15 @@ export type ConfigContextProps = {
|
|
|
117
117
|
isSmoothLoading?: boolean;
|
|
118
118
|
};
|
|
119
119
|
};
|
|
120
|
+
dataGrid?: {
|
|
121
|
+
defaultProps?: {
|
|
122
|
+
/**
|
|
123
|
+
* Флаг отключения минимальной высоты таблицы.
|
|
124
|
+
* Необходимо включить флаг, чтобы избежать баг с скроллом таблицы: https://track.astral.ru/soft/browse/UIKIT-3008.
|
|
125
|
+
*/
|
|
126
|
+
disableMinHeight?: boolean;
|
|
127
|
+
};
|
|
128
|
+
};
|
|
120
129
|
};
|
|
121
130
|
};
|
|
122
131
|
export type ConfigProviderProps = Partial<ConfigContextProps> & {
|
|
@@ -10,8 +10,9 @@ import { Wrapper } from './styles';
|
|
|
10
10
|
import { useLogic } from './useLogic';
|
|
11
11
|
const INITIAL_LEVEL = 0;
|
|
12
12
|
export const Body = (props) => {
|
|
13
|
-
const { imagesMap } = useContext(ConfigContext);
|
|
13
|
+
const { imagesMap, components } = useContext(ConfigContext);
|
|
14
14
|
const { isNoData, contentStateProps } = useLogic(props);
|
|
15
|
+
const disableMinHeight = components?.dataGrid?.defaultProps?.disableMinHeight;
|
|
15
16
|
const { rows, selectedRows = [], isLoading, isError, errorMsg, minDisplayRows, keyId, noDataPlaceholder, onRetry, ...rowProps } = props;
|
|
16
17
|
const renderedRows = rows.map(({ children, options, ...row }) => {
|
|
17
18
|
const rowId = row[keyId];
|
|
@@ -20,7 +21,7 @@ export const Body = (props) => {
|
|
|
20
21
|
});
|
|
21
22
|
return (_jsx(Wrapper, { className: classNames(dataGridClassnames.body, {
|
|
22
23
|
[dataGridClassnames.bodyEmpty]: isNoData,
|
|
23
|
-
}), "$minDisplayRows": minDisplayRows, children: _jsx(ContentState, { ...contentStateProps, errorState: {
|
|
24
|
+
}), "$minDisplayRows": minDisplayRows, "$disableMinHeight": disableMinHeight, children: _jsx(ContentState, { ...contentStateProps, errorState: {
|
|
24
25
|
imgAlt: 'Что-то пошло не так',
|
|
25
26
|
errorList: [errorMsg || ''],
|
|
26
27
|
imgSrc: imagesMap.defaultErrorImgSrc,
|
|
@@ -4,4 +4,5 @@ export declare const Wrapper: import("../../styled").StyledComponent<{
|
|
|
4
4
|
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
5
5
|
} & {
|
|
6
6
|
$minDisplayRows: number;
|
|
7
|
+
$disableMinHeight?: boolean | undefined;
|
|
7
8
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, {}>;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { styled } from '../../styled';
|
|
2
2
|
import { dataGridClassnames, MIN_ROW_HEIGHT } from '../constants';
|
|
3
|
-
export const Wrapper = styled
|
|
4
|
-
shouldForwardProp: (prop) => !['$minDisplayRows'].includes(prop),
|
|
5
|
-
}) `
|
|
3
|
+
export const Wrapper = styled.ul `
|
|
6
4
|
overflow-y: auto;
|
|
7
5
|
|
|
8
6
|
width: fit-content;
|
|
9
7
|
min-width: 100%;
|
|
10
8
|
height: 100%;
|
|
11
|
-
min-height: ${({ $minDisplayRows }) => `${MIN_ROW_HEIGHT * $minDisplayRows}px`};
|
|
9
|
+
min-height: ${({ $minDisplayRows, $disableMinHeight }) => ($disableMinHeight ? 'unset' : `${MIN_ROW_HEIGHT * $minDisplayRows}px`)};
|
|
12
10
|
margin: 0;
|
|
13
11
|
padding: 0;
|
|
14
12
|
|
|
@@ -131,6 +131,11 @@ export type DataGridProps<TData extends Record<string, CellValue> = DataGridRow,
|
|
|
131
131
|
/**
|
|
132
132
|
* Используется для отображения переданного кол-ва строк при отсутствии данных
|
|
133
133
|
* @default 10
|
|
134
|
+
* @deprecated Не поддерживается, параметр будет удален в следующей major версии пакета.
|
|
135
|
+
* Мотивация: задание минимальной высоты через параметр компонента мешает корректной работе таблицы
|
|
136
|
+
* в части верстки.
|
|
137
|
+
* Чтобы отключить минимальную высоту таблицы, задайте в ConfigProvider:
|
|
138
|
+
* `components.dataGrid.defaultProps.disableMinHeight: true`
|
|
134
139
|
*/
|
|
135
140
|
minDisplayRows?: number;
|
|
136
141
|
/**
|
|
@@ -2,7 +2,7 @@ import DialogActions from '@mui/material/DialogActions';
|
|
|
2
2
|
import { Grid } from '../Grid';
|
|
3
3
|
import { styled } from '../styled';
|
|
4
4
|
export const StyledDialogActions = styled(DialogActions) `
|
|
5
|
-
padding-top:
|
|
5
|
+
padding-top: ${({ theme }) => theme.spacing(6)};
|
|
6
6
|
|
|
7
7
|
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
8
8
|
padding: ${({ theme }) => theme.spacing(4)};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import MuiDialogContent from '@mui/material/DialogContent';
|
|
2
2
|
import { styled } from '../styled';
|
|
3
3
|
export const StyledDialogContent = styled(MuiDialogContent) `
|
|
4
|
-
padding-bottom: ${({ theme }) => theme.spacing(6)};
|
|
5
|
-
|
|
6
4
|
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
7
5
|
padding: ${({ theme }) => theme.spacing(5, 4)};
|
|
8
6
|
}
|
|
@@ -14,7 +14,6 @@ export const StyledDialogContent = styled(DialogContent, {
|
|
|
14
14
|
|
|
15
15
|
width: ${({ $size }) => DIALOG_SIZES[$size].minWidth};
|
|
16
16
|
height: ${({ $size }) => ($size === 'md' ? '500px' : `calc(${DIALOG_SIZES[$size].minWidth} - 50px)`)};
|
|
17
|
-
padding-bottom: ${({ theme }) => theme.spacing(4)};
|
|
18
17
|
|
|
19
18
|
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
20
19
|
width: auto;
|
|
@@ -14,7 +14,6 @@ export const StyledDialogContent = styled(DialogContent, {
|
|
|
14
14
|
|
|
15
15
|
width: ${({ $size }) => DIALOG_SIZES[$size].minWidth};
|
|
16
16
|
height: ${({ $size }) => ($size === 'md' ? '500px' : `calc(${DIALOG_SIZES[$size].minWidth} - 50px)`)};
|
|
17
|
-
padding-bottom: ${({ theme }) => theme.spacing(4)};
|
|
18
17
|
|
|
19
18
|
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
20
19
|
width: auto;
|
|
@@ -117,6 +117,15 @@ export type ConfigContextProps = {
|
|
|
117
117
|
isSmoothLoading?: boolean;
|
|
118
118
|
};
|
|
119
119
|
};
|
|
120
|
+
dataGrid?: {
|
|
121
|
+
defaultProps?: {
|
|
122
|
+
/**
|
|
123
|
+
* Флаг отключения минимальной высоты таблицы.
|
|
124
|
+
* Необходимо включить флаг, чтобы избежать баг с скроллом таблицы: https://track.astral.ru/soft/browse/UIKIT-3008.
|
|
125
|
+
*/
|
|
126
|
+
disableMinHeight?: boolean;
|
|
127
|
+
};
|
|
128
|
+
};
|
|
120
129
|
};
|
|
121
130
|
};
|
|
122
131
|
export type ConfigProviderProps = Partial<ConfigContextProps> & {
|
|
@@ -13,8 +13,9 @@ const styles_1 = require("./styles");
|
|
|
13
13
|
const useLogic_1 = require("./useLogic");
|
|
14
14
|
const INITIAL_LEVEL = 0;
|
|
15
15
|
const Body = (props) => {
|
|
16
|
-
const { imagesMap } = (0, react_1.useContext)(ConfigProvider_1.ConfigContext);
|
|
16
|
+
const { imagesMap, components } = (0, react_1.useContext)(ConfigProvider_1.ConfigContext);
|
|
17
17
|
const { isNoData, contentStateProps } = (0, useLogic_1.useLogic)(props);
|
|
18
|
+
const disableMinHeight = components?.dataGrid?.defaultProps?.disableMinHeight;
|
|
18
19
|
const { rows, selectedRows = [], isLoading, isError, errorMsg, minDisplayRows, keyId, noDataPlaceholder, onRetry, ...rowProps } = props;
|
|
19
20
|
const renderedRows = rows.map(({ children, options, ...row }) => {
|
|
20
21
|
const rowId = row[keyId];
|
|
@@ -23,7 +24,7 @@ const Body = (props) => {
|
|
|
23
24
|
});
|
|
24
25
|
return ((0, jsx_runtime_1.jsx)(styles_1.Wrapper, { className: (0, classNames_1.classNames)(constants_1.dataGridClassnames.body, {
|
|
25
26
|
[constants_1.dataGridClassnames.bodyEmpty]: isNoData,
|
|
26
|
-
}), "$minDisplayRows": minDisplayRows, children: (0, jsx_runtime_1.jsx)(ContentState_1.ContentState, { ...contentStateProps, errorState: {
|
|
27
|
+
}), "$minDisplayRows": minDisplayRows, "$disableMinHeight": disableMinHeight, children: (0, jsx_runtime_1.jsx)(ContentState_1.ContentState, { ...contentStateProps, errorState: {
|
|
27
28
|
imgAlt: 'Что-то пошло не так',
|
|
28
29
|
errorList: [errorMsg || ''],
|
|
29
30
|
imgSrc: imagesMap.defaultErrorImgSrc,
|
|
@@ -4,4 +4,5 @@ export declare const Wrapper: import("@emotion/styled/dist/declarations/src/type
|
|
|
4
4
|
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
5
5
|
} & {
|
|
6
6
|
$minDisplayRows: number;
|
|
7
|
+
$disableMinHeight?: boolean | undefined;
|
|
7
8
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, {}>;
|
|
@@ -3,15 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Wrapper = void 0;
|
|
4
4
|
const styled_1 = require("../../styled");
|
|
5
5
|
const constants_1 = require("../constants");
|
|
6
|
-
exports.Wrapper =
|
|
7
|
-
shouldForwardProp: (prop) => !['$minDisplayRows'].includes(prop),
|
|
8
|
-
}) `
|
|
6
|
+
exports.Wrapper = styled_1.styled.ul `
|
|
9
7
|
overflow-y: auto;
|
|
10
8
|
|
|
11
9
|
width: fit-content;
|
|
12
10
|
min-width: 100%;
|
|
13
11
|
height: 100%;
|
|
14
|
-
min-height: ${({ $minDisplayRows }) => `${constants_1.MIN_ROW_HEIGHT * $minDisplayRows}px`};
|
|
12
|
+
min-height: ${({ $minDisplayRows, $disableMinHeight }) => ($disableMinHeight ? 'unset' : `${constants_1.MIN_ROW_HEIGHT * $minDisplayRows}px`)};
|
|
15
13
|
margin: 0;
|
|
16
14
|
padding: 0;
|
|
17
15
|
|
|
@@ -131,6 +131,11 @@ export type DataGridProps<TData extends Record<string, CellValue> = DataGridRow,
|
|
|
131
131
|
/**
|
|
132
132
|
* Используется для отображения переданного кол-ва строк при отсутствии данных
|
|
133
133
|
* @default 10
|
|
134
|
+
* @deprecated Не поддерживается, параметр будет удален в следующей major версии пакета.
|
|
135
|
+
* Мотивация: задание минимальной высоты через параметр компонента мешает корректной работе таблицы
|
|
136
|
+
* в части верстки.
|
|
137
|
+
* Чтобы отключить минимальную высоту таблицы, задайте в ConfigProvider:
|
|
138
|
+
* `components.dataGrid.defaultProps.disableMinHeight: true`
|
|
134
139
|
*/
|
|
135
140
|
minDisplayRows?: number;
|
|
136
141
|
/**
|
|
@@ -8,7 +8,7 @@ const DialogActions_1 = __importDefault(require("@mui/material/DialogActions"));
|
|
|
8
8
|
const Grid_1 = require("../Grid");
|
|
9
9
|
const styled_1 = require("../styled");
|
|
10
10
|
exports.StyledDialogActions = (0, styled_1.styled)(DialogActions_1.default) `
|
|
11
|
-
padding-top:
|
|
11
|
+
padding-top: ${({ theme }) => theme.spacing(6)};
|
|
12
12
|
|
|
13
13
|
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
14
14
|
padding: ${({ theme }) => theme.spacing(4)};
|
|
@@ -7,8 +7,6 @@ exports.StyledDialogContent = void 0;
|
|
|
7
7
|
const DialogContent_1 = __importDefault(require("@mui/material/DialogContent"));
|
|
8
8
|
const styled_1 = require("../styled");
|
|
9
9
|
exports.StyledDialogContent = (0, styled_1.styled)(DialogContent_1.default) `
|
|
10
|
-
padding-bottom: ${({ theme }) => theme.spacing(6)};
|
|
11
|
-
|
|
12
10
|
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
13
11
|
padding: ${({ theme }) => theme.spacing(5, 4)};
|
|
14
12
|
}
|
|
@@ -17,7 +17,6 @@ exports.StyledDialogContent = (0, styled_1.styled)(DialogContent_1.DialogContent
|
|
|
17
17
|
|
|
18
18
|
width: ${({ $size }) => Dialog_1.DIALOG_SIZES[$size].minWidth};
|
|
19
19
|
height: ${({ $size }) => ($size === 'md' ? '500px' : `calc(${Dialog_1.DIALOG_SIZES[$size].minWidth} - 50px)`)};
|
|
20
|
-
padding-bottom: ${({ theme }) => theme.spacing(4)};
|
|
21
20
|
|
|
22
21
|
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
23
22
|
width: auto;
|
|
@@ -17,7 +17,6 @@ exports.StyledDialogContent = (0, styled_1.styled)(DialogContent_1.DialogContent
|
|
|
17
17
|
|
|
18
18
|
width: ${({ $size }) => Dialog_1.DIALOG_SIZES[$size].minWidth};
|
|
19
19
|
height: ${({ $size }) => ($size === 'md' ? '500px' : `calc(${Dialog_1.DIALOG_SIZES[$size].minWidth} - 50px)`)};
|
|
20
|
-
padding-bottom: ${({ theme }) => theme.spacing(4)};
|
|
21
20
|
|
|
22
21
|
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
23
22
|
width: auto;
|