@max-ts/components 0.2.2 → 0.2.4
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/lib/components/Autocomplete/Autocomplete.mjs +53 -53
- package/lib/components/DataGrid/Body/Body.d.ts +1 -29
- package/lib/components/DataGrid/Body/Body.mjs +26 -29
- package/lib/components/DataGrid/DataGrid.d.ts +0 -53
- package/lib/components/DataGrid/DataGrid.mjs +49 -71
- package/lib/components/DataGrid/HeadCell/HeadCell.mjs +21 -20
- package/lib/components/DataGrid/HeadCell/styles.mjs +3 -2
- package/lib/components/DataGrid/Row/Row.d.ts +1 -38
- package/lib/components/DataGrid/Row/Row.mjs +55 -147
- package/lib/components/DataGrid/Row/constants.d.ts +0 -1
- package/lib/components/DataGrid/Row/constants.mjs +2 -3
- package/lib/components/DataGrid/Row/index.d.ts +0 -1
- package/lib/components/DataGrid/Row/styles.d.ts +0 -22
- package/lib/components/DataGrid/Row/styles.mjs +11 -78
- package/lib/components/DataGrid/Row/useLogic/useLogic.d.ts +2 -10
- package/lib/components/DataGrid/Row/useLogic/useLogic.mjs +36 -67
- package/lib/components/DataGrid/constants.d.ts +0 -3
- package/lib/components/DataGrid/constants.mjs +3 -6
- package/lib/components/DataGrid/enums.d.ts +0 -4
- package/lib/components/DataGrid/enums.mjs +2 -3
- package/lib/components/DataGrid/faker.d.ts +1 -1
- package/lib/components/DataGrid/types.d.ts +2 -7
- package/lib/components/DataGrid/useLogic/useLogic.d.ts +1 -6
- package/lib/components/DataGrid/useLogic/useLogic.mjs +31 -36
- package/lib/components/DataGridActionCell/useLogic/useLogic.mjs +13 -42
- package/lib/components/DataGridPagination/DataGridPagination.mjs +9 -9
- package/lib/components/DataGridPagination/faker.d.ts +1 -1
- package/lib/components/SearchField/SearchField.d.ts +3 -1
- package/lib/components/SearchField/SearchField.mjs +40 -37
- package/lib/components/SearchField/styles.mjs +7 -9
- package/lib/components/Select/Select.d.ts +1 -1
- package/lib/components/Select/Select.mjs +1 -1
- package/lib/components/TextField/TextField.d.ts +1 -1
- package/lib/components/TextField/TextField.mjs +26 -26
- package/lib/index.mjs +189 -197
- package/lib/theme/components/MuiAutocomplete.mjs +1 -2
- package/package.json +13 -13
- package/lib/components/DataGrid/DataGridContext/DataGridContext.d.ts +0 -7
- package/lib/components/DataGrid/DataGridContext/DataGridContext.mjs +0 -12
- package/lib/components/DataGrid/DataGridContext/DataGridProvider/DataGridProvider.d.ts +0 -6
- package/lib/components/DataGrid/DataGridContext/DataGridProvider/DataGridProvider.mjs +0 -41
- package/lib/components/DataGrid/DataGridContext/DataGridProvider/index.d.ts +0 -1
- package/lib/components/DataGrid/DataGridContext/index.d.ts +0 -2
- package/lib/components/DataGrid/Row/NestedChildren/NestedChildren.d.ts +0 -55
- package/lib/components/DataGrid/Row/NestedChildren/NestedChildren.mjs +0 -72
- package/lib/components/DataGrid/Row/NestedChildren/index.d.ts +0 -1
- package/lib/components/DataGrid/Row/NestedChildren/styles.d.ts +0 -20
- package/lib/components/DataGrid/Row/NestedChildren/styles.mjs +0 -68
- package/lib/components/DataGrid/Row/NestedChildren/useLogic/index.d.ts +0 -1
- package/lib/components/DataGrid/Row/NestedChildren/useLogic/useLogic.d.ts +0 -18
- package/lib/components/DataGrid/Row/NestedChildren/useLogic/useLogic.mjs +0 -27
- package/lib/components/DataGrid/Row/RowContext/RowContext.d.ts +0 -7
- package/lib/components/DataGrid/Row/RowContext/RowContext.mjs +0 -11
- package/lib/components/DataGrid/Row/RowContext/RowProvider/RowProvider.d.ts +0 -6
- package/lib/components/DataGrid/Row/RowContext/RowProvider/RowProvider.mjs +0 -25
- package/lib/components/DataGrid/Row/RowContext/RowProvider/index.d.ts +0 -1
- package/lib/components/DataGrid/Row/RowContext/index.d.ts +0 -2
- package/lib/components/DataGrid/Row/useLogic/utils/getColumnsMap/getColumnsMap.d.ts +0 -4
- package/lib/components/DataGrid/Row/useLogic/utils/getColumnsMap/getColumnsMap.mjs +0 -8
- package/lib/components/DataGrid/Row/useLogic/utils/getColumnsMap/index.d.ts +0 -1
- package/lib/components/DataGrid/Row/useLogic/utils/index.d.ts +0 -2
- package/lib/components/DataGrid/Row/useLogic/utils/mergeColumnsOptions/index.d.ts +0 -1
- package/lib/components/DataGrid/Row/useLogic/utils/mergeColumnsOptions/mergeColumnsOptions.d.ts +0 -2
- package/lib/components/DataGrid/Row/useLogic/utils/mergeColumnsOptions/mergeColumnsOptions.mjs +0 -14
|
@@ -1,92 +1,92 @@
|
|
|
1
1
|
import { j as r } from "../../_virtual/jsx-runtime.mjs";
|
|
2
2
|
import { useCallback as n, createElement as y } from "react";
|
|
3
|
-
import { ListItemIcon as F, Popper as M, Autocomplete as H } from "@mui/material";
|
|
3
|
+
import { ListItemIcon as F, Popper as M, Autocomplete as z, SvgIcon as H } from "@mui/material";
|
|
4
4
|
import { Checkbox as N } from "../Checkbox/Checkbox.mjs";
|
|
5
5
|
import { CircularProgress as V } from "../CircularProgress/CircularProgress.mjs";
|
|
6
6
|
import { OverflowTypography as q } from "../OverflowTypography/OverflowTypography.mjs";
|
|
7
|
-
import { Tag as
|
|
8
|
-
import { TextField as
|
|
9
|
-
import { X as C, ChevronDown as
|
|
10
|
-
import { DEFAULT_PLACEHOLDER as
|
|
11
|
-
import { StyledMenuItem as
|
|
12
|
-
import { useLogic as
|
|
13
|
-
const
|
|
14
|
-
const { isValueEmpty: x, isPopperVisible: f, autocompleteProps: R } =
|
|
7
|
+
import { Tag as B } from "../Tag/Tag.mjs";
|
|
8
|
+
import { TextField as W } from "../TextField/TextField.mjs";
|
|
9
|
+
import { X as C, ChevronDown as X } from "lucide-react";
|
|
10
|
+
import { DEFAULT_PLACEHOLDER as $, DEFAULT_AUTOCOMPLETE_ELEMENT_ROWS_COUNT as G } from "./constants.mjs";
|
|
11
|
+
import { StyledMenuItem as J } from "./styles.mjs";
|
|
12
|
+
import { useLogic as K } from "./useLogic/useLogic.mjs";
|
|
13
|
+
const de = (d) => {
|
|
14
|
+
const { isValueEmpty: x, isPopperVisible: f, autocompleteProps: R } = K(d), {
|
|
15
15
|
required: T,
|
|
16
16
|
success: E,
|
|
17
|
-
error:
|
|
18
|
-
label:
|
|
17
|
+
error: h,
|
|
18
|
+
label: j,
|
|
19
19
|
getOptionLabel: l,
|
|
20
|
-
helperText:
|
|
21
|
-
inputRef:
|
|
20
|
+
helperText: I,
|
|
21
|
+
inputRef: O,
|
|
22
22
|
multiple: t,
|
|
23
23
|
size: i = "medium",
|
|
24
|
-
placeholder: g =
|
|
24
|
+
placeholder: g = $,
|
|
25
25
|
overflowOption: L,
|
|
26
26
|
closeText: k = "Закрыть",
|
|
27
27
|
openText: A = "Открыть",
|
|
28
28
|
clearText: D = "Очистить",
|
|
29
29
|
loadingText: P = /* @__PURE__ */ r.jsx(V, { color: "primary" }),
|
|
30
|
-
isLoadedDataError:
|
|
31
|
-
loadedDataError:
|
|
32
|
-
noOptionsText:
|
|
33
|
-
autoHighlight:
|
|
34
|
-
renderInput:
|
|
35
|
-
renderTags:
|
|
36
|
-
renderOption:
|
|
37
|
-
...
|
|
38
|
-
} = d,
|
|
30
|
+
isLoadedDataError: Q,
|
|
31
|
+
loadedDataError: Y,
|
|
32
|
+
noOptionsText: Z,
|
|
33
|
+
autoHighlight: ee,
|
|
34
|
+
renderInput: s,
|
|
35
|
+
renderTags: c,
|
|
36
|
+
renderOption: p,
|
|
37
|
+
...S
|
|
38
|
+
} = d, _ = n(
|
|
39
39
|
(e) => {
|
|
40
40
|
const o = {
|
|
41
41
|
...e,
|
|
42
|
-
inputRef:
|
|
42
|
+
inputRef: O,
|
|
43
43
|
required: T,
|
|
44
44
|
placeholder: x ? g : "",
|
|
45
|
-
label:
|
|
45
|
+
label: j,
|
|
46
46
|
success: E,
|
|
47
|
-
error:
|
|
48
|
-
helperText:
|
|
47
|
+
error: h,
|
|
48
|
+
helperText: I,
|
|
49
49
|
size: i
|
|
50
50
|
};
|
|
51
|
-
return
|
|
51
|
+
return s ? s(o) : /* @__PURE__ */ r.jsx(W, { ...o });
|
|
52
52
|
},
|
|
53
53
|
[
|
|
54
54
|
x,
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
s,
|
|
56
|
+
O,
|
|
57
57
|
T,
|
|
58
58
|
g,
|
|
59
|
-
h,
|
|
60
|
-
E,
|
|
61
|
-
O,
|
|
62
59
|
j,
|
|
60
|
+
E,
|
|
61
|
+
h,
|
|
62
|
+
I,
|
|
63
63
|
i
|
|
64
64
|
]
|
|
65
|
-
),
|
|
65
|
+
), v = n(
|
|
66
66
|
(e, o, m, a) => {
|
|
67
|
-
if (
|
|
68
|
-
return
|
|
67
|
+
if (p)
|
|
68
|
+
return p(
|
|
69
69
|
e,
|
|
70
70
|
o,
|
|
71
71
|
m,
|
|
72
72
|
a
|
|
73
73
|
);
|
|
74
74
|
const u = !!e["aria-selected"];
|
|
75
|
-
return /* @__PURE__ */ y(
|
|
75
|
+
return /* @__PURE__ */ y(J, { ...e, key: e.id }, t && /* @__PURE__ */ r.jsx(F, { children: /* @__PURE__ */ r.jsx(N, { role: "menuitemcheckbox", checked: u }) }), /* @__PURE__ */ r.jsx(
|
|
76
76
|
q,
|
|
77
77
|
{
|
|
78
|
-
rowsCount:
|
|
78
|
+
rowsCount: G,
|
|
79
79
|
...L,
|
|
80
80
|
children: e.key
|
|
81
81
|
}
|
|
82
82
|
));
|
|
83
83
|
},
|
|
84
|
-
[t, L,
|
|
85
|
-
),
|
|
86
|
-
(e, o, m) =>
|
|
84
|
+
[t, L, p]
|
|
85
|
+
), w = n(
|
|
86
|
+
(e, o, m) => c ? c(e, o, m) : e.map((a, u) => {
|
|
87
87
|
const b = l?.(a) || "";
|
|
88
88
|
return /* @__PURE__ */ y(
|
|
89
|
-
|
|
89
|
+
B,
|
|
90
90
|
{
|
|
91
91
|
deleteIcon: /* @__PURE__ */ r.jsx(C, {}),
|
|
92
92
|
color: "grey",
|
|
@@ -96,15 +96,15 @@ const ue = (d) => {
|
|
|
96
96
|
}
|
|
97
97
|
);
|
|
98
98
|
}),
|
|
99
|
-
[l,
|
|
100
|
-
),
|
|
99
|
+
[l, c]
|
|
100
|
+
), U = n(
|
|
101
101
|
(e) => f ? /* @__PURE__ */ r.jsx(M, { ...e }) : null,
|
|
102
102
|
[f]
|
|
103
103
|
);
|
|
104
104
|
return /* @__PURE__ */ r.jsx(
|
|
105
|
-
|
|
105
|
+
z,
|
|
106
106
|
{
|
|
107
|
-
...
|
|
107
|
+
...S,
|
|
108
108
|
size: i,
|
|
109
109
|
clearText: D,
|
|
110
110
|
closeText: k,
|
|
@@ -112,23 +112,23 @@ const ue = (d) => {
|
|
|
112
112
|
loadingText: P,
|
|
113
113
|
multiple: t,
|
|
114
114
|
disableCloseOnSelect: t,
|
|
115
|
-
clearIcon: /* @__PURE__ */ r.jsx(C, {}),
|
|
116
|
-
popupIcon: /* @__PURE__ */ r.jsx(
|
|
115
|
+
clearIcon: /* @__PURE__ */ r.jsx(H, { children: /* @__PURE__ */ r.jsx(C, {}) }),
|
|
116
|
+
popupIcon: /* @__PURE__ */ r.jsx(X, { size: 16 }),
|
|
117
117
|
forcePopupIcon: !0,
|
|
118
118
|
slotProps: {
|
|
119
119
|
clearIndicator: { disableRipple: !0 },
|
|
120
120
|
popper: {
|
|
121
|
-
component:
|
|
121
|
+
component: U
|
|
122
122
|
}
|
|
123
123
|
},
|
|
124
124
|
getOptionLabel: l,
|
|
125
|
-
renderInput:
|
|
126
|
-
renderTags:
|
|
127
|
-
renderOption:
|
|
125
|
+
renderInput: _,
|
|
126
|
+
renderTags: w,
|
|
127
|
+
renderOption: v,
|
|
128
128
|
...R
|
|
129
129
|
}
|
|
130
130
|
);
|
|
131
131
|
};
|
|
132
132
|
export {
|
|
133
|
-
|
|
133
|
+
de as Autocomplete
|
|
134
134
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ChangeEvent, ReactNode } from 'react';
|
|
2
|
-
import { Variant } from '../enums';
|
|
3
2
|
import { CellValue, DataGridColumns, DataGridRowOptions } from '../types';
|
|
4
3
|
export type BodyProps<TData extends Record<string, CellValue>> = {
|
|
5
4
|
/**
|
|
@@ -30,29 +29,6 @@ export type BodyProps<TData extends Record<string, CellValue>> = {
|
|
|
30
29
|
* Идентификатор активного элемента массива rows. Выделяет активную строку в таблице
|
|
31
30
|
*/
|
|
32
31
|
activeRowId?: string;
|
|
33
|
-
/**
|
|
34
|
-
* Если true, то дерево будет раскрыто по умолчанию
|
|
35
|
-
* @default 'false'
|
|
36
|
-
*/
|
|
37
|
-
isInitialExpanded: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Уровень раскрытия дерева по умолчанию, при isInitialExpanded=true
|
|
40
|
-
*/
|
|
41
|
-
expandedLevel: number;
|
|
42
|
-
/**
|
|
43
|
-
* Количество отображаемых по умолчанию дочерних элементов
|
|
44
|
-
*/
|
|
45
|
-
initialVisibleChildrenCount: number;
|
|
46
|
-
/**
|
|
47
|
-
* Номер колонки, в которой будет расположена кнопка "Показать все"
|
|
48
|
-
* Работает только для `variant="subrows"`
|
|
49
|
-
*/
|
|
50
|
-
moreButtonColumnPosition: number;
|
|
51
|
-
/**
|
|
52
|
-
* Если false, кнопка разворачивания элементов не показывается
|
|
53
|
-
* Работает только для `variant="subrows"`
|
|
54
|
-
*/
|
|
55
|
-
isVisibleCollapseButton: boolean;
|
|
56
32
|
/**
|
|
57
33
|
* Если true, то будет отображаться чекбокс для выбора элемента
|
|
58
34
|
*/
|
|
@@ -65,12 +41,8 @@ export type BodyProps<TData extends Record<string, CellValue>> = {
|
|
|
65
41
|
* Массив данных для отображения
|
|
66
42
|
*/
|
|
67
43
|
rows: Array<TData & {
|
|
68
|
-
options?: DataGridRowOptions
|
|
44
|
+
options?: DataGridRowOptions;
|
|
69
45
|
}>;
|
|
70
|
-
/**
|
|
71
|
-
* Вариант отображения вложенных элементов
|
|
72
|
-
*/
|
|
73
|
-
variant: `${Variant}`;
|
|
74
46
|
/**
|
|
75
47
|
* Используется для отображения переданного кол-ва строк при отсутствии данных
|
|
76
48
|
*/
|
|
@@ -1,53 +1,50 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { useContext as
|
|
3
|
-
import { ConfigContext as
|
|
4
|
-
import { ContentState as
|
|
5
|
-
import { Row as
|
|
6
|
-
import "
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const { imagesMap: m } = R(j), { isNoData: p, contentStateProps: a } = L(e), {
|
|
12
|
-
rows: o,
|
|
1
|
+
import { j as t } from "../../../_virtual/jsx-runtime.mjs";
|
|
2
|
+
import { useContext as w, useMemo as R } from "react";
|
|
3
|
+
import { ConfigContext as y } from "../../ConfigProvider/ConfigProvider.mjs";
|
|
4
|
+
import { ContentState as h } from "../../ContentState/ContentState.mjs";
|
|
5
|
+
import { Row as j } from "../Row/Row.mjs";
|
|
6
|
+
import { Wrapper as S } from "./styles.mjs";
|
|
7
|
+
import { useLogic as C } from "./useLogic/useLogic.mjs";
|
|
8
|
+
const N = (e) => {
|
|
9
|
+
const { imagesMap: m } = w(y), { isNoData: a, contentStateProps: p } = C(e), {
|
|
10
|
+
rows: r,
|
|
13
11
|
selectedRows: s = [],
|
|
14
12
|
isLoading: D,
|
|
15
|
-
isError:
|
|
13
|
+
isError: E,
|
|
16
14
|
errorMsg: c,
|
|
17
15
|
minDisplayRows: d,
|
|
18
|
-
keyId:
|
|
16
|
+
keyId: o,
|
|
19
17
|
noDataPlaceholder: l,
|
|
20
18
|
onRetry: f,
|
|
21
19
|
...n
|
|
22
|
-
} = e,
|
|
23
|
-
const
|
|
24
|
-
return /* @__PURE__ */
|
|
25
|
-
|
|
20
|
+
} = e, g = R(() => r.map(({ children: I, options: u, ...i }) => {
|
|
21
|
+
const x = i[o];
|
|
22
|
+
return /* @__PURE__ */ t.jsx(
|
|
23
|
+
j,
|
|
26
24
|
{
|
|
27
25
|
row: i,
|
|
28
26
|
selectedRows: s,
|
|
29
27
|
options: u,
|
|
30
|
-
keyId:
|
|
31
|
-
level: S,
|
|
32
|
-
nestedChildren: g,
|
|
28
|
+
keyId: o,
|
|
33
29
|
...n
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
},
|
|
31
|
+
x
|
|
32
|
+
);
|
|
33
|
+
}), [r, o, s, n]);
|
|
34
|
+
return /* @__PURE__ */ t.jsx(S, { $isEmpty: a, $minDisplayRows: d, children: /* @__PURE__ */ t.jsx(
|
|
35
|
+
h,
|
|
39
36
|
{
|
|
40
|
-
...
|
|
37
|
+
...p,
|
|
41
38
|
errorState: {
|
|
42
39
|
imgAlt: "Что-то пошло не так",
|
|
43
40
|
errorList: [c || ""],
|
|
44
41
|
imgSrc: m.defaultErrorImgSrc,
|
|
45
42
|
onRetry: f
|
|
46
43
|
},
|
|
47
|
-
children:
|
|
44
|
+
children: r.length ? g : l
|
|
48
45
|
}
|
|
49
46
|
) });
|
|
50
47
|
};
|
|
51
48
|
export {
|
|
52
|
-
|
|
49
|
+
N as Body
|
|
53
50
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { NoDataProps } from './NoData';
|
|
3
|
-
import { Variant } from './enums';
|
|
4
3
|
import { CellValue, DataGridColumns, DataGridRow, DataGridRowWithOptions, DataGridSort } from './types';
|
|
5
4
|
export type DataGridProps<TData extends Record<string, CellValue> = DataGridRow, TSortField extends keyof TData = keyof TData> = {
|
|
6
5
|
/**
|
|
@@ -67,58 +66,6 @@ export type DataGridProps<TData extends Record<string, CellValue> = DataGridRow,
|
|
|
67
66
|
* Текст ошибки
|
|
68
67
|
*/
|
|
69
68
|
errorMsg?: string;
|
|
70
|
-
/**
|
|
71
|
-
* Вариант отображения вложенных элементов
|
|
72
|
-
* @default 'tree'
|
|
73
|
-
*/
|
|
74
|
-
variant?: `${Variant}`;
|
|
75
|
-
/**
|
|
76
|
-
* Опции для отображения древовидных списков
|
|
77
|
-
* Применяется если variant="tree"
|
|
78
|
-
*/
|
|
79
|
-
tree?: {
|
|
80
|
-
/**
|
|
81
|
-
* Если true, то дерево будет раскрыто по умолчанию
|
|
82
|
-
* @default 'false'
|
|
83
|
-
*/
|
|
84
|
-
isInitialExpanded?: boolean;
|
|
85
|
-
/**
|
|
86
|
-
* Уровень раскрытия дерева по умолчанию, при `isInitialExpanded=true`
|
|
87
|
-
* @default '1'
|
|
88
|
-
*/
|
|
89
|
-
expandedLevel?: number;
|
|
90
|
-
/**
|
|
91
|
-
* Количество отображаемых по умолчанию дочерних элементов
|
|
92
|
-
* @default '2'
|
|
93
|
-
*/
|
|
94
|
-
initialVisibleChildrenCount?: number;
|
|
95
|
-
};
|
|
96
|
-
/**
|
|
97
|
-
* Опции для отображения вложенных списков
|
|
98
|
-
* Применяется если variant="subrows"
|
|
99
|
-
*/
|
|
100
|
-
subrows?: {
|
|
101
|
-
/**
|
|
102
|
-
* Уровень раскрытия дочерних элементов по умолчанию, при `isInitialExpanded=true`
|
|
103
|
-
* @default '1'
|
|
104
|
-
*/
|
|
105
|
-
expandedLevel?: number;
|
|
106
|
-
/**
|
|
107
|
-
* Количество отображаемых по умолчанию дочерних элементов
|
|
108
|
-
* @default '2'
|
|
109
|
-
*/
|
|
110
|
-
initialVisibleChildrenCount?: number;
|
|
111
|
-
/**
|
|
112
|
-
* Номер колонки, в которой будет расположена кнопка "Показать все"
|
|
113
|
-
* @default 1
|
|
114
|
-
*/
|
|
115
|
-
moreButtonColumnPosition?: number;
|
|
116
|
-
/**
|
|
117
|
-
* Если false, кнопка разворачивания элементов не показывается
|
|
118
|
-
* @default true
|
|
119
|
-
*/
|
|
120
|
-
isVisibleCollapseButton?: boolean;
|
|
121
|
-
};
|
|
122
69
|
/**
|
|
123
70
|
* Заглушка для пустых ячеек (если отсутствует field и filter и renderCell)
|
|
124
71
|
* @default '—'
|
|
@@ -1,90 +1,68 @@
|
|
|
1
1
|
import { j as o } from "../../_virtual/jsx-runtime.mjs";
|
|
2
|
-
import { useContext as
|
|
3
|
-
import { ConfigContext as
|
|
4
|
-
import { Body as
|
|
5
|
-
import "./
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const co = (e) => {
|
|
15
|
-
const {
|
|
16
|
-
isDataGridDisabled: t,
|
|
17
|
-
treeRenderConfig: s,
|
|
18
|
-
headProps: l,
|
|
19
|
-
bodyProps: m,
|
|
20
|
-
loaderProps: d,
|
|
21
|
-
renderRows: p
|
|
22
|
-
} = K(e), { emptySymbol: c } = S(H), {
|
|
23
|
-
columns: D,
|
|
2
|
+
import { useContext as I, useCallback as S } from "react";
|
|
3
|
+
import { ConfigContext as _ } from "../ConfigProvider/ConfigProvider.mjs";
|
|
4
|
+
import { Body as k } from "./Body/Body.mjs";
|
|
5
|
+
import { Head as E } from "./Head/Head.mjs";
|
|
6
|
+
import { Loader as H } from "./Loader/Loader.mjs";
|
|
7
|
+
import { NoData as N } from "./NoData/NoData.mjs";
|
|
8
|
+
import { MIN_DISPLAY_ROWS_BY_DEFAULT as W } from "./constants.mjs";
|
|
9
|
+
import { Container as v, DisabledDataGridWrapper as A, DataGridWrapper as B } from "./styles.mjs";
|
|
10
|
+
import { useLogic as M } from "./useLogic/useLogic.mjs";
|
|
11
|
+
const K = (e) => {
|
|
12
|
+
const { isDataGridDisabled: t, headProps: n, bodyProps: m, loaderProps: d, renderRows: l } = M(e), { emptySymbol: p } = I(_), {
|
|
13
|
+
columns: c,
|
|
24
14
|
selectedRows: f = [],
|
|
25
|
-
sorting:
|
|
26
|
-
maxHeight:
|
|
27
|
-
minDisplayRows:
|
|
28
|
-
errorMsg:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
noDataPlaceholder: a,
|
|
15
|
+
sorting: x,
|
|
16
|
+
maxHeight: D,
|
|
17
|
+
minDisplayRows: u = W,
|
|
18
|
+
errorMsg: h,
|
|
19
|
+
footer: a,
|
|
20
|
+
noDataPlaceholder: s,
|
|
32
21
|
isLoading: r,
|
|
33
|
-
isError:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
expandedLevel: A = X,
|
|
46
|
-
initialVisibleChildrenCount: B = M
|
|
47
|
-
} = s || {}, v = t ? z : J, G = V(() => r ? null : a || /* @__PURE__ */ o.jsx(F, { ...n }), [a, n, r]);
|
|
48
|
-
return /* @__PURE__ */ o.jsx(U, { children: /* @__PURE__ */ o.jsxs(q, { $maxHeight: x, className: j, children: [
|
|
49
|
-
/* @__PURE__ */ o.jsxs(v, { inert: t ? !0 : void 0, children: [
|
|
22
|
+
isError: j,
|
|
23
|
+
keyId: y,
|
|
24
|
+
activeRowId: C,
|
|
25
|
+
emptyCellValue: R = p,
|
|
26
|
+
className: g,
|
|
27
|
+
onRowClick: P,
|
|
28
|
+
onSort: b,
|
|
29
|
+
noDataOptions: i,
|
|
30
|
+
onRetry: w
|
|
31
|
+
} = e, L = t ? A : B, G = S(() => r ? null : s || /* @__PURE__ */ o.jsx(N, { ...i }), [s, i, r]);
|
|
32
|
+
return /* @__PURE__ */ o.jsxs(v, { $maxHeight: D, className: g, children: [
|
|
33
|
+
/* @__PURE__ */ o.jsxs(L, { inert: t ? !0 : void 0, children: [
|
|
50
34
|
/* @__PURE__ */ o.jsx(
|
|
51
|
-
|
|
35
|
+
E,
|
|
52
36
|
{
|
|
53
|
-
...
|
|
54
|
-
sorting:
|
|
55
|
-
onSort:
|
|
37
|
+
...n,
|
|
38
|
+
sorting: x,
|
|
39
|
+
onSort: b
|
|
56
40
|
}
|
|
57
41
|
),
|
|
58
42
|
/* @__PURE__ */ o.jsx(
|
|
59
|
-
|
|
43
|
+
k,
|
|
60
44
|
{
|
|
61
45
|
...m,
|
|
62
|
-
activeRowId:
|
|
63
|
-
keyId:
|
|
46
|
+
activeRowId: C,
|
|
47
|
+
keyId: y,
|
|
64
48
|
selectedRows: f,
|
|
65
|
-
minDisplayRows:
|
|
66
|
-
rows:
|
|
67
|
-
columns:
|
|
68
|
-
|
|
69
|
-
emptyCellValue: b,
|
|
70
|
-
isInitialExpanded: w,
|
|
71
|
-
expandedLevel: A,
|
|
72
|
-
initialVisibleChildrenCount: B,
|
|
73
|
-
moreButtonColumnPosition: y,
|
|
74
|
-
isVisibleCollapseButton: T,
|
|
49
|
+
minDisplayRows: u,
|
|
50
|
+
rows: l,
|
|
51
|
+
columns: c,
|
|
52
|
+
emptyCellValue: R,
|
|
75
53
|
isLoading: r,
|
|
76
|
-
isError:
|
|
77
|
-
errorMsg:
|
|
54
|
+
isError: j,
|
|
55
|
+
errorMsg: h,
|
|
78
56
|
noDataPlaceholder: G(),
|
|
79
|
-
onRowClick:
|
|
80
|
-
onRetry:
|
|
57
|
+
onRowClick: P,
|
|
58
|
+
onRetry: w
|
|
81
59
|
}
|
|
82
60
|
)
|
|
83
61
|
] }),
|
|
84
|
-
/* @__PURE__ */ o.jsx(
|
|
85
|
-
|
|
86
|
-
] })
|
|
62
|
+
/* @__PURE__ */ o.jsx(H, { ...d }),
|
|
63
|
+
a && a
|
|
64
|
+
] });
|
|
87
65
|
};
|
|
88
66
|
export {
|
|
89
|
-
|
|
67
|
+
K as DataGrid
|
|
90
68
|
};
|
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
import { j as r } from "../../../_virtual/jsx-runtime.mjs";
|
|
2
2
|
import { useMemo as f } from "react";
|
|
3
|
-
import { SortStates as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
import { SortStates as n } from "../enums.mjs";
|
|
4
|
+
import { SvgIcon as a } from "@mui/material";
|
|
5
|
+
import { ArrowDownUp as l, ArrowDownWideNarrow as u, ArrowDownNarrowWide as x } from "lucide-react";
|
|
6
|
+
import { Wrapper as j, StyledTypography as w } from "./styles.mjs";
|
|
7
|
+
import { useLogic as S } from "./useLogic/useLogic.mjs";
|
|
8
|
+
const I = (e) => {
|
|
9
|
+
const { wrapperProps: m } = S(e), { startAdornment: i, field: s, isSortable: o, align: p, label: c, sorting: t } = e, d = f(() => {
|
|
9
10
|
if (!o)
|
|
10
11
|
return null;
|
|
11
|
-
if (t?.fieldId !==
|
|
12
|
-
return /* @__PURE__ */ r.jsx(
|
|
12
|
+
if (t?.fieldId !== s)
|
|
13
|
+
return /* @__PURE__ */ r.jsx(l, {});
|
|
13
14
|
switch (t?.sort) {
|
|
14
|
-
case
|
|
15
|
-
return /* @__PURE__ */ r.jsx(
|
|
16
|
-
case
|
|
17
|
-
return /* @__PURE__ */ r.jsx(
|
|
15
|
+
case n.ASC:
|
|
16
|
+
return /* @__PURE__ */ r.jsx(a, { color: "primary", children: /* @__PURE__ */ r.jsx(x, {}) });
|
|
17
|
+
case n.DESC:
|
|
18
|
+
return /* @__PURE__ */ r.jsx(a, { color: "primary", children: /* @__PURE__ */ r.jsx(u, {}) });
|
|
18
19
|
default:
|
|
19
|
-
return /* @__PURE__ */ r.jsx(
|
|
20
|
+
return /* @__PURE__ */ r.jsx(l, {});
|
|
20
21
|
}
|
|
21
|
-
}, [t, o,
|
|
22
|
-
return /* @__PURE__ */ r.jsxs(
|
|
23
|
-
|
|
24
|
-
/* @__PURE__ */ r.jsxs(
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
}, [t, o, s]);
|
|
23
|
+
return /* @__PURE__ */ r.jsxs(j, { $align: p, $isSortable: o, ...m, children: [
|
|
24
|
+
i && i,
|
|
25
|
+
/* @__PURE__ */ r.jsxs(w, { variant: "caption", children: [
|
|
26
|
+
c,
|
|
27
|
+
d
|
|
27
28
|
] })
|
|
28
29
|
] });
|
|
29
30
|
};
|
|
30
31
|
export {
|
|
31
|
-
|
|
32
|
+
I as HeadCell
|
|
32
33
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { styled as i } from "@mui/material";
|
|
2
2
|
import { Typography as e } from "../../Typography/Typography.mjs";
|
|
3
3
|
import { alignToJustifyContent as o } from "../utils/alignToJustifyContent/alignToJustifyContent.mjs";
|
|
4
|
-
const
|
|
4
|
+
const s = i("div", {
|
|
5
5
|
shouldForwardProp: (t) => !["$align", "$isSortable", "$hasStartAdornment"].includes(t.toString())
|
|
6
6
|
})`
|
|
7
7
|
cursor: ${({ $isSortable: t }) => t ? "pointer" : "initial"};
|
|
@@ -18,6 +18,7 @@ const a = i("div", {
|
|
|
18
18
|
`, l = i(e)`
|
|
19
19
|
display: flex;
|
|
20
20
|
align-items: center;
|
|
21
|
+
gap: ${({ theme: t }) => t.spacing(1)};
|
|
21
22
|
|
|
22
23
|
> svg {
|
|
23
24
|
width: 16px;
|
|
@@ -26,5 +27,5 @@ const a = i("div", {
|
|
|
26
27
|
`;
|
|
27
28
|
export {
|
|
28
29
|
l as StyledTypography,
|
|
29
|
-
|
|
30
|
+
s as Wrapper
|
|
30
31
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ChangeEvent, ReactNode } from 'react';
|
|
2
|
-
import { Variant } from '../enums';
|
|
3
2
|
import { CellValue, DataGridColumns, DataGridRowOptions } from '../types';
|
|
4
3
|
export type RowProps<TData extends Record<string, CellValue>> = {
|
|
5
4
|
/**
|
|
@@ -18,50 +17,14 @@ export type RowProps<TData extends Record<string, CellValue>> = {
|
|
|
18
17
|
* Конфигурация колонок для таблицы
|
|
19
18
|
*/
|
|
20
19
|
columns: DataGridColumns<TData>[];
|
|
21
|
-
/**
|
|
22
|
-
* Вариант отображения вложенных элементов
|
|
23
|
-
*/
|
|
24
|
-
variant: `${Variant}`;
|
|
25
20
|
/**
|
|
26
21
|
* Конфигурация ширины колонок
|
|
27
22
|
*/
|
|
28
23
|
gridColumns: string;
|
|
29
|
-
/**
|
|
30
|
-
* Уровень вложенности в дереве
|
|
31
|
-
*/
|
|
32
|
-
level: number;
|
|
33
|
-
/**
|
|
34
|
-
* Вложенные элементы
|
|
35
|
-
*/
|
|
36
|
-
nestedChildren: Array<TData & {
|
|
37
|
-
options?: DataGridRowOptions<TData>;
|
|
38
|
-
}>;
|
|
39
24
|
/**
|
|
40
25
|
* Идентификатор активного элемента массива rows. Выделяет активную строку в таблице
|
|
41
26
|
*/
|
|
42
27
|
activeRowId?: string;
|
|
43
|
-
/**
|
|
44
|
-
* Если true, то дерево будет раскрыто по умолчанию
|
|
45
|
-
*/
|
|
46
|
-
isInitialExpanded: boolean;
|
|
47
|
-
/**
|
|
48
|
-
* Уровень раскрытия дерева по умолчанию, при isInitialExpanded=true
|
|
49
|
-
*/
|
|
50
|
-
expandedLevel: number;
|
|
51
|
-
/**
|
|
52
|
-
* Количество отображаемых по умолчанию дочерних элементов
|
|
53
|
-
*/
|
|
54
|
-
initialVisibleChildrenCount: number;
|
|
55
|
-
/**
|
|
56
|
-
* Номер колонки, в которой будет расположена кнопка "Показать все"
|
|
57
|
-
* Работает только для `variant="subrows"`
|
|
58
|
-
*/
|
|
59
|
-
moreButtonColumnPosition: number;
|
|
60
|
-
/**
|
|
61
|
-
* Если false, кнопка разворачивания элементов не показывается
|
|
62
|
-
* Работает только для `variant="subrows"`
|
|
63
|
-
*/
|
|
64
|
-
isVisibleCollapseButton: boolean;
|
|
65
28
|
/**
|
|
66
29
|
* Если true, то будет отображаться чекбокс для выбора элемента
|
|
67
30
|
*/
|
|
@@ -78,7 +41,7 @@ export type RowProps<TData extends Record<string, CellValue>> = {
|
|
|
78
41
|
/**
|
|
79
42
|
* Дополнительные настройки строки
|
|
80
43
|
*/
|
|
81
|
-
options?: DataGridRowOptions
|
|
44
|
+
options?: DataGridRowOptions;
|
|
82
45
|
/**
|
|
83
46
|
* Обработчик выбора строки
|
|
84
47
|
*/
|