@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,159 +1,67 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { useCallback as
|
|
3
|
-
import { Checkbox as
|
|
4
|
-
import { Tooltip as
|
|
5
|
-
import {
|
|
6
|
-
import { DISABLE_ROW_ATTR as
|
|
7
|
-
import {
|
|
8
|
-
import { useLogic as
|
|
9
|
-
import { checkIsDisabled as
|
|
10
|
-
const
|
|
11
|
-
const {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
className: L,
|
|
25
|
-
row: T,
|
|
26
|
-
options: E,
|
|
27
|
-
variant: n,
|
|
28
|
-
isSelectable: s,
|
|
29
|
-
gridColumns: o,
|
|
30
|
-
isInitialExpanded: j,
|
|
31
|
-
expandedLevel: w,
|
|
32
|
-
level: t,
|
|
33
|
-
nestedChildren: N,
|
|
34
|
-
initialVisibleChildrenCount: i,
|
|
35
|
-
moreButtonColumnPosition: c,
|
|
36
|
-
isVisibleCollapseButton: V,
|
|
37
|
-
columns: a,
|
|
38
|
-
emptyCellValue: W,
|
|
39
|
-
selectedRows: f,
|
|
40
|
-
activeRowId: v,
|
|
41
|
-
keyId: d,
|
|
42
|
-
onSelectRow: R,
|
|
43
|
-
onRowClick: $,
|
|
1
|
+
import { j as o } from "../../../_virtual/jsx-runtime.mjs";
|
|
2
|
+
import { useCallback as D } from "react";
|
|
3
|
+
import { Checkbox as P } from "../../Checkbox/Checkbox.mjs";
|
|
4
|
+
import { Tooltip as S } from "../../Tooltip/Tooltip.mjs";
|
|
5
|
+
import { Cell as v } from "../Cell/Cell.mjs";
|
|
6
|
+
import { DISABLE_ROW_ATTR as A } from "./constants.mjs";
|
|
7
|
+
import { Wrapper as $, ContentWrapper as y, CheckboxCell as L } from "./styles.mjs";
|
|
8
|
+
import { useLogic as T } from "./useLogic/useLogic.mjs";
|
|
9
|
+
import { checkIsDisabled as W } from "./utils/checkIsDisabled/checkIsDisabled.mjs";
|
|
10
|
+
const Q = (s) => {
|
|
11
|
+
const { rowId: m, checkboxProps: a, rowProps: p, tooltipProps: d, disabled: r } = T(s), {
|
|
12
|
+
className: u,
|
|
13
|
+
row: C,
|
|
14
|
+
options: f,
|
|
15
|
+
isSelectable: i,
|
|
16
|
+
gridColumns: n,
|
|
17
|
+
columns: e,
|
|
18
|
+
emptyCellValue: b,
|
|
19
|
+
selectedRows: B,
|
|
20
|
+
activeRowId: E,
|
|
21
|
+
keyId: N,
|
|
22
|
+
onSelectRow: _,
|
|
23
|
+
onRowClick: F,
|
|
44
24
|
// В этот rest-оператор попадают специфичные пропсы (атрибуты) virtuoso
|
|
45
25
|
// Необходимы для NewDataGridInfinite
|
|
46
|
-
...
|
|
47
|
-
} =
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
const l = O ? void 0 : [a.length - 1];
|
|
59
|
-
return a?.map((C, m) => {
|
|
60
|
-
const G = `${S}-${m}`, H = se(
|
|
26
|
+
...x
|
|
27
|
+
} = s, { isDisabledLastCell: w = !0, isNotSelectable: c } = f || {}, h = () => !i || c ? null : i && !c && /* @__PURE__ */ o.jsx(
|
|
28
|
+
L,
|
|
29
|
+
{
|
|
30
|
+
inert: r ? !0 : void 0,
|
|
31
|
+
onClick: (t) => t.stopPropagation(),
|
|
32
|
+
children: /* @__PURE__ */ o.jsx(P, { ...a })
|
|
33
|
+
}
|
|
34
|
+
), j = D(() => {
|
|
35
|
+
const t = w ? void 0 : [e.length - 1];
|
|
36
|
+
return e?.map((k, l) => {
|
|
37
|
+
const R = `${m}-${l}`, I = W(
|
|
61
38
|
r,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
),
|
|
65
|
-
return /* @__PURE__ */
|
|
66
|
-
|
|
39
|
+
t,
|
|
40
|
+
l
|
|
41
|
+
), g = !l;
|
|
42
|
+
return /* @__PURE__ */ o.jsx(
|
|
43
|
+
v,
|
|
67
44
|
{
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
isDisabled: H
|
|
45
|
+
row: C,
|
|
46
|
+
cell: k,
|
|
47
|
+
emptyCellValue: b,
|
|
48
|
+
startAdornment: g && h(),
|
|
49
|
+
isDisabled: I
|
|
74
50
|
},
|
|
75
|
-
|
|
51
|
+
R
|
|
76
52
|
);
|
|
77
53
|
});
|
|
78
|
-
}, [
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
...C
|
|
82
|
-
}) => /* @__PURE__ */ e.jsx(
|
|
83
|
-
te,
|
|
84
|
-
{
|
|
85
|
-
keyId: d,
|
|
86
|
-
...C,
|
|
87
|
-
variant: n,
|
|
88
|
-
isSelectable: s,
|
|
89
|
-
selectedRows: f,
|
|
90
|
-
gridColumns: o,
|
|
91
|
-
isInitialExpanded: j,
|
|
92
|
-
expandedLevel: w,
|
|
93
|
-
initialVisibleChildrenCount: i,
|
|
94
|
-
moreButtonColumnPosition: c,
|
|
95
|
-
isVisibleCollapseButton: V,
|
|
96
|
-
activeRowId: v,
|
|
97
|
-
columns: x,
|
|
98
|
-
onSelectRow: R,
|
|
99
|
-
onRowClick: $
|
|
100
|
-
},
|
|
101
|
-
l
|
|
102
|
-
),
|
|
103
|
-
[
|
|
104
|
-
d,
|
|
105
|
-
n,
|
|
106
|
-
s,
|
|
107
|
-
f,
|
|
108
|
-
o,
|
|
109
|
-
j,
|
|
110
|
-
w,
|
|
111
|
-
i,
|
|
112
|
-
c,
|
|
113
|
-
v,
|
|
114
|
-
x,
|
|
115
|
-
R,
|
|
116
|
-
$
|
|
117
|
-
]
|
|
118
|
-
);
|
|
119
|
-
return /* @__PURE__ */ e.jsxs(
|
|
120
|
-
X,
|
|
54
|
+
}, [e, r]);
|
|
55
|
+
return /* @__PURE__ */ o.jsx($, { $gridColumns: n, className: u, ...x, children: /* @__PURE__ */ o.jsx(S, { followCursor: !0, arrow: !1, ...d, children: /* @__PURE__ */ o.jsx(
|
|
56
|
+
y,
|
|
121
57
|
{
|
|
122
|
-
$
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
...F,
|
|
127
|
-
children: [
|
|
128
|
-
/* @__PURE__ */ e.jsx(K, { followCursor: !0, arrow: !1, ...D, children: /* @__PURE__ */ e.jsx(
|
|
129
|
-
Y,
|
|
130
|
-
{
|
|
131
|
-
$level: t,
|
|
132
|
-
$isShowConnector: h,
|
|
133
|
-
$gridColumns: o,
|
|
134
|
-
[Q]: r,
|
|
135
|
-
...A,
|
|
136
|
-
children: q()
|
|
137
|
-
}
|
|
138
|
-
) }),
|
|
139
|
-
/* @__PURE__ */ e.jsx(
|
|
140
|
-
M,
|
|
141
|
-
{
|
|
142
|
-
...y,
|
|
143
|
-
data: N,
|
|
144
|
-
keyId: d,
|
|
145
|
-
level: t,
|
|
146
|
-
variant: n,
|
|
147
|
-
gridColumns: o,
|
|
148
|
-
initialVisibleChildrenCount: i,
|
|
149
|
-
moreButtonColumnPosition: c,
|
|
150
|
-
renderRow: z
|
|
151
|
-
}
|
|
152
|
-
)
|
|
153
|
-
]
|
|
58
|
+
$gridColumns: n,
|
|
59
|
+
[A]: r,
|
|
60
|
+
...p,
|
|
61
|
+
children: j()
|
|
154
62
|
}
|
|
155
|
-
);
|
|
63
|
+
) }) });
|
|
156
64
|
};
|
|
157
65
|
export {
|
|
158
|
-
|
|
66
|
+
Q as Row
|
|
159
67
|
};
|
|
@@ -1,31 +1,9 @@
|
|
|
1
1
|
export declare const Wrapper: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & {
|
|
2
|
-
$isShowConnector: boolean;
|
|
3
2
|
$gridColumns: string;
|
|
4
|
-
$level: number;
|
|
5
3
|
}, import('react').DetailedHTMLProps<import('react').LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, {}>;
|
|
6
4
|
export declare const ContentWrapper: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & {
|
|
7
|
-
$isShowConnector: boolean;
|
|
8
5
|
$isHovered?: boolean;
|
|
9
6
|
$isSelected?: boolean;
|
|
10
7
|
$gridColumns: string;
|
|
11
|
-
$level: number;
|
|
12
8
|
}, import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
13
|
-
export declare const CellStyled: import('@emotion/styled').StyledComponent<import('../Cell').CellProps<Record<string, unknown>> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & {
|
|
14
|
-
$level: number;
|
|
15
|
-
}, {}, {}>;
|
|
16
9
|
export declare const CheckboxCell: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme>, import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
17
|
-
export declare const CollapseCell: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme>, import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
18
|
-
export declare const CollapseButton: import('@emotion/styled').StyledComponent<Omit<import('../../types').WithoutEmotionSpecific<import('@mui/material').ButtonProps<import('react').ElementType<any, keyof import("react").JSX.IntrinsicElements>>>, "color" | "variant"> & {
|
|
19
|
-
variant?: `${import('../..').ButtonVariants}`;
|
|
20
|
-
loading?: boolean;
|
|
21
|
-
loadingIndicator?: import('react').ReactNode;
|
|
22
|
-
loadingPosition?: "start" | "end" | "center";
|
|
23
|
-
color?: `${import('../..').ButtonColors}`;
|
|
24
|
-
component?: import('react').ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
25
|
-
selected?: boolean;
|
|
26
|
-
} & {
|
|
27
|
-
loading?: boolean;
|
|
28
|
-
} & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme>, {}, {}>;
|
|
29
|
-
export declare const ChevronIcon: import('@emotion/styled').StyledComponent<Omit<import('lucide-react').LucideProps, "ref"> & import('react').RefAttributes<SVGSVGElement> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & {
|
|
30
|
-
$isActive?: boolean;
|
|
31
|
-
}, {}, {}>;
|
|
@@ -1,102 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { ROOT_ACTION_CELL_WIDTH as r, TREE_LINE_WIDTH as n } from "../constants.mjs";
|
|
5
|
-
import { styled as o } from "@mui/material";
|
|
6
|
-
import { HIDDEN_CHILDREN_ROW_CLASSNAME as l } from "./constants.mjs";
|
|
7
|
-
const m = o("li")`
|
|
1
|
+
import { ROOT_ACTION_CELL_WIDTH as o } from "../constants.mjs";
|
|
2
|
+
import { styled as e } from "@mui/material";
|
|
3
|
+
const a = e("li")`
|
|
8
4
|
position: relative;
|
|
9
|
-
|
|
10
5
|
&:not(:last-of-type)::before,
|
|
11
|
-
|
|
12
|
-
content: '';
|
|
13
|
-
|
|
14
|
-
position: absolute;
|
|
15
|
-
z-index: 1;
|
|
16
|
-
top: 0;
|
|
17
|
-
transform: ${({ $level: t }) => `translateX(calc(${r}px * ${t} - ${n}px))`};
|
|
18
|
-
|
|
19
|
-
display: ${({ $isShowConnector: t }) => t ? "block" : "none"};
|
|
20
|
-
|
|
21
|
-
width: 0;
|
|
22
|
-
height: 100%;
|
|
23
|
-
|
|
24
|
-
border-left: 1px solid ${({ theme: t }) => t.palette.grey[400]};
|
|
25
|
-
}
|
|
26
|
-
`, u = o("div")`
|
|
6
|
+
`, l = e("div")`
|
|
27
7
|
position: relative;
|
|
28
8
|
|
|
29
9
|
display: grid;
|
|
30
10
|
grid-template-columns: ${({ $gridColumns: t }) => t};
|
|
31
11
|
|
|
32
|
-
background-color: ${({ theme: t, $isSelected:
|
|
12
|
+
background-color: ${({ theme: t, $isSelected: r }) => r ? t.palette.primary[100] : "transparent"};
|
|
33
13
|
|
|
34
14
|
transition: ${({ theme: t }) => t.transitions.create(["background-color"], {
|
|
35
15
|
duration: t.transitions.duration.short
|
|
36
16
|
})};
|
|
37
17
|
|
|
38
|
-
&::before {
|
|
39
|
-
content: '';
|
|
40
|
-
|
|
41
|
-
position: absolute;
|
|
42
|
-
top: 0;
|
|
43
|
-
transform: ${({ $level: t }) => `translateX(calc(${r}px * ${t} - ${n}px))`};
|
|
44
|
-
|
|
45
|
-
display: ${({ $isShowConnector: t }) => t ? "block" : "none"};
|
|
46
|
-
|
|
47
|
-
width: ${n}px;
|
|
48
|
-
height: 50%;
|
|
49
|
-
|
|
50
|
-
border-bottom: 1px solid ${({ theme: t }) => t.palette.grey[400]};
|
|
51
|
-
border-left: 1px solid ${({ theme: t }) => t.palette.grey[400]};
|
|
52
|
-
border-radius: 0 0 0 ${({ theme: t }) => t.shape.small};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
18
|
&:hover {
|
|
56
19
|
cursor: ${({ $isHovered: t }) => t ? "pointer" : "default"};
|
|
57
20
|
|
|
58
|
-
background-color: ${({ theme: t, $isHovered:
|
|
21
|
+
background-color: ${({ theme: t, $isHovered: r }) => r ? t.palette.background.elementHover : "transparent"};
|
|
59
22
|
}
|
|
60
|
-
`,
|
|
61
|
-
margin-left: ${({ $level: t }) => `${t * r}px`};
|
|
62
|
-
`, b = o("div")`
|
|
23
|
+
`, s = e("div")`
|
|
63
24
|
display: flex;
|
|
64
25
|
align-items: center;
|
|
65
26
|
align-self: center;
|
|
66
27
|
justify-content: center;
|
|
67
28
|
|
|
68
|
-
width: ${
|
|
69
|
-
`, x = o("div")`
|
|
70
|
-
display: flex;
|
|
71
|
-
align-items: center;
|
|
72
|
-
justify-content: center;
|
|
73
|
-
|
|
74
|
-
width: ${r}px;
|
|
75
|
-
`, y = o(a)`
|
|
76
|
-
width: 24px;
|
|
77
|
-
height: 24px;
|
|
78
|
-
|
|
79
|
-
color: inherit;
|
|
80
|
-
|
|
81
|
-
&:hover {
|
|
82
|
-
background-color: ${({ theme: t }) => t.palette.grey[300]};
|
|
83
|
-
}
|
|
84
|
-
`, C = o(i, {
|
|
85
|
-
shouldForwardProp: (t) => t !== "$isActive"
|
|
86
|
-
})`
|
|
87
|
-
transform: rotateZ(${({ $isActive: t }) => t ? 90 : 0}deg);
|
|
88
|
-
|
|
89
|
-
transition: ${({ theme: t }) => t.transitions.create("transform", {
|
|
90
|
-
easing: t.transitions.easing.sharp,
|
|
91
|
-
duration: t.transitions.duration.short
|
|
92
|
-
})};
|
|
29
|
+
width: ${o}px;
|
|
93
30
|
`;
|
|
94
31
|
export {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
y as CollapseButton,
|
|
99
|
-
x as CollapseCell,
|
|
100
|
-
u as ContentWrapper,
|
|
101
|
-
m as Wrapper
|
|
32
|
+
s as CheckboxCell,
|
|
33
|
+
l as ContentWrapper,
|
|
34
|
+
a as Wrapper
|
|
102
35
|
};
|
|
@@ -2,14 +2,10 @@ import { MouseEvent, SyntheticEvent } from 'react';
|
|
|
2
2
|
import { CellValue } from '../../types';
|
|
3
3
|
import { RowProps } from '../Row';
|
|
4
4
|
type UseLogicParams<TData extends Record<string, CellValue>> = RowProps<TData>;
|
|
5
|
-
export declare const useLogic: <TData extends Record<string, CellValue>>({ keyId, columns, row,
|
|
6
|
-
isOpen: boolean;
|
|
7
|
-
isShowConnector: boolean;
|
|
8
|
-
childrenColumns: any[];
|
|
5
|
+
export declare const useLogic: <TData extends Record<string, CellValue>>({ keyId, columns, row, activeRowId, options, isSelectable, selectedRows, onSelectRow, onRowClick, }: UseLogicParams<TData>) => {
|
|
9
6
|
rowId: string;
|
|
10
7
|
disabled: boolean | undefined;
|
|
11
|
-
|
|
12
|
-
handleToggle: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
8
|
+
columns: import('../../types').DataGridColumns<TData>[];
|
|
13
9
|
rowProps: {
|
|
14
10
|
$isHovered: boolean;
|
|
15
11
|
$isSelected: boolean;
|
|
@@ -27,9 +23,5 @@ export declare const useLogic: <TData extends Record<string, CellValue>>({ keyId
|
|
|
27
23
|
disabled: boolean | undefined;
|
|
28
24
|
onChange: (event: import('react').ChangeEvent<HTMLInputElement>) => void;
|
|
29
25
|
};
|
|
30
|
-
nestedChildrenProps: {
|
|
31
|
-
isOpen: boolean;
|
|
32
|
-
rowId: string;
|
|
33
|
-
};
|
|
34
26
|
};
|
|
35
27
|
export {};
|
|
@@ -1,79 +1,48 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
level: u,
|
|
14
|
-
variant: b,
|
|
15
|
-
activeRowId: C,
|
|
16
|
-
options: n,
|
|
17
|
-
isInitialExpanded: h = !1,
|
|
18
|
-
expandedLevel: g,
|
|
19
|
-
isSelectable: D,
|
|
20
|
-
selectedRows: x,
|
|
21
|
-
onSelectRow: O,
|
|
22
|
-
onRowClick: d,
|
|
23
|
-
isVisibleCollapseButton: T
|
|
1
|
+
import { useState as g } from "react";
|
|
2
|
+
import { DISABLE_ROW_ATTR as a } from "../constants.mjs";
|
|
3
|
+
const R = ({
|
|
4
|
+
keyId: i,
|
|
5
|
+
columns: d,
|
|
6
|
+
row: t,
|
|
7
|
+
activeRowId: c,
|
|
8
|
+
options: r,
|
|
9
|
+
isSelectable: p,
|
|
10
|
+
selectedRows: b,
|
|
11
|
+
onSelectRow: u,
|
|
12
|
+
onRowClick: n
|
|
24
13
|
}) => {
|
|
25
|
-
const
|
|
26
|
-
isDisabled: k,
|
|
27
|
-
disabledReason: A
|
|
28
|
-
} = n || {}, t = B || k, l = v(e);
|
|
29
|
-
q(() => {
|
|
30
|
-
R && !l && p(e);
|
|
31
|
-
}, []);
|
|
32
|
-
const E = D && !!x?.find((o) => o[r] === e), S = Object.is(b, J.Tree), I = z(
|
|
33
|
-
() => N(a, n?.childrenColumns),
|
|
34
|
-
[a, n]
|
|
35
|
-
), V = (o) => {
|
|
36
|
-
o.stopPropagation(), p(e);
|
|
37
|
-
}, w = (o) => {
|
|
38
|
-
o.target.getAttribute(f) === "true" && i(!0);
|
|
39
|
-
}, L = () => i(!1), _ = (o) => {
|
|
40
|
-
if (!t)
|
|
41
|
-
return;
|
|
42
|
-
o.target.getAttribute(f) === "true" || i(!1);
|
|
43
|
-
}, $ = () => {
|
|
44
|
-
t || d?.(s);
|
|
45
|
-
}, j = !!c?.length && T;
|
|
14
|
+
const [h, l] = g(!1), s = t[i], { isDisabled: e, disabledReason: C } = r || {}, f = p && !!b?.find((o) => o[i] === s);
|
|
46
15
|
return {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
rowId: e,
|
|
51
|
-
disabled: t,
|
|
52
|
-
isRenderCollapseButton: j,
|
|
53
|
-
handleToggle: V,
|
|
16
|
+
rowId: s,
|
|
17
|
+
disabled: e,
|
|
18
|
+
columns: d,
|
|
54
19
|
rowProps: {
|
|
55
|
-
$isHovered: !!(!
|
|
56
|
-
$isSelected:
|
|
57
|
-
onClick:
|
|
58
|
-
|
|
20
|
+
$isHovered: !!(!e && n),
|
|
21
|
+
$isSelected: c === s,
|
|
22
|
+
onClick: () => {
|
|
23
|
+
e || n?.(t);
|
|
24
|
+
},
|
|
25
|
+
onMouseMove: (o) => {
|
|
26
|
+
if (!e)
|
|
27
|
+
return;
|
|
28
|
+
o.target.getAttribute(a) === "true" || l(!1);
|
|
29
|
+
}
|
|
59
30
|
},
|
|
60
31
|
tooltipProps: {
|
|
61
|
-
open:
|
|
62
|
-
title:
|
|
63
|
-
onOpen:
|
|
64
|
-
|
|
32
|
+
open: h,
|
|
33
|
+
title: C,
|
|
34
|
+
onOpen: (o) => {
|
|
35
|
+
o.target.getAttribute(a) === "true" && l(!0);
|
|
36
|
+
},
|
|
37
|
+
onClose: () => l(!1)
|
|
65
38
|
},
|
|
66
39
|
checkboxProps: {
|
|
67
|
-
checked:
|
|
68
|
-
disabled:
|
|
69
|
-
onChange:
|
|
70
|
-
},
|
|
71
|
-
nestedChildrenProps: {
|
|
72
|
-
isOpen: l,
|
|
73
|
-
rowId: e
|
|
40
|
+
checked: f,
|
|
41
|
+
disabled: e,
|
|
42
|
+
onChange: u(t)
|
|
74
43
|
}
|
|
75
44
|
};
|
|
76
45
|
};
|
|
77
46
|
export {
|
|
78
|
-
|
|
47
|
+
R as useLogic
|
|
79
48
|
};
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
export declare const MIN_ROW_HEIGHT = 44;
|
|
2
2
|
export declare const ROOT_ACTION_CELL_WIDTH = 32;
|
|
3
|
-
export declare const TREE_LINE_WIDTH: number;
|
|
4
3
|
export declare const MIN_DISPLAY_ROWS_BY_DEFAULT = 10;
|
|
5
|
-
export declare const EXPANDED_LEVEL_BY_DEFAULT = 1;
|
|
6
|
-
export declare const INITIAL_OPENED_NESTED_CHILDREN_COUNT_BY_DEFAULT = 2;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
const _ = 44,
|
|
1
|
+
const _ = 44, I = 32, O = 10;
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
D as INITIAL_OPENED_NESTED_CHILDREN_COUNT_BY_DEFAULT,
|
|
5
|
-
I as MIN_DISPLAY_ROWS_BY_DEFAULT,
|
|
3
|
+
O as MIN_DISPLAY_ROWS_BY_DEFAULT,
|
|
6
4
|
_ as MIN_ROW_HEIGHT,
|
|
7
|
-
|
|
8
|
-
T as TREE_LINE_WIDTH
|
|
5
|
+
I as ROOT_ACTION_CELL_WIDTH
|
|
9
6
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var c = /* @__PURE__ */ ((r) => (r.ASC = "asc", r.DESC = "desc", r))(c || {});
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
s as Variant
|
|
3
|
+
c as SortStates
|
|
5
4
|
};
|
|
@@ -15,7 +15,7 @@ type TreeDataType = {
|
|
|
15
15
|
};
|
|
16
16
|
export declare const makeRandomDate: () => string;
|
|
17
17
|
export declare const makeColumns: <T extends DataType>(columnsTemplate: DataGridColumns<T>[], mergedColumns?: DataGridColumns<T>[]) => DataGridColumns<T>[];
|
|
18
|
-
export declare const makeDataList: <TData extends Record<string, CellValue>>(dataObjTemplate: TData, options?: DataGridRowOptions
|
|
18
|
+
export declare const makeDataList: <TData extends Record<string, CellValue>>(dataObjTemplate: TData, options?: DataGridRowOptions) => DataGridRowWithOptions<TData>[];
|
|
19
19
|
export declare const makeDataListWithTree: (length?: number, options?: {
|
|
20
20
|
isNotSelectable?: boolean;
|
|
21
21
|
childrenCount?: number;
|
|
@@ -61,7 +61,7 @@ export type DataGridRowOptionColumns<TData extends Record<string, CellValue>> =
|
|
|
61
61
|
*/
|
|
62
62
|
renderCell?: RenderCell<TData>;
|
|
63
63
|
};
|
|
64
|
-
export type DataGridRowOptions
|
|
64
|
+
export type DataGridRowOptions = {
|
|
65
65
|
/**
|
|
66
66
|
* Если true, строка будет недоступна для взаимодействия
|
|
67
67
|
*/
|
|
@@ -79,13 +79,8 @@ export type DataGridRowOptions<TData extends Record<string, CellValue>> = {
|
|
|
79
79
|
* Причина блокировки строки
|
|
80
80
|
*/
|
|
81
81
|
disabledReason?: string;
|
|
82
|
-
/**
|
|
83
|
-
* Настройка отображения колонок дочерних элементов
|
|
84
|
-
*/
|
|
85
|
-
childrenColumns?: DataGridRowOptionColumns<TData>[];
|
|
86
82
|
};
|
|
87
83
|
export type DataGridRow = Record<string, CellValue>;
|
|
88
84
|
export type DataGridRowWithOptions<TData extends DataGridRow> = TData & {
|
|
89
|
-
options?: DataGridRowOptions
|
|
90
|
-
children?: DataGridRowWithOptions<TData>[];
|
|
85
|
+
options?: DataGridRowOptions;
|
|
91
86
|
};
|
|
@@ -2,13 +2,8 @@ import { ChangeEvent } from 'react';
|
|
|
2
2
|
import { DataGridProps } from '../DataGrid';
|
|
3
3
|
import { CellValue, DataGridRow } from '../types';
|
|
4
4
|
type UseLogicParams<TData extends Record<string, CellValue> = DataGridRow, TSortField extends keyof TData = keyof TData> = DataGridProps<TData, TSortField>;
|
|
5
|
-
export declare const useLogic: <TData extends Record<string, CellValue> = DataGridRow, TSortField extends keyof TData = keyof TData>({ keyId, columns, rows,
|
|
5
|
+
export declare const useLogic: <TData extends Record<string, CellValue> = DataGridRow, TSortField extends keyof TData = keyof TData>({ keyId, columns, rows, selectedRows, isLoading, isDisabled, onSelectRow, }: UseLogicParams<TData, TSortField>) => {
|
|
6
6
|
isDataGridDisabled: boolean | undefined;
|
|
7
|
-
treeRenderConfig: {
|
|
8
|
-
isInitialExpanded?: boolean;
|
|
9
|
-
expandedLevel?: number;
|
|
10
|
-
initialVisibleChildrenCount?: number;
|
|
11
|
-
} | undefined;
|
|
12
7
|
renderRows: TData[];
|
|
13
8
|
headProps: {
|
|
14
9
|
rowsCount: number;
|