react-ecosistema-unp 1.7.4 → 1.7.7

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,93 +1,93 @@
1
1
  import { jsx as r, jsxs as d } from "react/jsx-runtime";
2
- import _, { useState as j } from "react";
3
- import { v as A } from "../../../index-069JzHFQ.js";
4
- import { a as G, b as R, c as E } from "../../../index-CgSyrJ_X.js";
5
- import { T as z } from "../../../Table-C5ydZooy.js";
6
- import { F as M, a as O } from "../../../FormGroup-BLpFcIN5.js";
7
- import { B as U } from "../../../Button-B87TJYml.js";
8
- import '../../../assets/Tabla.css';const L = ({
9
- columns: p,
10
- displayedData: a,
2
+ import H, { useState as S } from "react";
3
+ import { v as j } from "../../../index-069JzHFQ.js";
4
+ import { a as A, b as E, c as z } from "../../../index-CgSyrJ_X.js";
5
+ import { T as M } from "../../../Table-C5ydZooy.js";
6
+ import { F as O, a as U } from "../../../FormGroup-BLpFcIN5.js";
7
+ import { B as V } from "../../../Button-B87TJYml.js";
8
+ import '../../../assets/Tabla.css';const P = ({
9
+ columns: f,
10
+ displayedData: l,
11
11
  // tableData,
12
12
  hasMoreData: h,
13
- setHasMoreData: m,
14
- visibleData: v,
15
- setVisibleData: x,
16
- handleCellClick: N,
17
- totalDias: g,
18
- isShared: y,
13
+ setHasMoreData: v,
14
+ visibleData: x,
15
+ setVisibleData: N,
16
+ handleCellClick: T,
17
+ totalDias: y,
18
+ isShared: p,
19
19
  //
20
- enableColumnSearch: k,
21
- columnSearch: u,
20
+ enableColumnSearch: u,
21
+ columnSearch: k,
22
22
  handleColumnSearch: b,
23
23
  enableColumnSorter: C
24
24
  }) => {
25
- const [i, T] = j({
25
+ const [i, B] = S({
26
26
  key: null,
27
27
  direction: null
28
- }), F = (e) => {
29
- if (g) {
30
- const o = e / g * 100;
28
+ }), F = { i: 0 }, m = (e) => {
29
+ if (y) {
30
+ const o = e / y * 100;
31
31
  return o <= 25 ? { backgroundColor: "#3AB34A", color: "#FFFFFF" } : o <= 50 ? { backgroundColor: "#F8EB10", color: "#000000" } : o <= 75 ? { backgroundColor: "#F79122", color: "#000000" } : { backgroundColor: "#E91720", color: "#FFFFFF" };
32
32
  }
33
33
  return { backgroundColor: "transparent", color: "inherit" };
34
- }, B = (e) => {
35
- const { scrollTop: o, clientHeight: t, scrollHeight: n } = e.currentTarget;
36
- n - o <= t + 50 && h && x((l) => {
37
- const s = l + 5;
38
- return s >= a.length && m(!1), Math.min(s, a.length);
34
+ }, _ = (e) => {
35
+ const { scrollTop: o, clientHeight: n, scrollHeight: t } = e.currentTarget;
36
+ t - o <= n + 50 && h && N((a) => {
37
+ const s = a + 5;
38
+ return s >= l.length && v(!1), Math.min(s, l.length);
39
39
  });
40
- }, S = (e) => {
41
- T((o) => ({
40
+ }, R = (e) => {
41
+ B((o) => ({
42
42
  key: e,
43
43
  direction: o.key === e && o.direction === "asc" ? "desc" : "asc"
44
44
  }));
45
- }, H = (() => {
46
- if (!i.key) return a;
47
- if (y) {
48
- const [e, o] = a.reduce(
49
- (n, l) => (n[l.estadoRegistro === "en_gestion" ? 0 : 1].push(l), n),
45
+ }, G = (() => {
46
+ if (!i.key) return l;
47
+ if (p) {
48
+ const [e, o] = l.reduce(
49
+ (t, a) => (t[a.estadoRegistro === "en_gestion" ? 0 : 1].push(a), t),
50
50
  [[], []]
51
51
  );
52
- return [...[...e].sort((n, l) => {
53
- const s = n[i.key], c = l[i.key];
52
+ return [...[...e].sort((t, a) => {
53
+ const s = t[i.key], c = a[i.key];
54
54
  return typeof s == "number" && typeof c == "number" ? i.direction === "asc" ? s - c : c - s : typeof s == "string" && typeof c == "string" ? i.direction === "asc" ? s.localeCompare(c) : c.localeCompare(s) : 0;
55
55
  }), ...o];
56
56
  }
57
- return [...a].sort((e, o) => {
58
- const t = e[i.key], n = o[i.key];
59
- return typeof t == "number" && typeof n == "number" ? i.direction === "asc" ? t - n : n - t : typeof t == "string" && typeof n == "string" ? i.direction === "asc" ? t.localeCompare(n) : n.localeCompare(t) : 0;
57
+ return [...l].sort((e, o) => {
58
+ const n = e[i.key], t = o[i.key];
59
+ return typeof n == "number" && typeof t == "number" ? i.direction === "asc" ? n - t : t - n : typeof n == "string" && typeof t == "string" ? i.direction === "asc" ? n.localeCompare(t) : t.localeCompare(n) : 0;
60
60
  });
61
- })(), f = i.direction === "asc" || i.direction === "desc" ? H : a;
62
- return /* @__PURE__ */ r("div", { className: "table_container", children: /* @__PURE__ */ r("div", { className: "table-scroll", onScroll: B, children: /* @__PURE__ */ d(z, { striped: !0, hover: !0, children: [
61
+ })(), g = i.direction === "asc" || i.direction === "desc" ? G : l;
62
+ return /* @__PURE__ */ r("div", { className: "table_container", children: /* @__PURE__ */ r("div", { className: "table-scroll", onScroll: _, children: /* @__PURE__ */ d(M, { striped: !0, hover: !0, children: [
63
63
  /* @__PURE__ */ d("thead", { children: [
64
- /* @__PURE__ */ r("tr", { children: p.map((e, o) => /* @__PURE__ */ d(
64
+ /* @__PURE__ */ r("tr", { children: f.map((e, o) => /* @__PURE__ */ d(
65
65
  "th",
66
66
  {
67
67
  className: "table-header-unp",
68
- onClick: () => (e.sorter || C) && S(e.key),
69
- style: { cursor: k ? "pointer" : "default" },
68
+ onClick: () => (e.sorter || C) && R(e.key),
69
+ style: { cursor: u ? "pointer" : "default" },
70
70
  children: [
71
71
  e.label,
72
72
  " ",
73
- e.sorter || C ? i.key === e.key ? i.direction === "asc" ? /* @__PURE__ */ r(G, {}) : /* @__PURE__ */ r(R, {}) : /* @__PURE__ */ r(E, {}) : null
73
+ e.sorter || C ? i.key === e.key ? i.direction === "asc" ? /* @__PURE__ */ r(A, {}) : /* @__PURE__ */ r(E, {}) : /* @__PURE__ */ r(z, {}) : null
74
74
  ]
75
75
  },
76
76
  o
77
77
  )) }),
78
- k && /* @__PURE__ */ r("tr", { children: p.map((e, o) => /* @__PURE__ */ r("th", { children: /* @__PURE__ */ d(M, { className: "mx-1 position-relative", children: [
78
+ u && /* @__PURE__ */ r("tr", { children: f.map((e, o) => /* @__PURE__ */ r("th", { children: /* @__PURE__ */ d(O, { className: "mx-1 position-relative", children: [
79
79
  /* @__PURE__ */ r(
80
- O,
80
+ U,
81
81
  {
82
82
  type: "text",
83
83
  placeholder: `Buscar ${e.label}`,
84
- value: u[e.key] || "",
85
- onChange: (t) => b(e.key, t.target.value),
86
- className: "pe-4 search-column-input"
84
+ value: k[e.key] || "",
85
+ onChange: (n) => b(e.key, n.target.value),
86
+ className: "search-column-input"
87
87
  }
88
88
  ),
89
- u[e.key] && /* @__PURE__ */ r(
90
- U,
89
+ k[e.key] && /* @__PURE__ */ r(
90
+ V,
91
91
  {
92
92
  variant: "link",
93
93
  size: "sm",
@@ -100,59 +100,62 @@ import '../../../assets/Tabla.css';const L = ({
100
100
  ] }) }, o)) })
101
101
  ] }),
102
102
  /* @__PURE__ */ d("tbody", { children: [
103
- f.slice(0, v).map((e, o) => /* @__PURE__ */ d(_.Fragment, { children: [
104
- /* @__PURE__ */ r("tr", { children: p.map((t, n) => /* @__PURE__ */ r(
105
- "td",
106
- {
107
- onClick: () => N(t, e),
108
- style: {
109
- cursor: t.hasModal || t.redirectTo ? "pointer" : "default"
103
+ g.slice(0, x).map((e, o) => {
104
+ let n = !1;
105
+ return p ? e.estadoRegistro === "en_gestion" ? n = !0 : e.estadoRegistro === "por_gestionar" && F.i < 5 && (n = !0, F.i++) : n = !0, /* @__PURE__ */ d(H.Fragment, { children: [
106
+ /* @__PURE__ */ r("tr", { children: f.map((t, a) => /* @__PURE__ */ r(
107
+ "td",
108
+ {
109
+ onClick: () => n ? T(t, e) : {},
110
+ style: {
111
+ cursor: (t.hasModal || t.redirectTo) && n ? "pointer" : "default"
112
+ },
113
+ className: n ? t.redirectTo ? "cell-redirect" : t.hasModal ? "cell-with-modal" : "" : "",
114
+ children: t.key === "diasHabiles" ? /* @__PURE__ */ r(
115
+ "div",
116
+ {
117
+ style: {
118
+ display: "flex",
119
+ justifyContent: "center"
120
+ },
121
+ children: /* @__PURE__ */ r(
122
+ "div",
123
+ {
124
+ style: {
125
+ padding: "8px",
126
+ borderRadius: "100px",
127
+ width: "40px",
128
+ backgroundColor: m(
129
+ e.diasHabiles
130
+ ).backgroundColor,
131
+ color: m(
132
+ e.diasHabiles
133
+ ).color
134
+ },
135
+ children: /* @__PURE__ */ r("span", { children: e.diasHabiles })
136
+ }
137
+ )
138
+ }
139
+ ) : t.renderComponent ? t.renderComponent(e) : /* @__PURE__ */ r("div", { children: t.truncateText && (typeof e[t.key] == "string" || e[t.key] instanceof String) && e[t.key].length > 26 ? e[t.key].slice(0, 26) + "..." : e[t.key] })
110
140
  },
111
- className: t.redirectTo ? "cell-redirect" : t.hasModal ? "cell-with-modal" : "",
112
- children: t.key === "diasHabiles" ? /* @__PURE__ */ r(
113
- "div",
114
- {
115
- style: {
116
- display: "flex",
117
- justifyContent: "center"
118
- },
119
- children: /* @__PURE__ */ r(
120
- "div",
121
- {
122
- style: {
123
- padding: "8px",
124
- borderRadius: "100px",
125
- width: "40px",
126
- backgroundColor: F(
127
- e.diasHabiles
128
- ).backgroundColor,
129
- color: F(
130
- e.diasHabiles
131
- ).color
132
- },
133
- children: /* @__PURE__ */ r("span", { children: e.diasHabiles })
134
- }
135
- )
136
- }
137
- ) : t.renderComponent ? t.renderComponent(e) : /* @__PURE__ */ r("div", { children: t.truncateText && (typeof e[t.key] == "string" || e[t.key] instanceof String) && e[t.key].length > 26 ? e[t.key].slice(0, 26) + "..." : e[t.key] })
138
- },
139
- n
140
- )) }),
141
- y && e.estadoRegistro === "en_gestion" && !f.some((t) => t.estadoRegistro === "en_gestion" && f.indexOf(t) > o) && /* @__PURE__ */ r("tr", { children: /* @__PURE__ */ r("td", { colSpan: p.length, className: "text-center", style: { padding: "0 0 0 0" }, children: /* @__PURE__ */ r("div", { style: {
142
- height: "2rem",
143
- display: "flex",
144
- flexDirection: "row",
145
- justifyContent: "center",
146
- alignItems: "center",
147
- fontWeight: "600",
148
- color: o % 2 === 0 ? "#365072" : "#303D50",
149
- backgroundColor: o % 2 === 0 ? "#fefefe" : "#f9fafa"
150
- }, children: /* @__PURE__ */ r(A, { style: { fontSize: "1.3rem" } }) }) }) })
151
- ] }, o)),
152
- h && /* @__PURE__ */ r("tr", { children: /* @__PURE__ */ r("td", { colSpan: p.length, className: "text-center", children: "Cargando más datos..." }) })
141
+ a
142
+ )) }),
143
+ p && e.estadoRegistro === "en_gestion" && !g.some((t) => t.estadoRegistro === "en_gestion" && g.indexOf(t) > o) && /* @__PURE__ */ r("tr", { children: /* @__PURE__ */ r("td", { colSpan: f.length, className: "text-center", style: { padding: "0 0 0 0" }, children: /* @__PURE__ */ r("div", { style: {
144
+ height: "2rem",
145
+ display: "flex",
146
+ flexDirection: "row",
147
+ justifyContent: "center",
148
+ alignItems: "center",
149
+ fontWeight: "600",
150
+ color: o % 2 === 0 ? "#365072" : "#303D50",
151
+ backgroundColor: o % 2 === 0 ? "#fefefe" : "#f9fafa"
152
+ }, children: /* @__PURE__ */ r(j, { style: { fontSize: "1.3rem" } }) }) }) })
153
+ ] }, o);
154
+ }),
155
+ h && /* @__PURE__ */ r("tr", { children: /* @__PURE__ */ r("td", { colSpan: f.length, className: "text-center", children: "Cargando más datos..." }) })
153
156
  ] })
154
157
  ] }) }) });
155
158
  };
156
159
  export {
157
- L as Tabla
160
+ P as Tabla
158
161
  };
@@ -0,0 +1,31 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { AuthProvider as t } from "../../auth/contexts/AuthContex.js";
3
+ import "react";
4
+ import "react-router-dom";
5
+ import "../../index-CuHybtft.js";
6
+ import '../../assets/EcoModalStyles.css';import '../../assets/Modal.css';import '../../assets/ContenedorVentana.css';import '../../assets/IconoTooltip.css';import '../../assets/ItemsModal.css';import '../../assets/Paginador.css';import '../../assets/ContenidoModal.css';import '../../assets/Encabezado.css';import '../../assets/SeccionTarjetaLectura.css';import '../../assets/Logo.css';import '../../assets/TarjetaLectura.css';import '../../assets/ContenedorTarjeta.css';import '../../assets/Bootstrap.css';import '../../assets/Tarjeta.css';import '../../assets/UnpHistorico.css';/* empty css */
7
+ /* empty css */
8
+ /* empty css */
9
+ import "../../cards/tarjeta/seccion-tarjeta/SeccionTarjeta.js";
10
+ /* empty css */
11
+ /* empty css */
12
+ /* empty css */
13
+ /* empty css */
14
+ /* empty css */
15
+ /* empty css */
16
+ import "../../ui/subtitulo/Subtitulo.js";
17
+ /* empty css */
18
+ /* empty css */
19
+ /* empty css */
20
+ /* empty css */
21
+ /* empty css */
22
+ /* empty css */
23
+ import "../../index-BrykDZgK.js";
24
+ /* empty css */
25
+ import "../../Animacion-ThNL9iiY.js";
26
+ import "../../index-BUe3EJDH.js";
27
+ import { WebSocketProvider as i } from "../websocket-manager/WebSocketContext.js";
28
+ const B = ({ children: o }) => /* @__PURE__ */ r(t, { children: /* @__PURE__ */ r(i, { children: o }) });
29
+ export {
30
+ B as EcoProvider
31
+ };
package/dist/utils.js CHANGED
@@ -1,22 +1,24 @@
1
- import { AuthProvider as r } from "./auth/contexts/AuthContex.js";
2
- import { ProtectedRoute as m } from "./utils/components/ProtectedRoute.js";
3
- import { UserRoute as s } from "./utils/components/UserRoute.js";
4
- import { UnpHistorico as f } from "./utils/unp-historico/UnpHistorico.js";
5
- import { IsInvalidStyles as x, useFormValidation as a } from "./utils/validations/useFormValidation.js";
6
- import { CaptchaEcosistema as n } from "./utils/captcha/CaptchaEcosistema.js";
1
+ import { EcoProvider as r } from "./utils/eco-provider/EcoContext.js";
2
+ import { AuthProvider as m } from "./auth/contexts/AuthContex.js";
3
+ import { ProtectedRoute as c } from "./utils/components/ProtectedRoute.js";
4
+ import { UserRoute as i } from "./utils/components/UserRoute.js";
5
+ import { UnpHistorico as x } from "./utils/unp-historico/UnpHistorico.js";
6
+ import { IsInvalidStyles as u, useFormValidation as d } from "./utils/validations/useFormValidation.js";
7
+ import { CaptchaEcosistema as v } from "./utils/captcha/CaptchaEcosistema.js";
7
8
  import { useFetchData as S } from "./utils/fetch-data/useFetchData.js";
8
9
  import { WebSocketProvider as h, useWebSocketConnection as k } from "./utils/websocket-manager/WebSocketContext.js";
9
- import { useWebSocket as v } from "./utils/websocket-manager/useWebSocket.js";
10
+ import { useWebSocket as W } from "./utils/websocket-manager/useWebSocket.js";
10
11
  export {
11
- r as AuthProvider,
12
- n as CaptchaEcosistema,
13
- x as IsInvalidStyles,
14
- m as ProtectedRoute,
15
- f as UnpHistorico,
16
- s as UserRoute,
12
+ m as AuthProvider,
13
+ v as CaptchaEcosistema,
14
+ r as EcoProvider,
15
+ u as IsInvalidStyles,
16
+ c as ProtectedRoute,
17
+ x as UnpHistorico,
18
+ i as UserRoute,
17
19
  h as WebSocketProvider,
18
20
  S as useFetchData,
19
- a as useFormValidation,
20
- v as useWebSocket,
21
+ d as useFormValidation,
22
+ W as useWebSocket,
21
23
  k as useWebSocketConnection
22
24
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "react-ecosistema-unp",
3
3
  "author": "Ecosistema de Información - Unidad Nacional de Protección",
4
4
  "private": false,
5
- "version": "1.7.4",
5
+ "version": "1.7.7",
6
6
  "type": "module",
7
7
  "exports": {
8
8
  ".": {