@addsign/moje-agenda-shared-lib 0.0.19 → 0.0.20
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.
|
@@ -20,16 +20,16 @@ var le = ["mousedown", "touchstart"], se = function(e, t, r) {
|
|
|
20
20
|
p(function() {
|
|
21
21
|
d.current = t;
|
|
22
22
|
}, [t]), p(function() {
|
|
23
|
-
for (var o = function(
|
|
23
|
+
for (var o = function(i) {
|
|
24
24
|
var c = e.current;
|
|
25
|
-
c && !c.contains(
|
|
25
|
+
c && !c.contains(i.target) && d.current(i);
|
|
26
26
|
}, a = 0, u = r; a < u.length; a++) {
|
|
27
27
|
var h = u[a];
|
|
28
28
|
re(document, h, o);
|
|
29
29
|
}
|
|
30
30
|
return function() {
|
|
31
|
-
for (var
|
|
32
|
-
var k = c[
|
|
31
|
+
for (var i = 0, c = r; i < c.length; i++) {
|
|
32
|
+
var k = c[i];
|
|
33
33
|
ae(document, k, o);
|
|
34
34
|
}
|
|
35
35
|
};
|
|
@@ -44,79 +44,79 @@ const me = ({
|
|
|
44
44
|
fetchUrl: a,
|
|
45
45
|
valueKey: u,
|
|
46
46
|
labelKey: h,
|
|
47
|
-
onChange:
|
|
47
|
+
onChange: i,
|
|
48
48
|
onFocus: c,
|
|
49
49
|
onBlur: k,
|
|
50
|
-
placeholder:
|
|
51
|
-
serverSearch:
|
|
50
|
+
placeholder: j,
|
|
51
|
+
serverSearch: w = !1,
|
|
52
52
|
value: L,
|
|
53
53
|
initOptions: R,
|
|
54
|
-
showId:
|
|
54
|
+
showId: E
|
|
55
55
|
}) => {
|
|
56
|
-
var
|
|
57
|
-
const [
|
|
56
|
+
var V, W;
|
|
57
|
+
const [M, C] = m(""), [J, O] = m(!1), [x, A] = m([]), [Q, b] = m(-1), [P, S] = m(
|
|
58
58
|
null
|
|
59
|
-
), [g, y] = m([]), X = F(null),
|
|
59
|
+
), [g, y] = m([]), X = F(null), q = F(null), D = te(), [B, z] = m(!1), [H] = m({});
|
|
60
60
|
p(() => {
|
|
61
61
|
a && (async () => {
|
|
62
|
-
|
|
62
|
+
O(!0), console.log(
|
|
63
63
|
"%csrcsharedAutocompleteSearchBar.tsx:77 fetchUrl, value",
|
|
64
64
|
"color: #007acc;",
|
|
65
65
|
a
|
|
66
66
|
);
|
|
67
|
-
const { data: s } = await
|
|
67
|
+
const { data: s } = await D.apiClient.get(a || ""), f = s.content || s;
|
|
68
68
|
A(
|
|
69
|
-
|
|
70
|
-
value:
|
|
71
|
-
label:
|
|
69
|
+
f.map((v) => ({
|
|
70
|
+
value: v[u],
|
|
71
|
+
label: v[h] + (E ? " (" + v[u] + ")" : "")
|
|
72
72
|
}))
|
|
73
|
-
),
|
|
73
|
+
), O(!1);
|
|
74
74
|
})();
|
|
75
|
-
}, [a
|
|
75
|
+
}, [a]), p(() => {
|
|
76
76
|
R && A(R);
|
|
77
77
|
}, [R]), p(() => {
|
|
78
78
|
if (L && x) {
|
|
79
79
|
const l = x.find((s) => s.value == L);
|
|
80
|
-
l && (
|
|
80
|
+
l && (C(l.label), S(l));
|
|
81
81
|
}
|
|
82
82
|
}, [L, x]), p(() => {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const { data: s } = await
|
|
83
|
+
w && (async () => {
|
|
84
|
+
O(!0);
|
|
85
|
+
const { data: s } = await D.apiClient.get(a + M);
|
|
86
86
|
A(
|
|
87
|
-
s.map((
|
|
88
|
-
value:
|
|
89
|
-
label:
|
|
87
|
+
s.map((f) => ({
|
|
88
|
+
value: f[u],
|
|
89
|
+
label: f[h] + (E ? " (" + f[u] + ")" : "")
|
|
90
90
|
}))
|
|
91
91
|
), y(
|
|
92
|
-
s.map((
|
|
93
|
-
value:
|
|
94
|
-
label:
|
|
92
|
+
s.map((f) => ({
|
|
93
|
+
value: f[u],
|
|
94
|
+
label: f[h] + (E ? " (" + f[u] + ")" : "")
|
|
95
95
|
}))
|
|
96
|
-
),
|
|
96
|
+
), O(!1);
|
|
97
97
|
})();
|
|
98
98
|
}, [
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
M,
|
|
100
|
+
w,
|
|
101
101
|
u,
|
|
102
102
|
h,
|
|
103
103
|
a,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
]), se(
|
|
107
|
-
y([]), P || (
|
|
104
|
+
D.apiClient,
|
|
105
|
+
E
|
|
106
|
+
]), se(q, () => {
|
|
107
|
+
y([]), P || (C(""), i(null)), $();
|
|
108
108
|
});
|
|
109
109
|
const Y = (l) => {
|
|
110
|
-
|
|
110
|
+
C(l.target.value), S(null), b(-1), y(
|
|
111
111
|
x.filter(
|
|
112
112
|
(s) => {
|
|
113
|
-
var
|
|
114
|
-
return (G = s == null ? void 0 : s.label) == null ? void 0 : G.toLowerCase().includes((
|
|
113
|
+
var f, v, G;
|
|
114
|
+
return (G = s == null ? void 0 : s.label) == null ? void 0 : G.toLowerCase().includes((v = (f = l.target) == null ? void 0 : f.value) == null ? void 0 : v.toLowerCase());
|
|
115
115
|
}
|
|
116
116
|
)
|
|
117
117
|
);
|
|
118
118
|
}, Z = () => {
|
|
119
|
-
console.log("handleFocus query",
|
|
119
|
+
console.log("handleFocus query", M), z(!0), c(), y(
|
|
120
120
|
x
|
|
121
121
|
/*.filter((option) =>
|
|
122
122
|
option.label.toLowerCase().includes(query.toLowerCase()),
|
|
@@ -126,7 +126,7 @@ const me = ({
|
|
|
126
126
|
console.log(
|
|
127
127
|
"%csrcsharedAutocompleteSearchBar.tsx:95 handleClearQuery",
|
|
128
128
|
"color: #007acc;"
|
|
129
|
-
),
|
|
129
|
+
), C(""), i(null), S(null), setTimeout(() => {
|
|
130
130
|
b(-1), y(x);
|
|
131
131
|
}, 1e3);
|
|
132
132
|
}, I = (l) => {
|
|
@@ -134,18 +134,18 @@ const me = ({
|
|
|
134
134
|
(s) => s > 0 ? s - 1 : g.length - 1
|
|
135
135
|
) : l.key === "ArrowDown" && g.length > 0 ? b(
|
|
136
136
|
(s) => s < g.length - 1 ? s + 1 : 0
|
|
137
|
-
) : l.key === "Enter" &&
|
|
138
|
-
},
|
|
139
|
-
|
|
137
|
+
) : l.key === "Enter" && Q !== -1 ? T(g[Q]) : l.key === "Escape" && Q !== -1 && $();
|
|
138
|
+
}, T = (l) => {
|
|
139
|
+
C(l.label), S(l), b(-1), i(l.value), $();
|
|
140
140
|
}, $ = () => {
|
|
141
|
-
y([]), k(),
|
|
141
|
+
y([]), k(), z(!1);
|
|
142
142
|
};
|
|
143
143
|
return /* @__PURE__ */ N("div", { className: "w-full min-h-20 flex-col justify-start items-start gap-1.5 inline-flex", children: [
|
|
144
144
|
/* @__PURE__ */ N(
|
|
145
145
|
"div",
|
|
146
146
|
{
|
|
147
147
|
className: "self-stretch min-h-14 flex-col justify-start items-start gap-1.5 flex relative",
|
|
148
|
-
ref:
|
|
148
|
+
ref: q,
|
|
149
149
|
children: [
|
|
150
150
|
/* @__PURE__ */ N(
|
|
151
151
|
"label",
|
|
@@ -164,19 +164,19 @@ const me = ({
|
|
|
164
164
|
{
|
|
165
165
|
className: `self-stretch px-3 py-1.5 rounded-lg justify-start items-center gap-2 inline-flex outline-none border
|
|
166
166
|
${B ? "outline-4 outline-indigo-200 outline-offset-0 border-indigo-300" : ""}
|
|
167
|
-
${B && ((
|
|
168
|
-
${!B && ((
|
|
167
|
+
${B && ((V = H[t]) != null && V.message) ? "outline-4 outline-red-200 outline-offset-0 border-none" : ""}
|
|
168
|
+
${!B && ((W = H[t]) != null && W.message) ? "border-red-200" : ""}
|
|
169
169
|
${d ? "bg-gray-100" : "bg-transparent"}`,
|
|
170
170
|
children: /* @__PURE__ */ n("div", { className: "Content grow shrink basis-0 min-h-5 xl:min-h-8 justify-start items-start gap-2 flex relative flex-col w-full mx-auto", children: /* @__PURE__ */ n(
|
|
171
171
|
oe,
|
|
172
172
|
{
|
|
173
|
-
value:
|
|
173
|
+
value: M,
|
|
174
174
|
onChange: Y,
|
|
175
175
|
onKeyDown: I,
|
|
176
176
|
onFocus: Z,
|
|
177
177
|
clearQuery: U,
|
|
178
178
|
inputRef: X,
|
|
179
|
-
placeholder:
|
|
179
|
+
placeholder: j,
|
|
180
180
|
isFocused: B,
|
|
181
181
|
onBlur: $,
|
|
182
182
|
isLoading: J
|
|
@@ -188,8 +188,8 @@ const me = ({
|
|
|
188
188
|
ne,
|
|
189
189
|
{
|
|
190
190
|
options: g,
|
|
191
|
-
selectedOptionIndex:
|
|
192
|
-
handleOptionClick:
|
|
191
|
+
selectedOptionIndex: Q,
|
|
192
|
+
handleOptionClick: T
|
|
193
193
|
}
|
|
194
194
|
)
|
|
195
195
|
]
|
|
@@ -217,7 +217,7 @@ const me = ({
|
|
|
217
217
|
{
|
|
218
218
|
ref: d,
|
|
219
219
|
className: "overflow-y-auto resultOptionContainer w-full max-h-96 absolute outline-4 bg-white border border-gray-200 drop-shadow-xl rounded-xl z-50 top-[73px]",
|
|
220
|
-
children: e.map((o, a) => /* @__PURE__ */ n(
|
|
220
|
+
children: e == null ? void 0 : e.map((o, a) => /* @__PURE__ */ n(
|
|
221
221
|
"div",
|
|
222
222
|
{
|
|
223
223
|
className: `py-2 px-4 flex items-center justify-between gap-8 hover:bg-gray-200 cursor-pointer ${t === a ? "bg-gray-200" : ""}`,
|
|
@@ -237,7 +237,7 @@ const me = ({
|
|
|
237
237
|
inputRef: a,
|
|
238
238
|
placeholder: u,
|
|
239
239
|
clearQuery: h,
|
|
240
|
-
isFocused:
|
|
240
|
+
isFocused: i,
|
|
241
241
|
isLoading: c
|
|
242
242
|
}) => /* @__PURE__ */ N("div", { className: "relative flex items-center w-full sharedResource", children: [
|
|
243
243
|
/* @__PURE__ */ n(
|
|
@@ -284,20 +284,20 @@ const me = ({
|
|
|
284
284
|
]
|
|
285
285
|
}
|
|
286
286
|
) }),
|
|
287
|
-
|
|
287
|
+
i && !c && /* @__PURE__ */ n(
|
|
288
288
|
K,
|
|
289
289
|
{
|
|
290
290
|
className: "material-icons absolute right-0 cursor-pointer text-gray-500",
|
|
291
291
|
onClick: o
|
|
292
292
|
}
|
|
293
293
|
),
|
|
294
|
-
!
|
|
294
|
+
!i && !c && /* @__PURE__ */ n(
|
|
295
295
|
_,
|
|
296
296
|
{
|
|
297
297
|
className: "material-icons absolute right-0 cursor-pointer text-gray-500",
|
|
298
298
|
onClick: () => {
|
|
299
|
-
var
|
|
300
|
-
(
|
|
299
|
+
var w;
|
|
300
|
+
(w = a.current) == null || w.focus(), d();
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
303
|
),
|