@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.
Files changed (57) hide show
  1. package/lib/components/DataGrid/Body/Body.d.ts +1 -29
  2. package/lib/components/DataGrid/Body/Body.mjs +26 -29
  3. package/lib/components/DataGrid/DataGrid.d.ts +0 -53
  4. package/lib/components/DataGrid/DataGrid.mjs +49 -71
  5. package/lib/components/DataGrid/HeadCell/HeadCell.mjs +21 -20
  6. package/lib/components/DataGrid/HeadCell/styles.mjs +3 -2
  7. package/lib/components/DataGrid/Row/Row.d.ts +1 -38
  8. package/lib/components/DataGrid/Row/Row.mjs +55 -147
  9. package/lib/components/DataGrid/Row/constants.d.ts +0 -1
  10. package/lib/components/DataGrid/Row/constants.mjs +2 -3
  11. package/lib/components/DataGrid/Row/index.d.ts +0 -1
  12. package/lib/components/DataGrid/Row/styles.d.ts +0 -22
  13. package/lib/components/DataGrid/Row/styles.mjs +11 -78
  14. package/lib/components/DataGrid/Row/useLogic/useLogic.d.ts +2 -10
  15. package/lib/components/DataGrid/Row/useLogic/useLogic.mjs +36 -67
  16. package/lib/components/DataGrid/constants.d.ts +0 -3
  17. package/lib/components/DataGrid/constants.mjs +3 -6
  18. package/lib/components/DataGrid/enums.d.ts +0 -4
  19. package/lib/components/DataGrid/enums.mjs +2 -3
  20. package/lib/components/DataGrid/faker.d.ts +1 -1
  21. package/lib/components/DataGrid/types.d.ts +2 -7
  22. package/lib/components/DataGrid/useLogic/useLogic.d.ts +1 -6
  23. package/lib/components/DataGrid/useLogic/useLogic.mjs +31 -36
  24. package/lib/components/DataGridActionCell/useLogic/useLogic.mjs +13 -42
  25. package/lib/components/DataGridPagination/DataGridPagination.mjs +9 -9
  26. package/lib/components/DataGridPagination/faker.d.ts +1 -1
  27. package/lib/components/TextField/TextField.d.ts +1 -1
  28. package/lib/components/TextField/TextField.mjs +1 -1
  29. package/lib/index.mjs +189 -197
  30. package/package.json +1 -1
  31. package/lib/components/DataGrid/DataGridContext/DataGridContext.d.ts +0 -7
  32. package/lib/components/DataGrid/DataGridContext/DataGridContext.mjs +0 -12
  33. package/lib/components/DataGrid/DataGridContext/DataGridProvider/DataGridProvider.d.ts +0 -6
  34. package/lib/components/DataGrid/DataGridContext/DataGridProvider/DataGridProvider.mjs +0 -41
  35. package/lib/components/DataGrid/DataGridContext/DataGridProvider/index.d.ts +0 -1
  36. package/lib/components/DataGrid/DataGridContext/index.d.ts +0 -2
  37. package/lib/components/DataGrid/Row/NestedChildren/NestedChildren.d.ts +0 -55
  38. package/lib/components/DataGrid/Row/NestedChildren/NestedChildren.mjs +0 -72
  39. package/lib/components/DataGrid/Row/NestedChildren/index.d.ts +0 -1
  40. package/lib/components/DataGrid/Row/NestedChildren/styles.d.ts +0 -20
  41. package/lib/components/DataGrid/Row/NestedChildren/styles.mjs +0 -68
  42. package/lib/components/DataGrid/Row/NestedChildren/useLogic/index.d.ts +0 -1
  43. package/lib/components/DataGrid/Row/NestedChildren/useLogic/useLogic.d.ts +0 -18
  44. package/lib/components/DataGrid/Row/NestedChildren/useLogic/useLogic.mjs +0 -27
  45. package/lib/components/DataGrid/Row/RowContext/RowContext.d.ts +0 -7
  46. package/lib/components/DataGrid/Row/RowContext/RowContext.mjs +0 -11
  47. package/lib/components/DataGrid/Row/RowContext/RowProvider/RowProvider.d.ts +0 -6
  48. package/lib/components/DataGrid/Row/RowContext/RowProvider/RowProvider.mjs +0 -25
  49. package/lib/components/DataGrid/Row/RowContext/RowProvider/index.d.ts +0 -1
  50. package/lib/components/DataGrid/Row/RowContext/index.d.ts +0 -2
  51. package/lib/components/DataGrid/Row/useLogic/utils/getColumnsMap/getColumnsMap.d.ts +0 -4
  52. package/lib/components/DataGrid/Row/useLogic/utils/getColumnsMap/getColumnsMap.mjs +0 -8
  53. package/lib/components/DataGrid/Row/useLogic/utils/getColumnsMap/index.d.ts +0 -1
  54. package/lib/components/DataGrid/Row/useLogic/utils/index.d.ts +0 -2
  55. package/lib/components/DataGrid/Row/useLogic/utils/mergeColumnsOptions/index.d.ts +0 -1
  56. package/lib/components/DataGrid/Row/useLogic/utils/mergeColumnsOptions/mergeColumnsOptions.d.ts +0 -2
  57. package/lib/components/DataGrid/Row/useLogic/utils/mergeColumnsOptions/mergeColumnsOptions.mjs +0 -14
