@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.
Files changed (64) hide show
  1. package/lib/components/Autocomplete/Autocomplete.mjs +53 -53
  2. package/lib/components/DataGrid/Body/Body.d.ts +1 -29
  3. package/lib/components/DataGrid/Body/Body.mjs +26 -29
  4. package/lib/components/DataGrid/DataGrid.d.ts +0 -53
  5. package/lib/components/DataGrid/DataGrid.mjs +49 -71
  6. package/lib/components/DataGrid/HeadCell/HeadCell.mjs +21 -20
  7. package/lib/components/DataGrid/HeadCell/styles.mjs +3 -2
  8. package/lib/components/DataGrid/Row/Row.d.ts +1 -38
  9. package/lib/components/DataGrid/Row/Row.mjs +55 -147
  10. package/lib/components/DataGrid/Row/constants.d.ts +0 -1
  11. package/lib/components/DataGrid/Row/constants.mjs +2 -3
  12. package/lib/components/DataGrid/Row/index.d.ts +0 -1
  13. package/lib/components/DataGrid/Row/styles.d.ts +0 -22
  14. package/lib/components/DataGrid/Row/styles.mjs +11 -78
  15. package/lib/components/DataGrid/Row/useLogic/useLogic.d.ts +2 -10
  16. package/lib/components/DataGrid/Row/useLogic/useLogic.mjs +36 -67
  17. package/lib/components/DataGrid/constants.d.ts +0 -3
  18. package/lib/components/DataGrid/constants.mjs +3 -6
  19. package/lib/components/DataGrid/enums.d.ts +0 -4
  20. package/lib/components/DataGrid/enums.mjs +2 -3
  21. package/lib/components/DataGrid/faker.d.ts +1 -1
  22. package/lib/components/DataGrid/types.d.ts +2 -7
  23. package/lib/components/DataGrid/useLogic/useLogic.d.ts +1 -6
  24. package/lib/components/DataGrid/useLogic/useLogic.mjs +31 -36
  25. package/lib/components/DataGridActionCell/useLogic/useLogic.mjs +13 -42
  26. package/lib/components/DataGridPagination/DataGridPagination.mjs +9 -9
  27. package/lib/components/DataGridPagination/faker.d.ts +1 -1
  28. package/lib/components/SearchField/SearchField.d.ts +3 -1
  29. package/lib/components/SearchField/SearchField.mjs +40 -37
  30. package/lib/components/SearchField/styles.mjs +7 -9
  31. package/lib/components/Select/Select.d.ts +1 -1
  32. package/lib/components/Select/Select.mjs +1 -1
  33. package/lib/components/TextField/TextField.d.ts +1 -1
  34. package/lib/components/TextField/TextField.mjs +26 -26
  35. package/lib/index.mjs +189 -197
  36. package/lib/theme/components/MuiAutocomplete.mjs +1 -2
  37. package/package.json +13 -13
  38. package/lib/components/DataGrid/DataGridContext/DataGridContext.d.ts +0 -7
  39. package/lib/components/DataGrid/DataGridContext/DataGridContext.mjs +0 -12
  40. package/lib/components/DataGrid/DataGridContext/DataGridProvider/DataGridProvider.d.ts +0 -6
  41. package/lib/components/DataGrid/DataGridContext/DataGridProvider/DataGridProvider.mjs +0 -41
  42. package/lib/components/DataGrid/DataGridContext/DataGridProvider/index.d.ts +0 -1
  43. package/lib/components/DataGrid/DataGridContext/index.d.ts +0 -2
  44. package/lib/components/DataGrid/Row/NestedChildren/NestedChildren.d.ts +0 -55
  45. package/lib/components/DataGrid/Row/NestedChildren/NestedChildren.mjs +0 -72
  46. package/lib/components/DataGrid/Row/NestedChildren/index.d.ts +0 -1
  47. package/lib/components/DataGrid/Row/NestedChildren/styles.d.ts +0 -20
  48. package/lib/components/DataGrid/Row/NestedChildren/styles.mjs +0 -68
  49. package/lib/components/DataGrid/Row/NestedChildren/useLogic/index.d.ts +0 -1
  50. package/lib/components/DataGrid/Row/NestedChildren/useLogic/useLogic.d.ts +0 -18
  51. package/lib/components/DataGrid/Row/NestedChildren/useLogic/useLogic.mjs +0 -27
  52. package/lib/components/DataGrid/Row/RowContext/RowContext.d.ts +0 -7
  53. package/lib/components/DataGrid/Row/RowContext/RowContext.mjs +0 -11
  54. package/lib/components/DataGrid/Row/RowContext/RowProvider/RowProvider.d.ts +0 -6
  55. package/lib/components/DataGrid/Row/RowContext/RowProvider/RowProvider.mjs +0 -25
  56. package/lib/components/DataGrid/Row/RowContext/RowProvider/index.d.ts +0 -1
  57. package/lib/components/DataGrid/Row/RowContext/index.d.ts +0 -2
  58. package/lib/components/DataGrid/Row/useLogic/utils/getColumnsMap/getColumnsMap.d.ts +0 -4
  59. package/lib/components/DataGrid/Row/useLogic/utils/getColumnsMap/getColumnsMap.mjs +0 -8
  60. package/lib/components/DataGrid/Row/useLogic/utils/getColumnsMap/index.d.ts +0 -1
  61. package/lib/components/DataGrid/Row/useLogic/utils/index.d.ts +0 -2
  62. package/lib/components/DataGrid/Row/useLogic/utils/mergeColumnsOptions/index.d.ts +0 -1
  63. package/lib/components/DataGrid/Row/useLogic/utils/mergeColumnsOptions/mergeColumnsOptions.d.ts +0 -2
  64. 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 z } from "../Tag/Tag.mjs";
