@m4l/components 9.4.36 → 9.4.37

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.
@@ -1 +1 @@
1
- {"version":3,"file":"CardsView.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/datagrids/views/CardsView/CardsView.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAQrC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,EACvE,KAAK,EAAE,cAAc,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,2DAmK/C"}
1
+ {"version":3,"file":"CardsView.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/datagrids/views/CardsView/CardsView.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAQrC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,EACvE,KAAK,EAAE,cAAc,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,2DAsK/C"}
@@ -1,88 +1,88 @@
1
1
  import { jsx as m } from "@emotion/react/jsx-runtime";
2
2
  import { useRef as R, useMemo as E, useEffect as b } from "react";
3
3
  import { CardsContainerStyled as S } from "../../slots/DataGridSlot.js";
4
- import { ContainerFlow as F } from "../../../ContainerFlow/ContainerFlow.js";
5
- import { CardRow as T } from "./subcomponents/CardRow/CardRow.js";
4
+ import { ContainerFlow as K } from "../../../ContainerFlow/ContainerFlow.js";
5
+ import { CardRow as D } from "./subcomponents/CardRow/CardRow.js";
6
6
  import { useProcessedColumns as x } from "./hooks/useProcessedColumns/useProcessedColumns.js";
7
- import { calculateCardHeight as D } from "./helpers/calculateCardHeight/calculateCardHeight.js";
7
+ import { calculateCardHeight as F } from "./helpers/calculateCardHeight/calculateCardHeight.js";
8
8
  import { useModalDetail as I } from "./hooks/useModalDetail/useModalDetail.js";