@@ -1,45 +1,41 @@
1
- import { useRef as N, useEffect as V, useMemo as j, useCallback as h } from "react";
2
- import { Variant as q } from "../enums.mjs";
3
- import { uniqueBy as M, prop as O } from "remeda";
4
- import { getGridTemplateColumns as S } from "./utils/getGridTemplateColumns/getGridTemplateColumns.mjs";
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: o,
9
+ isLoading: l,
14
10
  isDisabled: u,
15
11
  onSelectRow: n
16
12
  }) => {
17
- const d = !!r?.length, c = !!n, B = o || u, D = Object.is(b, q.Subrows) ? { ...C, isInitialExpanded: !0 } : g, f = r.filter(
13
+ const b = !!r?.length, c = !!n, g = l || u, f = r.filter(
18
14
  (t) => !(t.options?.isDisabled || t.options?.isNotSelectable)
19
- ), p = N([]);
20
- V(() => {
21
- o || (p.current = r);
22
- }, [r, o]);
23
- const m = S(s), v = j(() => f.filter(
24
- (t) => !i.find((l) => l[e] === t[e])
25
- ).length, [f, i, e]), P = h(() => r.length <= 1 ? s.map((t) => ({ ...t, sortable: !1 })) : s, [s, r]), x = o ? p.current : r, A = (t) => {
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 = M(
25
+ const a = q(
30
26
  [...i, ...f],
31
- O(e)
27
+ x(e)
32
28
  );
33
29
  return n(a);
34
30
  }
35
- const l = i.filter(
36
- (a) => !r.find((G) => G[e] === a[e])
31
+ const o = i.filter(
32
+ (a) => !r.find((P) => P[e] === a[e])
37
33
  );
38
- n(l);
39
- }, E = h(
40
- (t) => (l) => {
34
+ n(o);
35
+ }, v = m(
36
+ (t) => (o) => {
41
37
  if (n) {
42
- if (l.target.checked)
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: B,
55
- treeRenderConfig: D,
56
- renderRows: x,
50
+ isDataGridDisabled: g,
51
+ renderRows: D,
57
52
  headProps: {
58
53
  rowsCount: f.length,
59
- uncheckedRowsCount: v,
60
- gridColumns: m,
54
+ uncheckedRowsCount: C,
55
+ gridColumns: h,
61
56
  isSelectable: c,
62
- columns: P(),
63
- onSelectAllRows: A
57
+ columns: B(),
58
+ onSelectAllRows: d
64
59
  },
65
60
  bodyProps: {
66
- gridColumns: m,
61
+ gridColumns: h,
67
62
  isSelectable: c,
68
- onSelectRow: E
63
+ onSelectRow: v
69
64
  },
70
65
  loaderProps: {
71
- isLoading: d && o,
66
+ isLoading: b && l,
72
67
  isVisibleDivider: !!r.length,
73
68
  isDisabled: u
74
69
  }
75
70
  };
76
71
  };
77
72
  export {
78
- J as useLogic
73
+ j as useLogic
79
74
  };
@@ -1,49 +1,20 @@
1
- import { useContext as s, useEffect as l, useCallback as d } from "react";
2
- import "../../../_virtual/jsx-runtime.mjs";
3
- import "../../ConfigProvider/ConfigProvider.mjs";
4
- import "clsx";
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: p, secondary: m } = r, { addDisabledRow: n, removeDisabledRow: e } = s(f), t = [...p, ...m || []].find(
30
- (o) => o.isBlockingOperation && o.loading
31
- ), a = !!t;
32
- l(() => {
33
- if (t)
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
- [i]
12
+ [o]
42
13
  );
43
- return { isDisabledAction: a, handleActionClick: c, handleWrapperClick: (o) => {
44
- o.stopPropagation();
14
+ return { isDisabledAction: a, handleActionClick: l, handleWrapperClick: (n) => {
15
+ n.stopPropagation();
45
16
  } };
46
17
  };
47
18
  export {
48
- H as useLogic
19
+ d as useLogic
49
20
  };
@@ -1,4 +1,4 @@
1
- import { j as e } from "../../_virtual/jsx-runtime.mjs";
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__ */ e.jsxs(E, { className: g, children: [
27
- /* @__PURE__ */ e.jsxs(_, { children: [
28
- u && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
29
- /* @__PURE__ */ e.jsx(j, { variant: "body1", children: "Строк на странице:" }),
30
- /* @__PURE__ */ e.jsx(
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((r) => /* @__PURE__ */ e.jsx(h, { value: r, children: r }, r))
38
+ children: p.map((e) => /* @__PURE__ */ r.jsx(h, { value: e, children: e }, e))
39
39
  }
40
40
  )
41
41
  ] }),
42
- /* @__PURE__ */ e.jsx(O, { variant: "h6", children: i() })
42
+ /* @__PURE__ */ r.jsx(O, { variant: "h6", children: i() })
43
43
  ] }),
44
- o && /* @__PURE__ */ e.jsx(
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<TData>) => DataGridRowWithOptions<TData>[];
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,