8
- import { TextField as B } from "../TextField/TextField.mjs";
9
- import { X as C, ChevronDown as W } from "lucide-react";
10
- import { DEFAULT_PLACEHOLDER as X, DEFAULT_AUTOCOMPLETE_ELEMENT_ROWS_COUNT as $ } from "./constants.mjs";
11
- import { StyledMenuItem as G } from "./styles.mjs";
12
- import { useLogic as J } from "./useLogic/useLogic.mjs";
13
- const ue = (d) => {
14
- const { isValueEmpty: x, isPopperVisible: f, autocompleteProps: R } = J(d), {
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: O,
18
- label: h,
17
+ error: h,
18
+ label: j,
19
19
  getOptionLabel: l,
20
- helperText: j,
21
- inputRef: I,
20
+ helperText: I,
21
+ inputRef: O,
22
22
  multiple: t,
23
23
  size: i = "medium",
24
- placeholder: g = X,
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: K,
31
- loadedDataError: Q,
32
- noOptionsText: Y,
33
- autoHighlight: Z,
34
- renderInput: p,
35
- renderTags: s,
36
- renderOption: c,
37
- ..._
38
- } = d, w = n(
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: I,
42
+ inputRef: O,
43
43
  required: T,
44
44
  placeholder: x ? g : "",
45
- label: h,
45
+ label: j,
46
46
  success: E,
47
- error: O,
48
- helperText: j,
47
+ error: h,
48
+ helperText: I,
49
49
  size: i
50
50
  };
51
- return p ? p(o) : /* @__PURE__ */ r.jsx(B, { ...o });
51
+ return s ? s(o) : /* @__PURE__ */ r.jsx(W, { ...o });
52
52
  },
53
53
  [
54
54
  x,
55
- p,
56
- I,
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
- ), S = n(
65
+ ), v = n(
66
66
  (e, o, m, a) => {
67
- if (c)
68
- return c(
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(G, { ...e, key: e.id }, t && /* @__PURE__ */ r.jsx(F, { children: /* @__PURE__ */ r.jsx(N, { role: "menuitemcheckbox", checked: u }) }), /* @__PURE__ */ r.jsx(
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, c]
85
- ), U = n(
86
- (e, o, m) => s ? s(e, o, m) : e.map((a, u) => {
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
- z,
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, s]
100
- ), v = n(
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
- H,
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(W, {}),
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: v
121
+ component: U
122
122
  }
123
123
  },
124
124
  getOptionLabel: l,
125
- renderInput: w,
126
- renderTags: U,
127
- renderOption: S,
125
+ renderInput: _,
126
+ renderTags: w,
127
+ renderOption: v,
128
128
  ...R
129
129
  }
130
130
  );
131
131
  };
132
132
  export {
133
- ue as Autocomplete
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<TData>;
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 r } from "../../../_virtual/jsx-runtime.mjs";
2
- import { useContext as R, useMemo as h } from "react";
3
- import { ConfigContext as j } from "../../ConfigProvider/ConfigProvider.mjs";
4
- import { ContentState as y } from "../../ContentState/ContentState.mjs";
5
- import { Row as C } from "../Row/Row.mjs";
6
- import "../Row/RowContext/RowContext.mjs";
7
- import { RowContextProvider as E } from "../Row/RowContext/RowProvider/RowProvider.mjs";
8
- import { Wrapper as I } from "./styles.mjs";
9
- import { useLogic as L } from "./useLogic/useLogic.mjs";
10
- const S = 0, W = (e) => {
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: P,
13
+ isError: E,
16
14
  errorMsg: c,
17
15
  minDisplayRows: d,
18
- keyId: t,
16
+ keyId: o,
19
17
  noDataPlaceholder: l,
20
18
  onRetry: f,
21
19
  ...n
22
- } = e, x = h(() => o.map(({ children: g, options: u, ...i }) => {
23
- const w = i[t];
24
- return /* @__PURE__ */ r.jsx(E, { children: /* @__PURE__ */ r.jsx(
25
- C,
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: t,
31
- level: S,
32
- nestedChildren: g,
28
+ keyId: o,
33
29
  ...n
34
- }
35
- ) }, w);
36
- }), [o, t, s, n]);
37
- return /* @__PURE__ */ r.jsx(I, { $isEmpty: p, $minDisplayRows: d, children: /* @__PURE__ */ r.jsx(
38
- y,
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
- ...a,
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: o.length ? x : l
44
+ children: r.length ? g : l
48
45
  }
49
46
  ) });