9
- import { scrollToCardElement as K } from "./helpers/scrollToCardElement/scrollToCardElement.js";
9
+ import { scrollToCardElement as M } from "./helpers/scrollToCardElement/scrollToCardElement.js";
10
10
  function q(y) {
11
11
  const {
12
- rows: r,
12
+ rows: i,
13
13
  columns: f,
14
- rowKeyGetter: i,
15
- selectedRows: k,
14
+ rowKeyGetter: s,
15
+ selectedRows: v,
16
16
  onSelectedRowsChange: a,
17
- onRowsChange: h,
17
+ onRowsChange: C,
18
18
  cardsViewConfig: e,
19
- focusOnRowKey: s,
20
- checkedRows: u,
21
- onCheckedRowsChange: C
22
- } = y, w = R(null), d = R(!1), c = x(f), p = x(f, {
19
+ focusOnRowKey: n,
20
+ checkedRows: d,
21
+ onCheckedRowsChange: h
22
+ } = y, w = R(null), u = R(void 0), c = x(f), p = x(f, {
23
23
  applyVisibilityFilter: !1
24
- }), H = I({
24
+ }), k = I({
25
25
  columns: p,
26
- onRowsChange: h,
27
- rows: r
26
+ onRowsChange: C,
27
+ rows: i
28
28
  }), g = E(() => {
29
- const n = c.reduce((t, o) => {
29
+ const t = c.reduce((r, o) => {
30
30
  const l = o.renderCell?.__imageFormatterHeight;
31
- return l ? t + l : t;
31
+ return l ? r + l : r;
32
32
  }, 0);
33
- return D({
33
+ return F({
34
34
  visibleColumnsCount: c.length,
35
35
  customMinHeight: e?.customRender?.minHeight
36
- }) + n;
36
+ }) + t;
37
37
  }, [c, e]);
38
38
  return b(() => {
39
- if (!s) {
40
- d.current = !1;
39
+ if (!n) {
40
+ u.current = void 0;
41
41
  return;
42
42
  }
43
- if (d.current || r.findIndex(
44
- (o) => i(o) === s
43
+ if (u.current === n || i.findIndex(
44
+ (o) => s(o) === n
45
45
  ) === -1)
46
46
  return;
47
- const t = setTimeout(() => {
47
+ const r = setTimeout(() => {
48
48
  const o = w.current;
49
49
  if (!o) {
50
50
  console.warn("container es null, abortando scroll");
51
51
  return;
52
52
  }
53
- K(
53
+ M(
54
54
  o,
55
- s,
55
+ n,
56
56
  "data-attribute",
57
57
  "data-row-key"
58
- ), a && a(/* @__PURE__ */ new Set([s])), d.current = !0;
58
+ ), a && a(/* @__PURE__ */ new Set([n])), u.current = n;
59
59
  }, 300);
60
- return () => clearTimeout(t);
61
- }, [s, r, i, g, a]), c.length === 0 ? null : /* @__PURE__ */ m(S, { ownerState: {}, "data-testid": "cards-container", ref: w, children: /* @__PURE__ */ m(F, { variant: "grid-layout", minWidth: 280, children: r.map((n, t) => {
62
- const o = i(n), l = u?.has(o) || !1, v = u !== void 0 && C !== void 0;
60
+ return () => clearTimeout(r);
61
+ }, [n, i, s, g, a]), c.length === 0 ? null : /* @__PURE__ */ m(S, { ownerState: {}, "data-testid": "cards-container", ref: w, children: /* @__PURE__ */ m(K, { variant: "grid-layout", minWidth: 280, children: i.map((t, r) => {
62
+ const o = s(t), l = d?.has(o) || !1, H = d !== void 0 && h !== void 0;
63
63
  return /* @__PURE__ */ m(
64
- T,
64
+ D,
65
65
  {
66
- row: n,
67
- rows: r,
68
- rowIndex: t,
66
+ row: t,
67
+ rows: i,
68
+ rowIndex: r,
69
69
  columns: c,
70
70
  originalColumns: p,
71
- rowKeyGetter: i,
72
- selectedRows: k,
71
+ rowKeyGetter: s,
72
+ selectedRows: v,
73
73
  onSelectedRowsChange: a,
74
- onRowsChange: h,
74
+ onRowsChange: C,
75
75
  customRender: e?.customRender,
76
76
  minHeight: g,
77
77
  isChecked: l,
78
- showCheckbox: v,
79
- checkedRows: u,
80
- onCheckedRowsChange: C,
81
- onOpenDetail: H,
78
+ showCheckbox: H,
79
+ checkedRows: d,
80
+ onCheckedRowsChange: h,
81
+ onOpenDetail: k,
82
82
  showExpandButton: e && "columnsConfig" in e ? e.showExpandButton : void 0,
83
83
  onExpandClick: e && "columnsConfig" in e ? e.onExpandClick : void 0
84
84
  },
85
- i(n)
85
+ s(t)
86
86
  );
87
87
  }) }) });
88
88
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TableView.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/datagrids/views/TableView/TableView.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAmBrD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,EACvE,KAAK,EAAE,cAAc,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,oDAgX/C"}
1
+ {"version":3,"file":"TableView.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/datagrids/views/TableView/TableView.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAmBrD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,EACvE,KAAK,EAAE,cAAc,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,oDAiX/C"}
@@ -1,10 +1,10 @@
1
- import { jsx as s, jsxs as Z } from "@emotion/react/jsx-runtime";
2
- import { useMemo as C, useState as P, useRef as F, useEffect as R } from "react";
1
+ import { jsx as c, jsxs as Z } from "@emotion/react/jsx-runtime";
2
+ import { useMemo as h, useState as P, useRef as W, useEffect as R } from "react";
3
3
  import ee, { TreeDataGrid as oe } from "react-data-grid";
4
4
  import { DndProvider as re } from "react-dnd";
5
5
  import { HTML5Backend as te } from "react-dnd-html5-backend";
6
6
  import { CheckboxFormatter as ne } from "./subcomponents/CheckboxFormatter/CheckboxFormatter.js";
7
- import { filterHeight as W } from "./subcomponents/SelectColumn/SelectColumn.js";
7
+ import { filterHeight as F } from "./subcomponents/SelectColumn/SelectColumn.js";
8
8
  import { useSortColumnsRows as le } from "./hooks/useSortColumnsRows/useSortColumnsRows.js";
9
9
  import { useFilters as ie } from "../../hooks/shared/useFilters/useFilters.js";
10
10
  import { useDataGrid as se } from "../../hooks/shared/useDataGrid/useDataGrid.js";
@@ -23,31 +23,31 @@ import "../../../Icon/constants.js";
23
23
  import "../../../Icon/slots/IconSlots.js";
24
24
  import { getGroupBy as de } from "./helpers/getGroupBy/getGroupBy.js";
25
25
  import { defaultRowGrouper as fe } from "./helpers/defaultRowGrouper/defaultRowGrouper.js";
26
- import { createRowCellsBackgroundMap as pe, processColumnsWithRowCellsBackground as he } from "./helpers/rowCellsBackground/rowCellsBackground.js";
27
- import { getDefaultAction as Ce } from "../../helpers/shared/getDefaultAction/getDefaultAction.js";
26
+ import { createRowCellsBackgroundMap as pe, processColumnsWithRowCellsBackground as Ce } from "./helpers/rowCellsBackground/rowCellsBackground.js";
27
+ import { getDefaultAction as he } from "../../helpers/shared/getDefaultAction/getDefaultAction.js";
28
28
  function qe(z) {
29
29
  const {
30
30
  columns: L,
31
31
  rows: $,
32
32
  onRowsChange: y,
33
33
  rowKeyGetter: r,
34
- selectedRows: c,
34
+ selectedRows: u,
35
35
  onSelectedRowsChange: t,
36
36
  defaultColumnOptions: j,
37
- focusOnRowKey: f,
38
- rowCellsBackground: u,
39
- treeProps: n,
37
+ focusOnRowKey: n,
38
+ rowCellsBackground: a,
39
+ treeProps: l,
40
40
  ...b
41
- } = z, k = (e) => /* @__PURE__ */ s(
41
+ } = z, k = (e) => /* @__PURE__ */ c(
42
42
  ne,
43
43
  {
44
44
  ...e,
45
45
  tabIndex: e.tabIndex
46
46
  }
47
- ), { finalColumns: l, finalRows: i } = le(
47
+ ), { finalColumns: i, finalRows: s } = le(
48
48
  L,
49
49
  $,
50
- C(
50
+ h(
51
51
  () => ({
52
52
  /**
53
53
  * Función que abre el menú de acciones para una columna
@@ -68,31 +68,31 @@ function qe(z) {
68
68
  currentRowHeaderHeight: p,
69
69
  currentRowHeightVariant: g,
70
70
  size: V,
71
- sortColumns: a,
72
- setSortColumns: H,
73
- columnsConfig: v,
71
+ sortColumns: m,
72
+ setSortColumns: v,
73
+ columnsConfig: H,
74
74
  rowActionsGetter: I
75
- } = se(), _ = C(() => n ? de(v) : [], [v, n]), J = n?.rowGrouper ?? fe, T = C(() => {
76
- if (u)
77
- return typeof u == "function" ? u : pe(u);
78
- }, [u]), D = C(
79
- () => he(
80
- l,
81
- T,
75
+ } = se(), _ = h(() => l ? de(H) : [], [H, l]), J = l?.rowGrouper ?? fe, D = h(() => {
76
+ if (a)
77
+ return typeof a == "function" ? a : pe(a);
78
+ }, [a]), T = h(
79
+ () => Ce(
80
+ i,
81
+ D,
82
82
  r,
83
83
  g
84
84
  ),
85
- [l, T, r, g]
86
- ), m = F(null), [h, A] = P({
85
+ [i, D, r, g]
86
+ ), d = W(null), [C, A] = P({
87
87
  anchorEl: null,
88
88
  columnKey: null
89
- }), x = F(!1), [Q, B] = P(!1), E = (e) => {
90
- Q && (H(e), B(!1));
89
+ }), x = W(void 0), [Q, B] = P(!1), E = (e) => {
90
+ Q && (v(e), B(!1));
91
91
  }, U = (e) => {
92
- B(!0), H(e);
92
+ B(!0), v(e);
93
93
  }, K = ({ row: e }) => {
94
- if (c && t) {
95
- if (c.entries().next().value && c.entries().next().value?.[1] === r(e))
94
+ if (u && t) {
95
+ if (u.entries().next().value && u.entries().next().value?.[1] === r(e))
96
96
  return;
97
97
  const o = /* @__PURE__ */ new Set([r(e)]);
98
98
  t(o);
@@ -100,65 +100,65 @@ function qe(z) {
100
100
  }, M = ({ row: e }) => {
101
101
  if (!I)
102
102
  return;
103
- const o = I(e), d = Ce(o);
104
- d?.onClick && d.onClick(e);
103
+ const o = I(e), f = he(o);
104
+ f?.onClick && f.onClick(e);
105
105
  };
106
106
  R(() => {
107
107
  let e = 0;
108
- for (const o of l) {
109
- const d = a.findIndex(
108
+ for (const o of i) {
109
+ const f = m.findIndex(
110
110
  (Y) => o.key === Y.columnKey
111
111
  );
112
- d !== -1 ? m.current?.element?.querySelector(
112
+ f !== -1 ? d.current?.element?.querySelector(
113
113
  `[role="columnheader"][aria-colindex="${e + 1}"]`
114
- )?.setAttribute("aria-columnsort", `${a[d].direction}`) : m.current?.element?.querySelector(
114
+ )?.setAttribute("aria-columnsort", `${m[f].direction}`) : d.current?.element?.querySelector(
115
115
  `[role="columnheader"][aria-colindex="${e + 1}"]`
116
116
  )?.removeAttribute("aria-columnsort"), e++;
117
117
  }
118
- }, [a, l]), R(() => {
119
- N(i.length);
120
- }, [i]), R(() => {
121
- if (!f) {
122
- x.current = !1;
118
+ }, [m, i]), R(() => {
119
+ N(s.length);
120
+ }, [s]), R(() => {
121
+ if (!n) {
122
+ x.current = void 0;
123
123
  return;
124
124
  }
125
- if (x.current)
125
+ if (x.current === n)
126
126
  return;
127
- const e = i.findIndex(
128
- (o) => r(o) === f
127
+ const e = s.findIndex(
128
+ (o) => r(o) === n
129
129
  );
130
- e !== -1 && (m.current?.scrollToCell({ rowIdx: e }), t && t(/* @__PURE__ */ new Set([f])), x.current = !0);
131
- }, [f, i, r, t]);
130
+ e !== -1 && (d.current?.scrollToCell({ rowIdx: e }), t && t(/* @__PURE__ */ new Set([n])), x.current = n);
131
+ }, [n, s, r, t]);
132
132
  const O = (e, o) => {
133
- q(l[e].key, o);
133
+ q(i[e].key, o);
134
134
  }, S = {
135
135
  resizable: !0,
136
136
  sortable: !0,
137
137
  ...j || {}
138
138
  }, X = ae(
139
- h.columnKey,
140
- l,
139
+ C.columnKey,
140
+ i,
141
141
  !!S.sortable,
142
142
  U
143
143
  );
144
- return /* @__PURE__ */ s(ce, { ownerState: {}, id: "WrapperTable", children: /* @__PURE__ */ Z(
144
+ return /* @__PURE__ */ c(ce, { ownerState: {}, id: "WrapperTable", children: /* @__PURE__ */ Z(
145
145
  ue,
146
146
  {
147
147
  ownerState: { size: V, currentRowHeightVariant: g, currentRowHeight: w },
148
148
  children: [
149
- /* @__PURE__ */ s(re, { backend: te, context: window, children: n ? /* @__PURE__ */ s(
149
+ /* @__PURE__ */ c(re, { backend: te, context: window, children: l ? /* @__PURE__ */ c(
150
150
  oe,
151
151
  {
152
152
  className: "rdg-light",
153
- ref: m,
154
- headerRowHeight: G ? p + W : p,
155
- columns: D,
156
- sortColumns: a,
153
+ ref: d,
154
+ headerRowHeight: G ? p + F : p,
155
+ columns: T,
156
+ sortColumns: m,
157
157
  onSortColumnsChange: E,
158
158
  onColumnResize: O,
159
- rows: i,
159
+ rows: s,
160
160
  onRowsChange: y,
161
- selectedRows: c,
161
+ selectedRows: u,
162
162
  onSelectedRowsChange: t,
163
163
  onCellClick: K,
164
164
  onCellDoubleClick: M,
@@ -170,23 +170,23 @@ function qe(z) {
170
170
  defaultColumnOptions: S,
171
171
  groupBy: _,
172
172
  rowGrouper: J,
173
- expandedGroupIds: n.expandedGroupIds,
174
- onExpandedGroupIdsChange: n.onExpandedGroupIdsChange,
173
+ expandedGroupIds: l.expandedGroupIds,
174
+ onExpandedGroupIdsChange: l.onExpandedGroupIdsChange,
175
175
  ...b
176
176
  }
177
- ) : /* @__PURE__ */ s(
177
+ ) : /* @__PURE__ */ c(
178
178
  ee,
179
179
  {
180
180
  className: "rdg-light",
181
- ref: m,
182
- headerRowHeight: G ? p + W : p,
183
- columns: D,
184
- sortColumns: a,
181
+ ref: d,
182
+ headerRowHeight: G ? p + F : p,
183
+ columns: T,
184
+ sortColumns: m,
185
185
  onSortColumnsChange: E,
186
186
  onColumnResize: O,
187
- rows: i,
187
+ rows: s,
188
188
  onRowsChange: y,
189
- selectedRows: c,
189
+ selectedRows: u,
190
190
  onSelectedRowsChange: t,
191
191
  onCellClick: K,
192
192
  onCellDoubleClick: M,
@@ -199,10 +199,10 @@ function qe(z) {
199
199
  ...b
200
200
  }
201
201
  ) }),
202
- h.columnKey && h.anchorEl instanceof HTMLDivElement && /* @__PURE__ */ s(
202
+ C.columnKey && C.anchorEl instanceof HTMLDivElement && /* @__PURE__ */ c(
203
203
  me,
204
204
  {
205
- externalOpen: h.anchorEl,
205
+ externalOpen: C.anchorEl,
206
206
  onOpen: (e) => {
207
207
  e || A({
208
208
  anchorEl: null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
- "version": "9.4.36",
3
+ "version": "9.4.37",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -53,18 +53,18 @@
53
53
  "date-fns": "^2.30.0",
54
54
  "react-transition-group": "^4.4.5",
55
55
  "react-rnd": "^10.5.2",
56
- "react-spinners": "^0.13.8",
57
56
  "react-color": "^2.19.3",
58
57
  "@mui/x-date-pickers": "6.20.2",
59
58
  "react-draggable": "^4.4.5",
59
+ "react-spinners": "^0.13.8",
60
60
  "react-data-grid": "7.0.0-beta.47",
61
61
  "react-dnd": "^16.0.1",
62
62
  "react-dnd-html5-backend": "^16.0.1",
63
- "simplebar-react": "3.2.6",
64
63
  "chart.js": "^4.4.0",
65
64
  "chartjs-chart-error-bars": "^4.3.3",
66
65
  "qrcode.react": "^3.1.0",
67
66
  "react-resizable": "^3.0.4",
67
+ "simplebar-react": "3.2.6",
68
68
  "react-resizable-panels": "^2.1.8"
69
69
  }
70
70
  }