react-ecosistema-unp 1.7.26 → 1.8.0-pre.0

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,19 +1,19 @@
1
1
  import { jsx as s, jsxs as d } from "react/jsx-runtime";
2
- import X, { useState as m, useEffect as Y } from "react";
3
- import { v as Z, w as S } from "../../../index-DDjnZyBf.js";
4
- import { a as w, b as ee, c as te, d as re } from "../../../index-D3WseyJh.js";
5
- import { T as se } from "../../../Table-C5ydZooy.js";
6
- import { F as oe, a as ie } from "../../../FormGroup-BLpFcIN5.js";
7
- import { B as ne } from "../../../Button-B87TJYml.js";
8
- import '../../../assets/Tabla.css';const ue = ({
2
+ import Z, { useState as m, useEffect as L } from "react";
3
+ import { v as S, w } from "../../../index-DDjnZyBf.js";
4
+ import { a as ee, b as te, c as re, d as se } from "../../../index-D3WseyJh.js";
5
+ import { T as oe } from "../../../Table-C5ydZooy.js";
6
+ import { F as ie, a as ne } from "../../../FormGroup-BLpFcIN5.js";
7
+ import { B as ae } from "../../../Button-B87TJYml.js";
8
+ import '../../../assets/Tabla.css';const he = ({
9
9
  columns: u,
10
10
  displayedData: f,
11
11
  // tableData,
12
- hasMoreData: x,
13
- setHasMoreData: I,
14
- visibleData: D,
15
- setVisibleData: O,
16
- handleCellClick: P,
12
+ hasMoreData: D,
13
+ // setHasMoreData,
14
+ visibleData: x,
15
+ setVisibleData: P,
16
+ handleCellClick: U,
17
17
  totalDias: v,
18
18
  isShared: b,
19
19
  //
@@ -26,49 +26,56 @@ import '../../../assets/Tabla.css';const ue = ({
26
26
  enableRowSelection: h = !1,
27
27
  // Indicador para aumentar la selección de casos por gestionar
28
28
  extendedSelection: _,
29
- cellSelectionColor: U
29
+ cellSelectionColor: V,
30
+ //
31
+ onLoadMore: B,
32
+ isFiltering: A
30
33
  }) => {
31
- const [l, V] = m({
34
+ const [l, W] = m({
32
35
  key: null,
33
36
  direction: null
34
- }), [c, W] = m([]), [y, B] = m(null), [k, A] = m(null);
35
- Y(() => {
37
+ }), [c, $] = m([]), [y, G] = m(null), [k, H] = m(null);
38
+ L(() => {
36
39
  C == null || C(c);
37
40
  }, [c]);
38
- const $ = (e, o) => {
39
- const r = k || j, i = r.findIndex((p) => p.numeroRegistro === e);
41
+ const q = (e, o) => {
42
+ const r = k || z, i = r.findIndex((p) => p.numeroRegistro === e);
40
43
  if (i === -1) return;
41
44
  const n = r[i], t = c.includes(e);
42
45
  let a = [];
43
46
  if (t)
44
- a = c.filter((p) => p !== e), a.length === 0 && (A(null), B(null));
47
+ a = c.filter((p) => p !== e), a.length === 0 && (H(null), G(null));
45
48
  else if (c.length === 0) {
46
- a = [e], B(n.tipoMesa);
47
- const p = n.tipoMesa, K = r.filter((g) => g.tipoMesa === p && g.numeroRegistro !== e), E = r.filter((g) => g.tipoMesa !== p), z = r.findIndex((g) => g.numeroRegistro === e), L = E.slice(0, z), Q = E.slice(z);
48
- A([...L, n, ...K, ...Q]);
49
+ a = [e], G(n.tipoMesa);
50
+ const p = n.tipoMesa, Q = r.filter((g) => g.tipoMesa === p && g.numeroRegistro !== e), I = r.filter((g) => g.tipoMesa !== p), O = r.findIndex((g) => g.numeroRegistro === e), X = I.slice(0, O), Y = I.slice(O);
51
+ H([...X, n, ...Q, ...Y]);
49
52
  } else {
50
53
  if (y && n.tipoMesa !== y) return;
51
54
  a = [...c, e];
52
55
  }
53
- W(a);
54
- }, G = { i: 0 }, H = (e) => {
56
+ $(a);
57
+ }, j = { i: 0 }, E = (e) => {
55
58
  if (v) {
56
59
  const o = e / v * 100;
57
60
  return o <= 25 ? { backgroundColor: "#3AB34A", color: "#FFFFFF" } : o <= 50 ? { backgroundColor: "#F8EB10", color: "#000000" } : o <= 75 ? { backgroundColor: "#F79122", color: "#000000" } : { backgroundColor: "#E91720", color: "#FFFFFF" };
58
61
  }
59
62
  return { backgroundColor: "transparent", color: "inherit" };
60
- }, q = (e) => {
61
- const { scrollTop: o, clientHeight: r, scrollHeight: i } = e.currentTarget;
62
- i - o <= r + 50 && x && O((n) => {
63
- const t = n + 5;
64
- return t >= f.length && I(!1), Math.min(t, f.length);
65
- });
66
63
  }, J = (e) => {
67
- V((o) => ({
64
+ const { scrollTop: o, clientHeight: r, scrollHeight: i } = e.currentTarget;
65
+ if (i - o <= r + 50) {
66
+ if (P((n) => {
67
+ const t = n + 10;
68
+ return Math.min(t, f.length);
69
+ }), A)
70
+ return;
71
+ f.length - x < 5 && B && B();
72
+ }
73
+ }, K = (e) => {
74
+ W((o) => ({
68
75
  key: e,
69
76
  direction: o.key === e && o.direction === "asc" ? "desc" : "asc"
70
77
  }));
71
- }, j = (() => {
78
+ }, z = (() => {
72
79
  if (!l.key) return f;
73
80
  if (b) {
74
81
  const [e, o] = f.reduce(
@@ -84,8 +91,8 @@ import '../../../assets/Tabla.css';const ue = ({
84
91
  const r = e[l.key], i = o[l.key];
85
92
  return typeof r == "number" && typeof i == "number" ? l.direction === "asc" ? r - i : i - r : typeof r == "string" && typeof i == "string" ? l.direction === "asc" ? r.localeCompare(i) : i.localeCompare(r) : 0;
86
93
  });
87
- })(), F = k || (l.direction === "asc" || l.direction === "desc" ? j : f);
88
- return /* @__PURE__ */ s("div", { className: "table_container", children: /* @__PURE__ */ s("div", { className: "table-scroll", onScroll: q, children: /* @__PURE__ */ d(se, { striped: !0, hover: !0, children: [
94
+ })(), F = k || (l.direction === "asc" || l.direction === "desc" ? z : f);
95
+ return /* @__PURE__ */ s("div", { className: "table_container", children: /* @__PURE__ */ s("div", { className: "table-scroll", onScroll: J, children: /* @__PURE__ */ d(oe, { striped: !0, hover: !0, children: [
89
96
  /* @__PURE__ */ d("thead", { children: [
90
97
  /* @__PURE__ */ d("tr", { children: [
91
98
  h && /* @__PURE__ */ s("th", { className: "table-header-unp" }),
@@ -93,12 +100,12 @@ import '../../../assets/Tabla.css';const ue = ({
93
100
  "th",
94
101
  {
95
102
  className: "table-header-unp",
96
- onClick: () => (e.sorter || T) && J(e.key),
103
+ onClick: () => (e.sorter || T) && K(e.key),
97
104
  style: { cursor: N ? "pointer" : "default" },
98
105
  children: [
99
106
  e.label,
100
107
  " ",
101
- c.length == 0 && (e.sorter || T) ? l.key === e.key ? l.direction === "asc" ? /* @__PURE__ */ s(w, {}) : /* @__PURE__ */ s(ee, {}) : /* @__PURE__ */ s(te, {}) : null
108
+ c.length == 0 && (e.sorter || T) ? l.key === e.key ? l.direction === "asc" ? /* @__PURE__ */ s(ee, {}) : /* @__PURE__ */ s(te, {}) : /* @__PURE__ */ s(re, {}) : null
102
109
  ]
103
110
  },
104
111
  o
@@ -106,9 +113,9 @@ import '../../../assets/Tabla.css';const ue = ({
106
113
  ] }),
107
114
  c.length == 0 && N && /* @__PURE__ */ d("tr", { children: [
108
115
  h && /* @__PURE__ */ s("th", { className: "table-header-unp" }),
109
- u.map((e, o) => /* @__PURE__ */ s("th", { children: /* @__PURE__ */ d(oe, { className: "mx-1 position-relative", children: [
116
+ u.map((e, o) => /* @__PURE__ */ s("th", { children: /* @__PURE__ */ d(ie, { className: "mx-1 position-relative", children: [
110
117
  /* @__PURE__ */ s(
111
- ie,
118
+ ne,
112
119
  {
113
120
  type: "text",
114
121
  placeholder: `Buscar ${e.label}`,
@@ -118,7 +125,7 @@ import '../../../assets/Tabla.css';const ue = ({
118
125
  }
119
126
  ),
120
127
  R[e.key] && /* @__PURE__ */ s(
121
- ne,
128
+ ae,
122
129
  {
123
130
  variant: "link",
124
131
  size: "sm",
@@ -132,11 +139,11 @@ import '../../../assets/Tabla.css';const ue = ({
132
139
  ] })
133
140
  ] }),
134
141
  /* @__PURE__ */ d("tbody", { children: [
135
- F.slice(0, D).map((e, o) => {
142
+ F.slice(0, x).map((e, o) => {
136
143
  let r = !1;
137
- b ? e.estadoRegistro === "en_gestion" ? r = !0 : e.estadoRegistro === "por_gestionar" && (!_ && G.i < 60 ? (r = !0, G.i++) : _ && (r = !0)) : r = !0;
144
+ b ? e.estadoRegistro === "en_gestion" ? r = !0 : e.estadoRegistro === "por_gestionar" && (!_ && j.i < 60 ? (r = !0, j.i++) : _ && (r = !0)) : r = !0;
138
145
  const i = h && y != null && e.tipoMesa !== y, n = c.includes(e.numeroRegistro);
139
- return /* @__PURE__ */ d(X.Fragment, { children: [
146
+ return /* @__PURE__ */ d(Z.Fragment, { children: [
140
147
  /* @__PURE__ */ d(
141
148
  "tr",
142
149
  {
@@ -154,18 +161,18 @@ import '../../../assets/Tabla.css';const ue = ({
154
161
  cursor: i ? "not-allowed" : "pointer"
155
162
  },
156
163
  onClick: (t) => {
157
- t.stopPropagation(), i || $(e.numeroRegistro);
164
+ t.stopPropagation(), i || q(e.numeroRegistro);
158
165
  },
159
- children: n ? /* @__PURE__ */ s(re, { size: 18, style: { color: "#505050ff" } }) : /* @__PURE__ */ s(Z, { size: 18, style: { color: "#505050ff" } })
166
+ children: n ? /* @__PURE__ */ s(se, { size: 18, style: { color: "#505050ff" } }) : /* @__PURE__ */ s(S, { size: 18, style: { color: "#505050ff" } })
160
167
  }
161
168
  ),
162
169
  u.map((t, a) => /* @__PURE__ */ s(
163
170
  "td",
164
171
  {
165
- onClick: () => r ? P(t, e) : {},
172
+ onClick: () => r ? U(t, e) : {},
166
173
  style: {
167
174
  cursor: (t.hasModal || t.redirectTo) && r ? "pointer" : "default",
168
- "--cell-selection-bg-color": U || void 0
175
+ "--cell-selection-bg-color": V || void 0
169
176
  },
170
177
  className: r ? t.redirectTo ? "cell-redirect" : t.hasModal ? "cell-with-modal" : "" : "",
171
178
  children: t.key === "diasHabiles" ? /* @__PURE__ */ s(
@@ -182,10 +189,10 @@ import '../../../assets/Tabla.css';const ue = ({
182
189
  padding: "8px",
183
190
  borderRadius: "100px",
184
191
  width: "40px",
185
- backgroundColor: H(
192
+ backgroundColor: E(
186
193
  e.diasHabiles
187
194
  ).backgroundColor,
188
- color: H(
195
+ color: E(
189
196
  e.diasHabiles
190
197
  ).color
191
198
  },
@@ -210,13 +217,13 @@ import '../../../assets/Tabla.css';const ue = ({
210
217
  fontWeight: "600",
211
218
  color: o % 2 === 0 ? "#365072" : "#303D50",
212
219
  backgroundColor: o % 2 === 0 ? "#fefefe" : "#f9fafa"
213
- }, children: /* @__PURE__ */ s(S, { style: { fontSize: "1.3rem" } }) }) }) })
220
+ }, children: /* @__PURE__ */ s(w, { style: { fontSize: "1.3rem" } }) }) }) })
214
221
  ] }, o);
215
222
  }),
216
- x && /* @__PURE__ */ s("tr", { children: /* @__PURE__ */ s("td", { colSpan: u.length, className: "text-center", children: "Cargando más datos..." }) })
223
+ D && !A && /* @__PURE__ */ s("tr", { children: /* @__PURE__ */ s("td", { colSpan: u.length, className: "text-center", children: "Cargando más datos..." }) })
217
224
  ] })
218
225
  ] }) }) });
219
226
  };
220
227
  export {
221
- ue as Tabla
228
+ he as Tabla
222
229
  };