50
47
  };
51
48
  export {
52
- W as Body
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 S, useCallback as V } from "react";
3
- import { ConfigContext as H } from "../ConfigProvider/ConfigProvider.mjs";
4
- import { Body as O } from "./Body/Body.mjs";
5
- import "./DataGridContext/DataGridContext.mjs";
6
- import { DataGridContextProvider as U } from "./DataGridContext/DataGridProvider/DataGridProvider.mjs";
7
- import { Head as Y } from "./Head/Head.mjs";
8
- import { Loader as k } from "./Loader/Loader.mjs";
9
- import { NoData as F } from "./NoData/NoData.mjs";
10
- import { MIN_DISPLAY_ROWS_BY_DEFAULT as W, INITIAL_OPENED_NESTED_CHILDREN_COUNT_BY_DEFAULT as M, EXPANDED_LEVEL_BY_DEFAULT as X } from "./constants.mjs";
11
- import { Variant as $ } from "./enums.mjs";
12
- import { Container as q, DisabledDataGridWrapper as z, DataGridWrapper as J } from "./styles.mjs";
13
- import { useLogic as K } from "./useLogic/useLogic.mjs";
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: u,
26
- maxHeight: x,
27
- minDisplayRows: C = W,
28
- errorMsg: E,
29
- variant: _ = $.Tree,
30
- footer: i,
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: L,
34
- subrows: P,
35
- keyId: h,
36
- activeRowId: R,
37
- emptyCellValue: b = c,
38
- className: j,
39
- onRowClick: I,
40
- onSort: N,
41
- noDataOptions: n,
42
- onRetry: g
43
- } = e, { moreButtonColumnPosition: y = 1, isVisibleCollapseButton: T = !0 } = P || {}, {
44
- isInitialExpanded: w = !1,
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
- Y,
35
+ E,
52
36
  {
53
- ...l,
54
- sorting: u,
55
- onSort: N
37
+ ...n,
38
+ sorting: x,
39
+ onSort: b
56
40
  }
57
41
  ),
58
42
  /* @__PURE__ */ o.jsx(
59
- O,
43
+ k,
60
44
  {
61
45
  ...m,
62
- activeRowId: R,
63
- keyId: h,
46
+ activeRowId: C,
47
+ keyId: y,
64
48
  selectedRows: f,
65
- minDisplayRows: C,
66
- rows: p,
67
- columns: D,
68
- variant: _,
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: L,
77
- errorMsg: E,
54
+ isError: j,
55
+ errorMsg: h,
78
56
  noDataPlaceholder: G(),
79
- onRowClick: I,
80
- onRetry: g
57
+ onRowClick: P,
58
+ onRetry: w
81
59
  }
82
60
  )
83
61
  ] }),
84
- /* @__PURE__ */ o.jsx(k, { ...d }),
85
- i && i
86
- ] }) });
62
+ /* @__PURE__ */ o.jsx(H, { ...d }),
63
+ a && a
64
+ ] });
87
65
  };
88
66
  export {
89
- co as DataGrid
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 i } from "../enums.mjs";
4
- import { ChevronsUpDown as a, ChevronDown as u, ChevronUp as d } from "lucide-react";
5
- import { Wrapper as x, StyledTypography as j } from "./styles.mjs";
6
- import { useLogic as h } from "./useLogic/useLogic.mjs";
7
- const b = (e) => {
8
- const { wrapperProps: l } = h(e), { startAdornment: s, field: n, isSortable: o, align: p, label: m, sorting: t } = e, c = f(() => {
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 !== n)
12
- return /* @__PURE__ */ r.jsx(a, {});
12
+ if (t?.fieldId !== s)
13
+ return /* @__PURE__ */ r.jsx(l, {});
13
14
  switch (t?.sort) {
14
- case i.ASC:
15
- return /* @__PURE__ */ r.jsx(d, { color: "primary" });
16
- case i.DESC:
17
- return /* @__PURE__ */ r.jsx(u, { color: "primary" });
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(a, {});
20
+ return /* @__PURE__ */ r.jsx(l, {});
20
21
  }
21
- }, [t, o, n]);
22
- return /* @__PURE__ */ r.jsxs(x, { $align: p, $isSortable: o, ...l, children: [
23
- s && s,
24
- /* @__PURE__ */ r.jsxs(j, { variant: "caption", children: [
25
- m,
26
- c
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
- b as HeadCell
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 a = i("div", {
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
- a as Wrapper
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<TData>;
44
+ options?: DataGridRowOptions;
82
45
  /**
83
46
  * Обработчик выбора строки
84
47
  */