@max-ts/components 0.2.3 → 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/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/TextField/TextField.d.ts +1 -1
- package/lib/components/TextField/TextField.mjs +1 -1
- package/lib/index.mjs +189 -197
- package/package.json +1 -1
- 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,45 +1,41 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const J = ({
|
|
1
|
+
import { useRef as A, useEffect as G, useMemo as N, useCallback as m } from "react";
|
|
2
|
+
import { uniqueBy as q, prop as x } from "remeda";
|
|
3
|
+
import { getGridTemplateColumns as E } from "./utils/getGridTemplateColumns/getGridTemplateColumns.mjs";
|
|
4
|
+
const j = ({
|
|
6
5
|
keyId: e,
|
|
7
6
|
columns: s,
|
|
8
7
|
rows: r = [],
|
|
9
|
-
variant: b,
|
|
10
|
-
tree: g,
|
|
11
|
-
subrows: C,
|
|
12
8
|
selectedRows: i = [],
|
|
13
|
-
isLoading:
|
|
9
|
+
isLoading: l,
|
|
14
10
|
isDisabled: u,
|
|
15
11
|
onSelectRow: n
|
|
16
12
|
}) => {
|
|
17
|
-
const
|
|
13
|
+
const b = !!r?.length, c = !!n, g = l || u, f = r.filter(
|
|
18
14
|
(t) => !(t.options?.isDisabled || t.options?.isNotSelectable)
|
|
19
|
-
), p =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}, [r,
|
|
23
|
-
const
|
|
24
|
-
(t) => !i.find((
|
|
25
|
-
).length, [f, i, e]),
|
|
15
|
+
), p = A([]);
|
|
16
|
+
G(() => {
|
|
17
|
+
l || (p.current = r);
|
|
18
|
+
}, [r, l]);
|
|
19
|
+
const h = E(s), C = N(() => f.filter(
|
|
20
|
+
(t) => !i.find((o) => o[e] === t[e])
|
|
21
|
+
).length, [f, i, e]), B = m(() => r.length <= 1 ? s.map((t) => ({ ...t, sortable: !1 })) : s, [s, r]), D = l ? p.current : r, d = (t) => {
|
|
26
22
|
if (!n)
|
|
27
23
|
return;
|
|
28
24
|
if (t.target.checked) {
|
|
29
|
-
const a =
|
|
25
|
+
const a = q(
|
|
30
26
|
[...i, ...f],
|
|
31
|
-
|
|
27
|
+
x(e)
|
|
32
28
|
);
|
|
33
29
|
return n(a);
|
|
34
30
|
}
|
|
35
|
-
const
|
|
36
|
-
(a) => !r.find((
|
|
31
|
+
const o = i.filter(
|
|
32
|
+
(a) => !r.find((P) => P[e] === a[e])
|
|
37
33
|
);
|
|
38
|
-
n(
|
|
39
|
-
},
|
|
40
|
-
(t) => (
|
|
34
|
+
n(o);
|
|
35
|
+
}, v = m(
|
|
36
|
+
(t) => (o) => {
|
|
41
37
|
if (n) {
|
|
42
|
-
if (
|
|
38
|
+
if (o.target.checked)
|
|
43
39
|
return n([...i, t]);
|
|
44
40
|
n(
|
|
45
41
|
i.filter(
|
|
@@ -51,29 +47,28 @@ const J = ({
|
|
|
51
47
|
[i, n, e]
|
|
52
48
|
);
|
|
53
49
|
return {
|
|
54
|
-
isDataGridDisabled:
|
|
55
|
-
|
|
56
|
-
renderRows: x,
|
|
50
|
+
isDataGridDisabled: g,
|
|
51
|
+
renderRows: D,
|
|
57
52
|
headProps: {
|
|
58
53
|
rowsCount: f.length,
|
|
59
|
-
uncheckedRowsCount:
|
|
60
|
-
gridColumns:
|
|
54
|
+
uncheckedRowsCount: C,
|
|
55
|
+
gridColumns: h,
|
|
61
56
|
isSelectable: c,
|
|
62
|
-
columns:
|
|
63
|
-
onSelectAllRows:
|
|
57
|
+
columns: B(),
|
|
58
|
+
onSelectAllRows: d
|
|
64
59
|
},
|
|
65
60
|
bodyProps: {
|
|
66
|
-
gridColumns:
|
|
61
|
+
gridColumns: h,
|
|
67
62
|
isSelectable: c,
|
|
68
|
-
onSelectRow:
|
|
63
|
+
onSelectRow: v
|
|
69
64
|
},
|
|
70
65
|
loaderProps: {
|
|
71
|
-
isLoading:
|
|
66
|
+
isLoading: b && l,
|
|
72
67
|
isVisibleDivider: !!r.length,
|
|
73
68
|
isDisabled: u
|
|
74
69
|
}
|
|
75
70
|
};
|
|
76
71
|
};
|
|
77
72
|
export {
|
|
78
|
-
|
|
73
|
+
j as useLogic
|
|
79
74
|
};
|
|
@@ -1,49 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import "../../Button/styles.mjs";
|
|
6
|
-
import "@mui/material";
|
|
7
|
-
import "../../ErrorBoundary/ErrorBoundary.mjs";
|
|
8
|
-
import "../../Placeholder/Image/Image.mjs";
|
|
9
|
-
import "../../Placeholder/styles.mjs";
|
|
10
|
-
import "../../Typography/styles.mjs";
|
|
11
|
-
import "../../ContentState/styles.mjs";
|
|
12
|
-
import "../../Checkbox/Checkbox.mjs";
|
|
13
|
-
import "../../Tooltip/styles.mjs";
|
|
14
|
-
import "../../DataGrid/Row/NestedChildren/NestedChildren.mjs";
|
|
15
|
-
import "../../DataGrid/Row/styles.mjs";
|
|
16
|
-
import "../../DataGrid/DataGridContext/DataGridContext.mjs";
|
|
17
|
-
import { RowContext as f } from "../../DataGrid/Row/RowContext/RowContext.mjs";
|
|
18
|
-
import "../../DataGrid/Body/styles.mjs";
|
|
19
|
-
import "lucide-react";
|
|
20
|
-
import "../../DataGrid/HeadCell/styles.mjs";
|
|
21
|
-
import "../../DataGrid/Head/styles.mjs";
|
|
22
|
-
import "../../DataGrid/Loader/styles.mjs";
|
|
23
|
-
import "../../DataGrid/styles.mjs";
|
|
24
|
-
import "remeda";
|
|
25
|
-
const H = ({
|
|
26
|
-
row: i,
|
|
27
|
-
actions: r
|
|
1
|
+
import { useCallback as e } from "react";
|
|
2
|
+
const d = ({
|
|
3
|
+
row: o,
|
|
4
|
+
actions: i
|
|
28
5
|
}) => {
|
|
29
|
-
const { main:
|
|
30
|
-
(
|
|
31
|
-
),
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return n(t?.loadingNote);
|
|
35
|
-
e();
|
|
36
|
-
}, [t]);
|
|
37
|
-
const c = d(
|
|
38
|
-
(o) => () => {
|
|
39
|
-
o?.(i);
|
|
6
|
+
const { main: c, secondary: t } = i, a = !![...c, ...t || []].find(
|
|
7
|
+
(n) => n.isBlockingOperation && n.loading
|
|
8
|
+
), l = e(
|
|
9
|
+
(n) => () => {
|
|
10
|
+
n?.(o);
|
|
40
11
|
},
|
|
41
|
-
[
|
|
12
|
+
[o]
|
|
42
13
|
);
|
|
43
|
-
return { isDisabledAction: a, handleActionClick:
|
|
44
|
-
|
|
14
|
+
return { isDisabledAction: a, handleActionClick: l, handleWrapperClick: (n) => {
|
|
15
|
+
n.stopPropagation();
|
|
45
16
|
} };
|
|
46
17
|
};
|
|
47
18
|
export {
|
|
48
|
-
|
|
19
|
+
d as useLogic
|
|
49
20
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { j as
|
|
1
|
+
import { j as r } from "../../_virtual/jsx-runtime.mjs";
|
|
2
2
|
import { MenuItem as h } from "../MenuItem/MenuItem.mjs";
|
|
3
3
|
import { Pagination as f } from "../Pagination/Pagination.mjs";
|
|
4
4
|
import { Select as x } from "../Select/Select.mjs";
|
|
@@ -23,11 +23,11 @@ const D = (a) => {
|
|
|
23
23
|
onSetCountPerPage: u,
|
|
24
24
|
...d
|
|
25
25
|
} = a;
|
|
26
|
-
return !o && !c || !l ? null : /* @__PURE__ */
|
|
27
|
-
/* @__PURE__ */
|
|
28
|
-
u && /* @__PURE__ */
|
|
29
|
-
/* @__PURE__ */
|
|
30
|
-
/* @__PURE__ */
|
|
26
|
+
return !o && !c || !l ? null : /* @__PURE__ */ r.jsxs(E, { className: g, children: [
|
|
27
|
+
/* @__PURE__ */ r.jsxs(_, { children: [
|
|
28
|
+
u && /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
29
|
+
/* @__PURE__ */ r.jsx(j, { variant: "body1", children: "Строк на странице:" }),
|
|
30
|
+
/* @__PURE__ */ r.jsx(
|
|
31
31
|
x,
|
|
32
32
|
{
|
|
33
33
|
size: "small",
|
|
@@ -35,13 +35,13 @@ const D = (a) => {
|
|
|
35
35
|
disabled: n,
|
|
36
36
|
isShowClearButton: !1,
|
|
37
37
|
onChange: s,
|
|
38
|
-
children: p.map((
|
|
38
|
+
children: p.map((e) => /* @__PURE__ */ r.jsx(h, { value: e, children: e }, e))
|
|
39
39
|
}
|
|
40
40
|
)
|
|
41
41
|
] }),
|
|
42
|
-
/* @__PURE__ */
|
|
42
|
+
/* @__PURE__ */ r.jsx(O, { variant: "h6", children: i() })
|
|
43
43
|
] }),
|
|
44
|
-
o && /* @__PURE__ */
|
|
44
|
+
o && /* @__PURE__ */ r.jsx(
|
|
45
45
|
f,
|
|
46
46
|
{
|
|
47
47
|
disabled: n,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { CellValue, DataGridRowOptions, DataGridRowWithOptions } from '../DataGrid';
|
|
2
2
|
export declare const makeRandomDate: () => string;
|
|
3
|
-
export declare const makeDataList: <TData extends Record<string, CellValue>>(dataObjTemplate: TData, options?: DataGridRowOptions
|
|
3
|
+
export declare const makeDataList: <TData extends Record<string, CellValue>>(dataObjTemplate: TData, options?: DataGridRowOptions) => DataGridRowWithOptions<TData>[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
1
|
import { TextFieldProps as MuiTextFieldProps } from '@mui/material';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
3
|
import { WithoutEmotionSpecific } from '../types';
|
|
4
4
|
export type TextFieldProps = Omit<WithoutEmotionSpecific<MuiTextFieldProps>, 'variant' | 'color'> & {
|
|
5
5
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { j as r } from "../../_virtual/jsx-runtime.mjs";
|
|
2
|
-
import { useMemo as u } from "react";
|
|
3
2
|
import { TextField as B } from "@mui/material";
|
|
3
|
+
import { useMemo as u } from "react";
|
|
4
4
|
import { FormHelperTextContent as a } from "../FormHelperText/FormHelperTextContent/FormHelperTextContent.mjs";
|
|
5
5
|
const E = ({
|
|
6
6
|
success: e,
|