bmi-next-brokers 2.6.0 → 2.6.1
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,157 +1,176 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as N, useRef as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import { Input as
|
|
5
|
-
import { s as
|
|
6
|
-
import { useBTC as
|
|
7
|
-
import { useDropdownPosition as
|
|
8
|
-
import '../../assets/index4.css';const
|
|
9
|
-
container:
|
|
10
|
-
inputs:
|
|
11
|
-
inputWrapper:
|
|
12
|
-
},
|
|
1
|
+
import { jsxs as O, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useState as N, useRef as w, useMemo as Y, useEffect as _ } from "react";
|
|
3
|
+
import { createPortal as Z } from "react-dom";
|
|
4
|
+
import { Input as z } from "../Input/Input.js";
|
|
5
|
+
import { s as e } from "../../Select.module-D_7bjq9u.js";
|
|
6
|
+
import { useBTC as I } from "../../hooks/btcContext/useBtcContext.js";
|
|
7
|
+
import { useDropdownPosition as R } from "../../hooks/useDropdownPosition.js";
|
|
8
|
+
import '../../assets/index4.css';const rr = "_container_1kajw_1", nr = "_inputs_1kajw_7", tr = "_inputWrapper_1kajw_13", $ = {
|
|
9
|
+
container: rr,
|
|
10
|
+
inputs: nr,
|
|
11
|
+
inputWrapper: tr
|
|
12
|
+
}, lr = ({
|
|
13
13
|
fields: u,
|
|
14
|
-
selectedItem:
|
|
15
|
-
options:
|
|
14
|
+
selectedItem: c = null,
|
|
15
|
+
options: a = [],
|
|
16
16
|
onSearch: d,
|
|
17
|
-
onSelect:
|
|
18
|
-
onReset:
|
|
19
|
-
noResultMessage:
|
|
20
|
-
disabled:
|
|
17
|
+
onSelect: S,
|
|
18
|
+
onReset: s,
|
|
19
|
+
noResultMessage: W = "No se encontraron resultados",
|
|
20
|
+
disabled: C = !1,
|
|
21
21
|
btc: F = !1,
|
|
22
|
-
size:
|
|
23
|
-
className:
|
|
22
|
+
size: m = "medium",
|
|
23
|
+
className: E,
|
|
24
24
|
containerClassName: L,
|
|
25
25
|
...P
|
|
26
26
|
}) => {
|
|
27
|
-
const { btc: T } =
|
|
27
|
+
const { btc: T } = I(), M = F ?? T, K = !!d, [x, g] = N(!1), [j, V] = N(
|
|
28
28
|
{}
|
|
29
|
-
), [o,
|
|
30
|
-
isOpen:
|
|
31
|
-
containerRef:
|
|
32
|
-
dropdownRef:
|
|
33
|
-
size:
|
|
34
|
-
optionsLength:
|
|
29
|
+
), [o, f] = N(null), h = w(null), v = w(null), b = w({}), D = w({}), q = x && !C, l = o ? j[o] ?? "" : "", A = R({
|
|
30
|
+
isOpen: x,
|
|
31
|
+
containerRef: h,
|
|
32
|
+
dropdownRef: v,
|
|
33
|
+
size: m,
|
|
34
|
+
optionsLength: a.length,
|
|
35
35
|
isSearchable: !0
|
|
36
|
-
}),
|
|
37
|
-
if (!o || !
|
|
38
|
-
const
|
|
39
|
-
if (!
|
|
40
|
-
const
|
|
41
|
-
return
|
|
42
|
-
(
|
|
36
|
+
}), Q = (r) => typeof r == "string" ? r.normalize("NFD").replace(/[̀-ͯ]/g, "").replace(/\s+/g, "").toLowerCase() : "", k = Y(() => {
|
|
37
|
+
if (!o || !l || K) return a;
|
|
38
|
+
const r = u.find((t) => t.key === o);
|
|
39
|
+
if (!r) return a;
|
|
40
|
+
const n = r.columnKey ?? r.key;
|
|
41
|
+
return a.filter(
|
|
42
|
+
(t) => Q(String(t[n] ?? "")).includes(Q(l))
|
|
43
43
|
);
|
|
44
|
-
}, [
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
|
|
44
|
+
}, [a, l, o, K]);
|
|
45
|
+
_(() => {
|
|
46
|
+
const r = (n) => {
|
|
47
|
+
h.current && !h.current.contains(n.target) && v.current && !v.current.contains(n.target) && (g(!1), f(null));
|
|
48
48
|
};
|
|
49
|
-
return document.addEventListener("mousedown",
|
|
50
|
-
}, []),
|
|
49
|
+
return document.addEventListener("mousedown", r), () => document.removeEventListener("mousedown", r);
|
|
50
|
+
}, []), _(() => {
|
|
51
51
|
if (!o) return;
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
(
|
|
55
|
-
const
|
|
56
|
-
return String(
|
|
52
|
+
const r = l.trim(), n = (b.current[o] ?? "").trim();
|
|
53
|
+
c && r.length > 0 && (k.some(
|
|
54
|
+
(p) => u.every((y) => {
|
|
55
|
+
const B = y.columnKey ?? y.key;
|
|
56
|
+
return String(p[B] ?? "") === String(c[B] ?? "");
|
|
57
57
|
})
|
|
58
|
-
) ||
|
|
58
|
+
) || s == null || s()), r === "" && n.length > 0 && c && (s == null || s()), b.current = {
|
|
59
59
|
...b.current,
|
|
60
|
-
[o]:
|
|
60
|
+
[o]: l
|
|
61
61
|
};
|
|
62
|
-
}, [
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
62
|
+
}, [l, o, c, k]), _(() => {
|
|
63
|
+
if (!c) return;
|
|
64
|
+
a.some(
|
|
65
|
+
(n) => u.every((t) => {
|
|
66
|
+
const p = t.columnKey ?? t.key;
|
|
67
|
+
return String(n[p] ?? "") === String(c[p] ?? "");
|
|
68
|
+
})
|
|
69
|
+
) || s == null || s();
|
|
70
|
+
}, [a]);
|
|
71
|
+
const G = (r, n) => {
|
|
72
|
+
V((t) => ({ ...t, [r]: n })), f(r), g(!0), d == null || d(r, n);
|
|
73
|
+
}, H = (r) => {
|
|
74
|
+
f(r), x || g(!0);
|
|
75
|
+
}, J = (r) => {
|
|
76
|
+
var n, t;
|
|
77
|
+
S == null || S(r), g(!1), f(null), o && ((t = (n = D.current[o]) == null ? void 0 : n.querySelector("input")) == null || t.blur());
|
|
78
|
+
}, U = (r) => c ? u.every((n) => {
|
|
79
|
+
const t = n.columnKey ?? n.key;
|
|
80
|
+
return String(r[t] ?? "") === String(c[t] ?? "");
|
|
81
|
+
}) : !1, X = (r) => {
|
|
82
|
+
if (o === r.key)
|
|
83
|
+
return j[r.key] ?? "";
|
|
84
|
+
if (c) {
|
|
85
|
+
const n = r.columnKey ?? r.key;
|
|
86
|
+
return String(c[n] ?? "");
|
|
78
87
|
}
|
|
79
88
|
return "";
|
|
80
89
|
};
|
|
81
|
-
return /* @__PURE__ */
|
|
90
|
+
return /* @__PURE__ */ O(
|
|
82
91
|
"div",
|
|
83
92
|
{
|
|
84
|
-
ref:
|
|
85
|
-
className: [
|
|
93
|
+
ref: h,
|
|
94
|
+
className: [$.container, L].filter(Boolean).join(" "),
|
|
86
95
|
children: [
|
|
87
|
-
/* @__PURE__ */
|
|
96
|
+
/* @__PURE__ */ i(
|
|
88
97
|
"div",
|
|
89
98
|
{
|
|
90
|
-
className: `${
|
|
99
|
+
className: `${$.inputs} ${E || ""}`,
|
|
91
100
|
...P,
|
|
92
|
-
children: u.map((
|
|
93
|
-
|
|
101
|
+
children: u.map((r) => /* @__PURE__ */ i(
|
|
102
|
+
"div",
|
|
94
103
|
{
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
className: $.inputWrapper,
|
|
105
|
+
ref: (n) => {
|
|
106
|
+
D.current[r.key] = n;
|
|
107
|
+
},
|
|
108
|
+
children: /* @__PURE__ */ i(
|
|
109
|
+
z,
|
|
110
|
+
{
|
|
111
|
+
label: r.label,
|
|
112
|
+
placeholder: r.placeholder,
|
|
113
|
+
value: X(r),
|
|
114
|
+
onChange: (n) => G(r.key, n.target.value),
|
|
115
|
+
onFocus: () => H(r.key),
|
|
116
|
+
icon: "SearchIcon",
|
|
117
|
+
size: m,
|
|
118
|
+
disabled: C,
|
|
119
|
+
btc: M
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
},
|
|
123
|
+
r.key
|
|
124
|
+
))
|
|
106
125
|
}
|
|
107
126
|
),
|
|
108
|
-
|
|
109
|
-
/* @__PURE__ */
|
|
127
|
+
q && Z(
|
|
128
|
+
/* @__PURE__ */ i(
|
|
110
129
|
"div",
|
|
111
130
|
{
|
|
112
|
-
ref:
|
|
131
|
+
ref: v,
|
|
113
132
|
className: [
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
133
|
+
e.dropdown,
|
|
134
|
+
e[m],
|
|
135
|
+
e.dropdownPortal,
|
|
136
|
+
e.dropdownTable
|
|
118
137
|
].join(" "),
|
|
119
138
|
style: A,
|
|
120
|
-
children:
|
|
139
|
+
children: k.length > 0 ? k.map((r, n) => /* @__PURE__ */ i(
|
|
121
140
|
"div",
|
|
122
141
|
{
|
|
123
|
-
className: `${
|
|
124
|
-
onMouseDown: (
|
|
125
|
-
|
|
142
|
+
className: `${e.option} ${e.optionTable} ${U(r) ? e.optionSelected : ""}`,
|
|
143
|
+
onMouseDown: (t) => {
|
|
144
|
+
t.preventDefault(), t.stopPropagation(), J(r);
|
|
126
145
|
},
|
|
127
146
|
style: { padding: 0, gap: 0 },
|
|
128
|
-
children: u.map(({ key:
|
|
147
|
+
children: u.map(({ key: t, columnKey: p, columnHeader: y }) => /* @__PURE__ */ O(
|
|
129
148
|
"div",
|
|
130
149
|
{
|
|
131
|
-
className:
|
|
150
|
+
className: e.tableColumn,
|
|
132
151
|
style: { padding: "8px 12px 8px 18px" },
|
|
133
152
|
children: [
|
|
134
|
-
|
|
153
|
+
y && /* @__PURE__ */ i(
|
|
135
154
|
"div",
|
|
136
155
|
{
|
|
137
|
-
className: `${
|
|
138
|
-
children:
|
|
156
|
+
className: `${e.columnHeader} ${e[m]}`,
|
|
157
|
+
children: y
|
|
139
158
|
}
|
|
140
159
|
),
|
|
141
|
-
/* @__PURE__ */
|
|
160
|
+
/* @__PURE__ */ i(
|
|
142
161
|
"div",
|
|
143
162
|
{
|
|
144
|
-
className: `${
|
|
145
|
-
children: String(
|
|
163
|
+
className: `${e.columnValue} ${e[m]}`,
|
|
164
|
+
children: String(r[p ?? t] ?? "")
|
|
146
165
|
}
|
|
147
166
|
)
|
|
148
167
|
]
|
|
149
168
|
},
|
|
150
|
-
|
|
169
|
+
t
|
|
151
170
|
))
|
|
152
171
|
},
|
|
153
|
-
|
|
154
|
-
)) : /* @__PURE__ */
|
|
172
|
+
n
|
|
173
|
+
)) : /* @__PURE__ */ i("span", { className: e.noResults, children: W })
|
|
155
174
|
}
|
|
156
175
|
),
|
|
157
176
|
document.getElementById("root") || document.body
|
|
@@ -161,5 +180,5 @@ import '../../assets/index4.css';const R = "_container_1kajw_1", nn = "_inputs_1
|
|
|
161
180
|
);
|
|
162
181
|
};
|
|
163
182
|
export {
|
|
164
|
-
|
|
183
|
+
lr as SearchableInputGroup
|
|
165
184
|
};
|
package/package.json
CHANGED