rich-react-component 0.1.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.
- package/LICENSE +21 -0
- package/README.md +118 -0
- package/dist/base/Accordion.d.ts +17 -0
- package/dist/base/Alert.d.ts +15 -0
- package/dist/base/AutoComplete.d.ts +20 -0
- package/dist/base/Avatar.d.ts +8 -0
- package/dist/base/Badge.d.ts +9 -0
- package/dist/base/Breadcrumb.d.ts +10 -0
- package/dist/base/Button.d.ts +13 -0
- package/dist/base/Card.d.ts +9 -0
- package/dist/base/CheckBox.d.ts +17 -0
- package/dist/base/Col.d.ts +12 -0
- package/dist/base/ComboBox.d.ts +17 -0
- package/dist/base/Confirm.d.ts +25 -0
- package/dist/base/Container.d.ts +7 -0
- package/dist/base/DataGrid.d.ts +43 -0
- package/dist/base/DatePicker.d.ts +23 -0
- package/dist/base/DateTimePicker.d.ts +17 -0
- package/dist/base/Divider.d.ts +8 -0
- package/dist/base/FileInput.d.ts +19 -0
- package/dist/base/FormField.d.ts +12 -0
- package/dist/base/Icon.d.ts +15 -0
- package/dist/base/Input.d.ts +30 -0
- package/dist/base/Menu.d.ts +21 -0
- package/dist/base/Modal.d.ts +19 -0
- package/dist/base/MultiSelect.d.ts +25 -0
- package/dist/base/Navbar.d.ts +16 -0
- package/dist/base/NumberInput.d.ts +17 -0
- package/dist/base/PageHeader.d.ts +12 -0
- package/dist/base/Pagination.d.ts +15 -0
- package/dist/base/PasswordInput.d.ts +10 -0
- package/dist/base/Popover.d.ts +10 -0
- package/dist/base/ProgressBar.d.ts +10 -0
- package/dist/base/RadioButton.d.ts +18 -0
- package/dist/base/RadioGroup.d.ts +14 -0
- package/dist/base/Rating.d.ts +9 -0
- package/dist/base/Row.d.ts +6 -0
- package/dist/base/Select.d.ts +24 -0
- package/dist/base/Sidebar.d.ts +31 -0
- package/dist/base/Skeleton.d.ts +8 -0
- package/dist/base/Slider.d.ts +10 -0
- package/dist/base/Spinner.d.ts +7 -0
- package/dist/base/Stack.d.ts +12 -0
- package/dist/base/Stepper.d.ts +12 -0
- package/dist/base/Switch.d.ts +16 -0
- package/dist/base/Tabs.d.ts +16 -0
- package/dist/base/Tag.d.ts +14 -0
- package/dist/base/TextArea.d.ts +11 -0
- package/dist/base/TimePicker.d.ts +20 -0
- package/dist/base/Toast.d.ts +27 -0
- package/dist/base/Tooltip.d.ts +21 -0
- package/dist/base/index.d.ts +56 -0
- package/dist/base/shared/BooleanFieldControl.d.ts +22 -0
- package/dist/base/shared/FieldShell.d.ts +22 -0
- package/dist/base/shared/Label.d.ts +9 -0
- package/dist/base/shared/Popup.d.ts +25 -0
- package/dist/base/shared/ValidationMessage.d.ts +11 -0
- package/dist/base/shared/classNames.d.ts +1 -0
- package/dist/base/shared/fieldTypes.d.ts +26 -0
- package/dist/base/shared/index.d.ts +9 -0
- package/dist/base/shared/useControllableState.d.ts +16 -0
- package/dist/base/shared/useEscapeKey.d.ts +2 -0
- package/dist/base/shared/useListNavigation.d.ts +18 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +2092 -0
- package/dist/index.js.map +1 -0
- package/dist/remote/RemoteAutoComplete.d.ts +22 -0
- package/dist/remote/RemoteComboBox.d.ts +21 -0
- package/dist/remote/RemoteDataGrid.d.ts +24 -0
- package/dist/remote/RemoteMultiSelect.d.ts +13 -0
- package/dist/remote/RemoteSelect.d.ts +17 -0
- package/dist/remote/hooks/useDebouncedValue.d.ts +1 -0
- package/dist/remote/hooks/useRemoteData.d.ts +31 -0
- package/dist/remote/http/HttpClient.d.ts +31 -0
- package/dist/remote/index.d.ts +9 -0
- package/dist/remote/mapping.d.ts +8 -0
- package/dist/smart/SmartAction.d.ts +14 -0
- package/dist/smart/SmartActions.d.ts +14 -0
- package/dist/smart/SmartField.d.ts +18 -0
- package/dist/smart/SmartForm.d.ts +19 -0
- package/dist/smart/actionRegistry.d.ts +11 -0
- package/dist/smart/componentRegistry.d.ts +24 -0
- package/dist/smart/dataSourceRegistry.d.ts +17 -0
- package/dist/smart/index.d.ts +26 -0
- package/dist/smart/resolvers/comboBoxResolver.d.ts +10 -0
- package/dist/smart/resolvers/dataGridResolver.d.ts +11 -0
- package/dist/smart/resolvers/datePickerResolver.d.ts +3 -0
- package/dist/smart/resolvers/index.d.ts +13 -0
- package/dist/smart/resolvers/inputResolver.d.ts +8 -0
- package/dist/smart/runtime.d.ts +26 -0
- package/dist/smart/types.d.ts +114 -0
- package/dist/smart/useSmartAction.d.ts +36 -0
- package/dist/smart/useSmartDependencies.d.ts +13 -0
- package/dist/smart/useSmartField.d.ts +47 -0
- package/package.json +68 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,2092 @@
|
|
|
1
|
+
import { jsxs as p, jsx as a, Fragment as X } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as M, useState as T, useCallback as R, useId as P, useEffect as B, createContext as ce, useMemo as W, useContext as de } from "react";
|
|
3
|
+
function f(...e) {
|
|
4
|
+
return e.filter(Boolean).join(" ");
|
|
5
|
+
}
|
|
6
|
+
function ke({ htmlFor: e, required: n, className: t, children: r }) {
|
|
7
|
+
return /* @__PURE__ */ p("label", { htmlFor: e, className: f("form-label", t), children: [
|
|
8
|
+
r,
|
|
9
|
+
n && /* @__PURE__ */ a("span", { className: "text-danger", children: " *" })
|
|
10
|
+
] });
|
|
11
|
+
}
|
|
12
|
+
function ue({ error: e, helpText: n, className: t }) {
|
|
13
|
+
return e ? /* @__PURE__ */ a("div", { className: f("invalid-feedback d-block", t), children: e }) : n ? /* @__PURE__ */ a("div", { className: f("form-text", t), children: n }) : null;
|
|
14
|
+
}
|
|
15
|
+
function K({ id: e, label: n, required: t, error: r, helpText: l, className: s, children: c }) {
|
|
16
|
+
return /* @__PURE__ */ p("div", { className: f("mb-3", s), children: [
|
|
17
|
+
n && /* @__PURE__ */ a(ke, { htmlFor: e, required: t, children: n }),
|
|
18
|
+
c,
|
|
19
|
+
/* @__PURE__ */ a(ue, { error: r, helpText: l })
|
|
20
|
+
] });
|
|
21
|
+
}
|
|
22
|
+
function V({
|
|
23
|
+
value: e,
|
|
24
|
+
defaultValue: n,
|
|
25
|
+
onChange: t
|
|
26
|
+
}) {
|
|
27
|
+
const r = e !== void 0, l = M(r);
|
|
28
|
+
process.env.NODE_ENV !== "production" && l.current !== r && console.error(
|
|
29
|
+
"[react-components] A component switched between controlled and uncontrolled `value`. Decide between passing `value` (controlled) or `defaultValue` (uncontrolled) for the lifetime of the component, per the library's controlled/uncontrolled policy."
|
|
30
|
+
);
|
|
31
|
+
const [s, c] = T(n), o = r ? e : s, i = R(
|
|
32
|
+
(d) => {
|
|
33
|
+
r || c(d), t == null || t(d);
|
|
34
|
+
},
|
|
35
|
+
[r, t]
|
|
36
|
+
);
|
|
37
|
+
return [o, i];
|
|
38
|
+
}
|
|
39
|
+
function Y(e) {
|
|
40
|
+
const {
|
|
41
|
+
id: n,
|
|
42
|
+
name: t,
|
|
43
|
+
disabled: r,
|
|
44
|
+
readOnly: l,
|
|
45
|
+
required: s,
|
|
46
|
+
className: c,
|
|
47
|
+
label: o,
|
|
48
|
+
placeholder: i,
|
|
49
|
+
helpText: d,
|
|
50
|
+
error: u,
|
|
51
|
+
value: h,
|
|
52
|
+
defaultValue: m,
|
|
53
|
+
onChange: b,
|
|
54
|
+
onBlur: v,
|
|
55
|
+
type: x = "text",
|
|
56
|
+
maxLength: N,
|
|
57
|
+
autoFocus: g,
|
|
58
|
+
inputProps: w,
|
|
59
|
+
endAdornment: y
|
|
60
|
+
} = e, [S, k] = V({
|
|
61
|
+
value: h,
|
|
62
|
+
defaultValue: m ?? "",
|
|
63
|
+
onChange: b
|
|
64
|
+
}), C = P(), D = n ?? C, $ = /* @__PURE__ */ a(
|
|
65
|
+
"input",
|
|
66
|
+
{
|
|
67
|
+
id: D,
|
|
68
|
+
name: t,
|
|
69
|
+
className: f("form-control", u && "is-invalid"),
|
|
70
|
+
disabled: r,
|
|
71
|
+
readOnly: l,
|
|
72
|
+
required: s,
|
|
73
|
+
placeholder: i,
|
|
74
|
+
maxLength: N,
|
|
75
|
+
autoFocus: g,
|
|
76
|
+
value: S,
|
|
77
|
+
onChange: (L) => k(L.target.value),
|
|
78
|
+
onBlur: v,
|
|
79
|
+
type: x,
|
|
80
|
+
...w
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
return /* @__PURE__ */ a(K, { id: D, label: o, required: s, error: u, helpText: d, className: c, children: y ? /* @__PURE__ */ p("div", { className: "input-group", children: [
|
|
84
|
+
$,
|
|
85
|
+
y
|
|
86
|
+
] }) : $ });
|
|
87
|
+
}
|
|
88
|
+
function bn(e) {
|
|
89
|
+
const {
|
|
90
|
+
id: n,
|
|
91
|
+
name: t,
|
|
92
|
+
disabled: r,
|
|
93
|
+
readOnly: l,
|
|
94
|
+
required: s,
|
|
95
|
+
className: c,
|
|
96
|
+
label: o,
|
|
97
|
+
placeholder: i,
|
|
98
|
+
helpText: d,
|
|
99
|
+
error: u,
|
|
100
|
+
value: h,
|
|
101
|
+
defaultValue: m,
|
|
102
|
+
onChange: b,
|
|
103
|
+
onBlur: v,
|
|
104
|
+
rows: x = 3,
|
|
105
|
+
maxLength: N
|
|
106
|
+
} = e, [g, w] = V({
|
|
107
|
+
value: h,
|
|
108
|
+
defaultValue: m ?? "",
|
|
109
|
+
onChange: b
|
|
110
|
+
}), y = P(), S = n ?? y;
|
|
111
|
+
return /* @__PURE__ */ a(K, { id: S, label: o, required: s, error: u, helpText: d, className: c, children: /* @__PURE__ */ a(
|
|
112
|
+
"textarea",
|
|
113
|
+
{
|
|
114
|
+
id: S,
|
|
115
|
+
name: t,
|
|
116
|
+
className: f("form-control", u && "is-invalid"),
|
|
117
|
+
disabled: r,
|
|
118
|
+
readOnly: l,
|
|
119
|
+
required: s,
|
|
120
|
+
placeholder: i,
|
|
121
|
+
rows: x,
|
|
122
|
+
maxLength: N,
|
|
123
|
+
value: g,
|
|
124
|
+
onChange: (k) => w(k.target.value),
|
|
125
|
+
onBlur: v
|
|
126
|
+
}
|
|
127
|
+
) });
|
|
128
|
+
}
|
|
129
|
+
function vn({ value: e, defaultValue: n, onChange: t, min: r, max: l, step: s, ...c }) {
|
|
130
|
+
const [o, i] = V({
|
|
131
|
+
value: e,
|
|
132
|
+
defaultValue: n ?? null,
|
|
133
|
+
onChange: t
|
|
134
|
+
});
|
|
135
|
+
return /* @__PURE__ */ a(
|
|
136
|
+
Y,
|
|
137
|
+
{
|
|
138
|
+
...c,
|
|
139
|
+
value: o === null ? "" : String(o),
|
|
140
|
+
onChange: (d) => {
|
|
141
|
+
if (d.trim() === "") {
|
|
142
|
+
i(null);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
const u = Number(d);
|
|
146
|
+
Number.isNaN(u) || i(u);
|
|
147
|
+
},
|
|
148
|
+
inputProps: { inputMode: "decimal", min: r, max: l, step: s }
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
function pn(e) {
|
|
153
|
+
const [n, t] = T(!1);
|
|
154
|
+
return /* @__PURE__ */ a(
|
|
155
|
+
Y,
|
|
156
|
+
{
|
|
157
|
+
...e,
|
|
158
|
+
inputProps: { type: n ? "text" : "password", autoComplete: "current-password" },
|
|
159
|
+
endAdornment: /* @__PURE__ */ a(
|
|
160
|
+
"button",
|
|
161
|
+
{
|
|
162
|
+
type: "button",
|
|
163
|
+
className: "btn btn-outline-secondary",
|
|
164
|
+
"aria-label": n ? "Hide password" : "Show password",
|
|
165
|
+
"aria-pressed": n,
|
|
166
|
+
onClick: () => t((r) => !r),
|
|
167
|
+
children: n ? "Hide" : "Show"
|
|
168
|
+
}
|
|
169
|
+
)
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
function gn({ id: e, name: n, disabled: t, required: r, className: l, label: s, helpText: c, error: o, accept: i, multiple: d, onChange: u }) {
|
|
174
|
+
const h = P(), m = e ?? h;
|
|
175
|
+
return /* @__PURE__ */ a(K, { id: m, label: s, required: r, error: o, helpText: c, className: l, children: /* @__PURE__ */ a(
|
|
176
|
+
"input",
|
|
177
|
+
{
|
|
178
|
+
id: m,
|
|
179
|
+
name: n,
|
|
180
|
+
type: "file",
|
|
181
|
+
className: f("form-control", o && "is-invalid"),
|
|
182
|
+
disabled: t,
|
|
183
|
+
required: r,
|
|
184
|
+
accept: i,
|
|
185
|
+
multiple: d,
|
|
186
|
+
onChange: (b) => u == null ? void 0 : u(b.target.files)
|
|
187
|
+
}
|
|
188
|
+
) });
|
|
189
|
+
}
|
|
190
|
+
function fe({
|
|
191
|
+
id: e,
|
|
192
|
+
name: n,
|
|
193
|
+
disabled: t,
|
|
194
|
+
required: r,
|
|
195
|
+
wrapperClassName: l,
|
|
196
|
+
role: s,
|
|
197
|
+
label: c,
|
|
198
|
+
helpText: o,
|
|
199
|
+
error: i,
|
|
200
|
+
checked: d,
|
|
201
|
+
onChange: u,
|
|
202
|
+
className: h
|
|
203
|
+
}) {
|
|
204
|
+
const m = P(), b = e ?? m;
|
|
205
|
+
return /* @__PURE__ */ p("div", { className: f(l, h), children: [
|
|
206
|
+
/* @__PURE__ */ a(
|
|
207
|
+
"input",
|
|
208
|
+
{
|
|
209
|
+
id: b,
|
|
210
|
+
name: n,
|
|
211
|
+
type: "checkbox",
|
|
212
|
+
role: s,
|
|
213
|
+
className: f("form-check-input", i && "is-invalid"),
|
|
214
|
+
disabled: t,
|
|
215
|
+
required: r,
|
|
216
|
+
checked: d,
|
|
217
|
+
onChange: (v) => u(v.target.checked)
|
|
218
|
+
}
|
|
219
|
+
),
|
|
220
|
+
c && /* @__PURE__ */ a("label", { htmlFor: b, className: "form-check-label", children: c }),
|
|
221
|
+
/* @__PURE__ */ a(ue, { error: i, helpText: o })
|
|
222
|
+
] });
|
|
223
|
+
}
|
|
224
|
+
function yn(e) {
|
|
225
|
+
const [n, t] = V({
|
|
226
|
+
value: e.checked,
|
|
227
|
+
defaultValue: e.defaultChecked ?? !1,
|
|
228
|
+
onChange: e.onChange
|
|
229
|
+
});
|
|
230
|
+
return /* @__PURE__ */ a(
|
|
231
|
+
fe,
|
|
232
|
+
{
|
|
233
|
+
id: e.id,
|
|
234
|
+
name: e.name,
|
|
235
|
+
disabled: e.disabled,
|
|
236
|
+
required: e.required,
|
|
237
|
+
className: e.className,
|
|
238
|
+
wrapperClassName: "form-check mb-3",
|
|
239
|
+
label: e.label,
|
|
240
|
+
helpText: e.helpText,
|
|
241
|
+
error: e.error,
|
|
242
|
+
checked: n,
|
|
243
|
+
onChange: t
|
|
244
|
+
}
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
function Nn(e) {
|
|
248
|
+
const [n, t] = V({
|
|
249
|
+
value: e.checked,
|
|
250
|
+
defaultValue: e.defaultChecked ?? !1,
|
|
251
|
+
onChange: e.onChange
|
|
252
|
+
});
|
|
253
|
+
return /* @__PURE__ */ a(
|
|
254
|
+
fe,
|
|
255
|
+
{
|
|
256
|
+
id: e.id,
|
|
257
|
+
name: e.name,
|
|
258
|
+
disabled: e.disabled,
|
|
259
|
+
required: e.required,
|
|
260
|
+
className: e.className,
|
|
261
|
+
wrapperClassName: "form-check form-switch mb-3",
|
|
262
|
+
role: "switch",
|
|
263
|
+
label: e.label,
|
|
264
|
+
helpText: e.helpText,
|
|
265
|
+
error: e.error,
|
|
266
|
+
checked: n,
|
|
267
|
+
onChange: t
|
|
268
|
+
}
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
function Se({
|
|
272
|
+
id: e,
|
|
273
|
+
name: n,
|
|
274
|
+
value: t,
|
|
275
|
+
label: r,
|
|
276
|
+
checked: l,
|
|
277
|
+
disabled: s,
|
|
278
|
+
className: c,
|
|
279
|
+
onChange: o
|
|
280
|
+
}) {
|
|
281
|
+
const i = P(), d = e ?? i;
|
|
282
|
+
return /* @__PURE__ */ p("div", { className: f("form-check", c), children: [
|
|
283
|
+
/* @__PURE__ */ a(
|
|
284
|
+
"input",
|
|
285
|
+
{
|
|
286
|
+
id: d,
|
|
287
|
+
name: n,
|
|
288
|
+
type: "radio",
|
|
289
|
+
className: "form-check-input",
|
|
290
|
+
value: String(t),
|
|
291
|
+
checked: l,
|
|
292
|
+
disabled: s,
|
|
293
|
+
onChange: () => o == null ? void 0 : o(t)
|
|
294
|
+
}
|
|
295
|
+
),
|
|
296
|
+
r && /* @__PURE__ */ a("label", { htmlFor: d, className: "form-check-label", children: r })
|
|
297
|
+
] });
|
|
298
|
+
}
|
|
299
|
+
function wn({
|
|
300
|
+
options: e,
|
|
301
|
+
value: n,
|
|
302
|
+
defaultValue: t,
|
|
303
|
+
onChange: r,
|
|
304
|
+
inline: l,
|
|
305
|
+
id: s,
|
|
306
|
+
name: c,
|
|
307
|
+
disabled: o,
|
|
308
|
+
required: i,
|
|
309
|
+
className: d,
|
|
310
|
+
label: u,
|
|
311
|
+
helpText: h,
|
|
312
|
+
error: m
|
|
313
|
+
}) {
|
|
314
|
+
const [b, v] = V({
|
|
315
|
+
value: n,
|
|
316
|
+
defaultValue: t ?? null,
|
|
317
|
+
onChange: (g) => {
|
|
318
|
+
g !== null && (r == null || r(g));
|
|
319
|
+
}
|
|
320
|
+
}), x = P(), N = c ?? s ?? x;
|
|
321
|
+
return /* @__PURE__ */ a(K, { label: u, required: i, error: m, helpText: h, className: d, children: /* @__PURE__ */ a("div", { role: "radiogroup", "aria-label": u, "aria-required": i, className: f(l && "d-flex gap-3"), children: e.map((g) => /* @__PURE__ */ a(
|
|
322
|
+
Se,
|
|
323
|
+
{
|
|
324
|
+
name: N,
|
|
325
|
+
value: g.value,
|
|
326
|
+
label: g.label,
|
|
327
|
+
checked: g.value === b,
|
|
328
|
+
disabled: o || g.disabled,
|
|
329
|
+
onChange: (w) => v(w)
|
|
330
|
+
},
|
|
331
|
+
String(g.value)
|
|
332
|
+
)) }) });
|
|
333
|
+
}
|
|
334
|
+
function Ce({
|
|
335
|
+
options: e,
|
|
336
|
+
value: n,
|
|
337
|
+
defaultValue: t,
|
|
338
|
+
onChange: r,
|
|
339
|
+
placeholder: l,
|
|
340
|
+
loading: s,
|
|
341
|
+
id: c,
|
|
342
|
+
name: o,
|
|
343
|
+
disabled: i,
|
|
344
|
+
readOnly: d,
|
|
345
|
+
required: u,
|
|
346
|
+
className: h,
|
|
347
|
+
label: m,
|
|
348
|
+
helpText: b,
|
|
349
|
+
error: v
|
|
350
|
+
}) {
|
|
351
|
+
const [x, N] = V({
|
|
352
|
+
value: n,
|
|
353
|
+
defaultValue: t ?? null,
|
|
354
|
+
onChange: r
|
|
355
|
+
}), g = P(), w = c ?? g;
|
|
356
|
+
return /* @__PURE__ */ a(K, { id: w, label: m, required: u, error: v, helpText: b, className: h, children: /* @__PURE__ */ p(
|
|
357
|
+
"select",
|
|
358
|
+
{
|
|
359
|
+
id: w,
|
|
360
|
+
name: o,
|
|
361
|
+
className: f("form-select", v && "is-invalid"),
|
|
362
|
+
disabled: i || d || s,
|
|
363
|
+
required: u,
|
|
364
|
+
value: x === null ? "" : String(x),
|
|
365
|
+
onChange: (y) => {
|
|
366
|
+
const S = y.target.value;
|
|
367
|
+
if (S === "") {
|
|
368
|
+
N(null);
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
const k = e.find((C) => String(C.value) === S);
|
|
372
|
+
N(k ? k.value : null);
|
|
373
|
+
},
|
|
374
|
+
children: [
|
|
375
|
+
s && /* @__PURE__ */ a("option", { value: "", children: "Loading…" }),
|
|
376
|
+
!s && l && /* @__PURE__ */ a("option", { value: "", children: l }),
|
|
377
|
+
e.map((y) => /* @__PURE__ */ a("option", { value: String(y.value), disabled: y.disabled, children: y.label }, String(y.value)))
|
|
378
|
+
]
|
|
379
|
+
}
|
|
380
|
+
) });
|
|
381
|
+
}
|
|
382
|
+
function le(e, n) {
|
|
383
|
+
B(() => {
|
|
384
|
+
if (!e)
|
|
385
|
+
return;
|
|
386
|
+
function t(r) {
|
|
387
|
+
r.key === "Escape" && n();
|
|
388
|
+
}
|
|
389
|
+
return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
|
|
390
|
+
}, [e, n]);
|
|
391
|
+
}
|
|
392
|
+
function G({ open: e, onClose: n, anchorRef: t, className: r, role: l, children: s }) {
|
|
393
|
+
const c = M(null);
|
|
394
|
+
return le(e, n), B(() => {
|
|
395
|
+
if (!e)
|
|
396
|
+
return;
|
|
397
|
+
function o(i) {
|
|
398
|
+
var u, h;
|
|
399
|
+
const d = i.target;
|
|
400
|
+
(u = c.current) != null && u.contains(d) || (h = t.current) != null && h.contains(d) || n();
|
|
401
|
+
}
|
|
402
|
+
return document.addEventListener("mousedown", o), () => document.removeEventListener("mousedown", o);
|
|
403
|
+
}, [e, n, t]), e ? /* @__PURE__ */ a("div", { ref: c, className: f("show", r), role: l, children: s }) : null;
|
|
404
|
+
}
|
|
405
|
+
function ee({
|
|
406
|
+
itemCount: e,
|
|
407
|
+
isOpen: n,
|
|
408
|
+
onSelect: t,
|
|
409
|
+
onClose: r
|
|
410
|
+
}) {
|
|
411
|
+
const [l, s] = T(-1);
|
|
412
|
+
B(() => {
|
|
413
|
+
n || s(-1);
|
|
414
|
+
}, [n]), le(n, r);
|
|
415
|
+
const c = R(
|
|
416
|
+
(o) => {
|
|
417
|
+
if (!n) {
|
|
418
|
+
(o.key === "ArrowDown" || o.key === "Enter") && o.preventDefault();
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
switch (o.key) {
|
|
422
|
+
case "ArrowDown":
|
|
423
|
+
o.preventDefault(), s((i) => e === 0 ? -1 : (i + 1) % e);
|
|
424
|
+
break;
|
|
425
|
+
case "ArrowUp":
|
|
426
|
+
o.preventDefault(), s((i) => e === 0 ? -1 : (i - 1 + e) % e);
|
|
427
|
+
break;
|
|
428
|
+
case "Home":
|
|
429
|
+
o.preventDefault(), s(e === 0 ? -1 : 0);
|
|
430
|
+
break;
|
|
431
|
+
case "End":
|
|
432
|
+
o.preventDefault(), s(e === 0 ? -1 : e - 1);
|
|
433
|
+
break;
|
|
434
|
+
case "Enter":
|
|
435
|
+
l >= 0 && (o.preventDefault(), t(l));
|
|
436
|
+
break;
|
|
437
|
+
}
|
|
438
|
+
},
|
|
439
|
+
[n, e, l, t]
|
|
440
|
+
);
|
|
441
|
+
return { activeIndex: l, setActiveIndex: s, handleKeyDown: c };
|
|
442
|
+
}
|
|
443
|
+
function Ie({
|
|
444
|
+
options: e,
|
|
445
|
+
values: n,
|
|
446
|
+
defaultValues: t,
|
|
447
|
+
onChange: r,
|
|
448
|
+
loading: l,
|
|
449
|
+
emptyText: s = "No options",
|
|
450
|
+
id: c,
|
|
451
|
+
name: o,
|
|
452
|
+
disabled: i,
|
|
453
|
+
readOnly: d,
|
|
454
|
+
required: u,
|
|
455
|
+
className: h,
|
|
456
|
+
label: m,
|
|
457
|
+
placeholder: b = "Select...",
|
|
458
|
+
helpText: v,
|
|
459
|
+
error: x
|
|
460
|
+
}) {
|
|
461
|
+
const [N, g] = V({
|
|
462
|
+
value: n,
|
|
463
|
+
defaultValue: t ?? [],
|
|
464
|
+
onChange: r
|
|
465
|
+
}), [w, y] = T(!1), S = M(null), k = P(), C = c ?? k, D = new Set(N), $ = R(() => y(!1), []), L = R(
|
|
466
|
+
(I) => {
|
|
467
|
+
const F = e[I];
|
|
468
|
+
if (!F || F.disabled)
|
|
469
|
+
return;
|
|
470
|
+
const J = D.has(F.value) ? N.filter((te) => te !== F.value) : [...N, F.value];
|
|
471
|
+
g(J);
|
|
472
|
+
},
|
|
473
|
+
[e, N, D, g]
|
|
474
|
+
), { activeIndex: q, setActiveIndex: _, handleKeyDown: U } = ee({
|
|
475
|
+
itemCount: e.length,
|
|
476
|
+
isOpen: w,
|
|
477
|
+
onSelect: L,
|
|
478
|
+
onClose: $
|
|
479
|
+
}), E = e.filter((I) => D.has(I.value)).map((I) => I.label).join(", ");
|
|
480
|
+
return /* @__PURE__ */ a(K, { id: C, label: m, required: u, error: x, helpText: v, className: h, children: /* @__PURE__ */ p("div", { className: "position-relative", children: [
|
|
481
|
+
/* @__PURE__ */ a(
|
|
482
|
+
"button",
|
|
483
|
+
{
|
|
484
|
+
ref: S,
|
|
485
|
+
id: C,
|
|
486
|
+
type: "button",
|
|
487
|
+
name: o,
|
|
488
|
+
className: f("form-select text-start", x && "is-invalid"),
|
|
489
|
+
disabled: i || d,
|
|
490
|
+
"aria-haspopup": "listbox",
|
|
491
|
+
"aria-expanded": w,
|
|
492
|
+
onClick: () => y((I) => !I),
|
|
493
|
+
onKeyDown: U,
|
|
494
|
+
children: E || /* @__PURE__ */ a("span", { className: "text-body-secondary", children: b })
|
|
495
|
+
}
|
|
496
|
+
),
|
|
497
|
+
/* @__PURE__ */ a(G, { open: w, onClose: $, anchorRef: S, className: "dropdown-menu w-100", role: "listbox", children: l ? /* @__PURE__ */ a("div", { className: "px-3 py-2 text-body-secondary", children: "Loading…" }) : e.length === 0 ? /* @__PURE__ */ a("div", { className: "px-3 py-2 text-body-secondary", children: s }) : e.map((I, F) => /* @__PURE__ */ p(
|
|
498
|
+
"div",
|
|
499
|
+
{
|
|
500
|
+
role: "option",
|
|
501
|
+
"aria-selected": D.has(I.value),
|
|
502
|
+
className: f(
|
|
503
|
+
"dropdown-item d-flex align-items-center gap-2",
|
|
504
|
+
F === q && "active",
|
|
505
|
+
I.disabled && "disabled"
|
|
506
|
+
),
|
|
507
|
+
onMouseEnter: () => _(F),
|
|
508
|
+
onMouseDown: (J) => {
|
|
509
|
+
J.preventDefault(), I.disabled || L(F);
|
|
510
|
+
},
|
|
511
|
+
children: [
|
|
512
|
+
/* @__PURE__ */ a("input", { type: "checkbox", className: "form-check-input m-0", checked: D.has(I.value), readOnly: !0, tabIndex: -1 }),
|
|
513
|
+
I.label
|
|
514
|
+
]
|
|
515
|
+
},
|
|
516
|
+
String(I.value)
|
|
517
|
+
)) })
|
|
518
|
+
] }) });
|
|
519
|
+
}
|
|
520
|
+
function H(e) {
|
|
521
|
+
if (!e)
|
|
522
|
+
return "";
|
|
523
|
+
const n = e.getFullYear(), t = String(e.getMonth() + 1).padStart(2, "0"), r = String(e.getDate()).padStart(2, "0");
|
|
524
|
+
return `${n}-${t}-${r}`;
|
|
525
|
+
}
|
|
526
|
+
function me(e) {
|
|
527
|
+
if (!e)
|
|
528
|
+
return null;
|
|
529
|
+
const n = e.split("-").map(Number), [t, r, l] = n;
|
|
530
|
+
return !t || !r || !l ? null : new Date(t, r - 1, l);
|
|
531
|
+
}
|
|
532
|
+
function De({ value: e, defaultValue: n, onChange: t, min: r, max: l, ...s }) {
|
|
533
|
+
const [c, o] = V({
|
|
534
|
+
value: e,
|
|
535
|
+
defaultValue: n ?? null,
|
|
536
|
+
onChange: t
|
|
537
|
+
});
|
|
538
|
+
return /* @__PURE__ */ a(
|
|
539
|
+
Y,
|
|
540
|
+
{
|
|
541
|
+
...s,
|
|
542
|
+
value: H(c),
|
|
543
|
+
onChange: (i) => o(me(i)),
|
|
544
|
+
inputProps: {
|
|
545
|
+
type: "date",
|
|
546
|
+
min: r ? H(r) : void 0,
|
|
547
|
+
max: l ? H(l) : void 0
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
);
|
|
551
|
+
}
|
|
552
|
+
function he(e) {
|
|
553
|
+
if (!e)
|
|
554
|
+
return "";
|
|
555
|
+
const n = String(e.getHours()).padStart(2, "0"), t = String(e.getMinutes()).padStart(2, "0");
|
|
556
|
+
return `${n}:${t}`;
|
|
557
|
+
}
|
|
558
|
+
function be(e) {
|
|
559
|
+
if (!e)
|
|
560
|
+
return null;
|
|
561
|
+
const [n, t] = e.split(":").map(Number);
|
|
562
|
+
return n === void 0 || t === void 0 || Number.isNaN(n) || Number.isNaN(t) ? null : new Date(1970, 0, 1, n, t, 0, 0);
|
|
563
|
+
}
|
|
564
|
+
function xn({ value: e, defaultValue: n, onChange: t, step: r, ...l }) {
|
|
565
|
+
const [s, c] = V({
|
|
566
|
+
value: e,
|
|
567
|
+
defaultValue: n ?? null,
|
|
568
|
+
onChange: t
|
|
569
|
+
});
|
|
570
|
+
return /* @__PURE__ */ a(
|
|
571
|
+
Y,
|
|
572
|
+
{
|
|
573
|
+
...l,
|
|
574
|
+
value: he(s),
|
|
575
|
+
onChange: (o) => c(be(o)),
|
|
576
|
+
inputProps: { type: "time", step: r }
|
|
577
|
+
}
|
|
578
|
+
);
|
|
579
|
+
}
|
|
580
|
+
function ae(e, n) {
|
|
581
|
+
const t = me(e);
|
|
582
|
+
if (!t)
|
|
583
|
+
return null;
|
|
584
|
+
const r = be(n || "00:00");
|
|
585
|
+
return r && t.setHours(r.getHours(), r.getMinutes(), 0, 0), t;
|
|
586
|
+
}
|
|
587
|
+
function kn({
|
|
588
|
+
value: e,
|
|
589
|
+
defaultValue: n,
|
|
590
|
+
onChange: t,
|
|
591
|
+
min: r,
|
|
592
|
+
max: l,
|
|
593
|
+
id: s,
|
|
594
|
+
name: c,
|
|
595
|
+
disabled: o,
|
|
596
|
+
readOnly: i,
|
|
597
|
+
required: d,
|
|
598
|
+
className: u,
|
|
599
|
+
label: h,
|
|
600
|
+
helpText: m,
|
|
601
|
+
error: b
|
|
602
|
+
}) {
|
|
603
|
+
const [v, x] = V({
|
|
604
|
+
value: e,
|
|
605
|
+
defaultValue: n ?? null,
|
|
606
|
+
onChange: t
|
|
607
|
+
}), N = P(), g = s ?? N, w = H(v), y = he(v);
|
|
608
|
+
return /* @__PURE__ */ a(K, { id: g, label: h, required: d, error: b, helpText: m, className: u, children: /* @__PURE__ */ p("div", { className: "d-flex gap-2", children: [
|
|
609
|
+
/* @__PURE__ */ a(
|
|
610
|
+
"input",
|
|
611
|
+
{
|
|
612
|
+
id: g,
|
|
613
|
+
name: c ? `${c}-date` : void 0,
|
|
614
|
+
type: "date",
|
|
615
|
+
className: f("form-control", b && "is-invalid"),
|
|
616
|
+
disabled: o,
|
|
617
|
+
readOnly: i,
|
|
618
|
+
required: d,
|
|
619
|
+
min: r ? H(r) : void 0,
|
|
620
|
+
max: l ? H(l) : void 0,
|
|
621
|
+
value: w,
|
|
622
|
+
onChange: (S) => x(ae(S.target.value, y))
|
|
623
|
+
}
|
|
624
|
+
),
|
|
625
|
+
/* @__PURE__ */ a(
|
|
626
|
+
"input",
|
|
627
|
+
{
|
|
628
|
+
name: c ? `${c}-time` : void 0,
|
|
629
|
+
type: "time",
|
|
630
|
+
className: f("form-control", b && "is-invalid"),
|
|
631
|
+
disabled: o,
|
|
632
|
+
readOnly: i,
|
|
633
|
+
required: d,
|
|
634
|
+
value: y,
|
|
635
|
+
onChange: (S) => x(ae(w || H(/* @__PURE__ */ new Date()), S.target.value))
|
|
636
|
+
}
|
|
637
|
+
)
|
|
638
|
+
] }) });
|
|
639
|
+
}
|
|
640
|
+
function Ve({
|
|
641
|
+
options: e,
|
|
642
|
+
value: n,
|
|
643
|
+
defaultValue: t,
|
|
644
|
+
onChange: r,
|
|
645
|
+
loading: l,
|
|
646
|
+
emptyText: s = "No options",
|
|
647
|
+
id: c,
|
|
648
|
+
name: o,
|
|
649
|
+
disabled: i,
|
|
650
|
+
readOnly: d,
|
|
651
|
+
required: u,
|
|
652
|
+
className: h,
|
|
653
|
+
label: m,
|
|
654
|
+
placeholder: b = "Select...",
|
|
655
|
+
helpText: v,
|
|
656
|
+
error: x
|
|
657
|
+
}) {
|
|
658
|
+
const [N, g] = V({
|
|
659
|
+
value: n,
|
|
660
|
+
defaultValue: t ?? null,
|
|
661
|
+
onChange: r
|
|
662
|
+
}), [w, y] = T(!1), S = M(null), k = P(), C = c ?? k, D = e.find((O) => O.value === N) ?? null, $ = R(() => y(!1), []), L = R(
|
|
663
|
+
(O) => {
|
|
664
|
+
const E = e[O];
|
|
665
|
+
!E || E.disabled || (g(E.value), $());
|
|
666
|
+
},
|
|
667
|
+
[e, g, $]
|
|
668
|
+
), { activeIndex: q, setActiveIndex: _, handleKeyDown: U } = ee({
|
|
669
|
+
itemCount: e.length,
|
|
670
|
+
isOpen: w,
|
|
671
|
+
onSelect: L,
|
|
672
|
+
onClose: $
|
|
673
|
+
});
|
|
674
|
+
return /* @__PURE__ */ a(K, { id: C, label: m, required: u, error: x, helpText: v, className: h, children: /* @__PURE__ */ p("div", { className: "position-relative", children: [
|
|
675
|
+
/* @__PURE__ */ a(
|
|
676
|
+
"button",
|
|
677
|
+
{
|
|
678
|
+
ref: S,
|
|
679
|
+
id: C,
|
|
680
|
+
type: "button",
|
|
681
|
+
name: o,
|
|
682
|
+
className: f("form-select text-start", x && "is-invalid"),
|
|
683
|
+
disabled: i || d,
|
|
684
|
+
"aria-haspopup": "listbox",
|
|
685
|
+
"aria-expanded": w,
|
|
686
|
+
onClick: () => y((O) => !O),
|
|
687
|
+
onKeyDown: U,
|
|
688
|
+
children: D ? D.label : /* @__PURE__ */ a("span", { className: "text-body-secondary", children: b })
|
|
689
|
+
}
|
|
690
|
+
),
|
|
691
|
+
/* @__PURE__ */ a(G, { open: w, onClose: $, anchorRef: S, className: "dropdown-menu w-100", role: "listbox", children: l ? /* @__PURE__ */ a("div", { className: "px-3 py-2 text-body-secondary", children: "Loading…" }) : e.length === 0 ? /* @__PURE__ */ a("div", { className: "px-3 py-2 text-body-secondary", children: s }) : e.map((O, E) => /* @__PURE__ */ a(
|
|
692
|
+
"div",
|
|
693
|
+
{
|
|
694
|
+
role: "option",
|
|
695
|
+
"aria-selected": O.value === N,
|
|
696
|
+
className: f("dropdown-item", E === q && "active", O.disabled && "disabled"),
|
|
697
|
+
onMouseEnter: () => _(E),
|
|
698
|
+
onMouseDown: (I) => {
|
|
699
|
+
I.preventDefault(), O.disabled || L(E);
|
|
700
|
+
},
|
|
701
|
+
children: O.label
|
|
702
|
+
},
|
|
703
|
+
String(O.value)
|
|
704
|
+
)) })
|
|
705
|
+
] }) });
|
|
706
|
+
}
|
|
707
|
+
function Te(e, n) {
|
|
708
|
+
return n ? e.label.toLowerCase().includes(n.toLowerCase()) : !0;
|
|
709
|
+
}
|
|
710
|
+
function Me({
|
|
711
|
+
options: e,
|
|
712
|
+
value: n,
|
|
713
|
+
defaultValue: t,
|
|
714
|
+
onChange: r,
|
|
715
|
+
inputValue: l,
|
|
716
|
+
onInputValueChange: s,
|
|
717
|
+
loading: c,
|
|
718
|
+
emptyText: o = "No results",
|
|
719
|
+
filter: i,
|
|
720
|
+
id: d,
|
|
721
|
+
name: u,
|
|
722
|
+
disabled: h,
|
|
723
|
+
readOnly: m,
|
|
724
|
+
required: b,
|
|
725
|
+
className: v,
|
|
726
|
+
label: x,
|
|
727
|
+
placeholder: N,
|
|
728
|
+
helpText: g,
|
|
729
|
+
error: w
|
|
730
|
+
}) {
|
|
731
|
+
const [y, S] = V({
|
|
732
|
+
value: n,
|
|
733
|
+
defaultValue: t ?? null,
|
|
734
|
+
onChange: r
|
|
735
|
+
}), k = e.find((A) => A.value === y) ?? null, [C, D] = V({
|
|
736
|
+
value: l,
|
|
737
|
+
defaultValue: (k == null ? void 0 : k.label) ?? "",
|
|
738
|
+
onChange: s
|
|
739
|
+
}), [$, L] = T(!1), q = M(null), _ = P(), U = d ?? _, O = i ?? Te, E = e.filter((A) => O(A, C)), I = R(() => L(!1), []), F = R(
|
|
740
|
+
(A) => {
|
|
741
|
+
const j = E[A];
|
|
742
|
+
!j || j.disabled || (S(j.value), D(j.label), I());
|
|
743
|
+
},
|
|
744
|
+
[E, S, D, I]
|
|
745
|
+
), { activeIndex: J, setActiveIndex: te, handleKeyDown: we } = ee({
|
|
746
|
+
itemCount: E.length,
|
|
747
|
+
isOpen: $,
|
|
748
|
+
onSelect: F,
|
|
749
|
+
onClose: I
|
|
750
|
+
});
|
|
751
|
+
return /* @__PURE__ */ a(K, { id: U, label: x, required: b, error: w, helpText: g, className: v, children: /* @__PURE__ */ p("div", { className: "position-relative", children: [
|
|
752
|
+
/* @__PURE__ */ a(
|
|
753
|
+
"input",
|
|
754
|
+
{
|
|
755
|
+
ref: q,
|
|
756
|
+
id: U,
|
|
757
|
+
name: u,
|
|
758
|
+
type: "text",
|
|
759
|
+
className: f("form-control", w && "is-invalid"),
|
|
760
|
+
disabled: h,
|
|
761
|
+
readOnly: m,
|
|
762
|
+
required: b,
|
|
763
|
+
placeholder: N,
|
|
764
|
+
autoComplete: "off",
|
|
765
|
+
role: "combobox",
|
|
766
|
+
"aria-expanded": $,
|
|
767
|
+
"aria-haspopup": "listbox",
|
|
768
|
+
value: C,
|
|
769
|
+
onFocus: () => L(!0),
|
|
770
|
+
onChange: (A) => {
|
|
771
|
+
const j = A.target.value;
|
|
772
|
+
D(j), L(!0), y !== null && S(null);
|
|
773
|
+
},
|
|
774
|
+
onKeyDown: we
|
|
775
|
+
}
|
|
776
|
+
),
|
|
777
|
+
/* @__PURE__ */ a(G, { open: $, onClose: I, anchorRef: q, className: "dropdown-menu w-100", role: "listbox", children: c ? /* @__PURE__ */ a("div", { className: "px-3 py-2 text-body-secondary", children: "Loading…" }) : E.length === 0 ? /* @__PURE__ */ a("div", { className: "px-3 py-2 text-body-secondary", children: o }) : E.map((A, j) => /* @__PURE__ */ a(
|
|
778
|
+
"div",
|
|
779
|
+
{
|
|
780
|
+
role: "option",
|
|
781
|
+
"aria-selected": A.value === y,
|
|
782
|
+
className: f("dropdown-item", j === J && "active", A.disabled && "disabled"),
|
|
783
|
+
onMouseEnter: () => te(j),
|
|
784
|
+
onMouseDown: (xe) => {
|
|
785
|
+
xe.preventDefault(), A.disabled || F(j);
|
|
786
|
+
},
|
|
787
|
+
children: A.label
|
|
788
|
+
},
|
|
789
|
+
String(A.value)
|
|
790
|
+
)) })
|
|
791
|
+
] }) });
|
|
792
|
+
}
|
|
793
|
+
function Sn(e) {
|
|
794
|
+
return /* @__PURE__ */ a(K, { ...e });
|
|
795
|
+
}
|
|
796
|
+
function Ee({ open: e, onClose: n, title: t, children: r, footer: l, className: s }) {
|
|
797
|
+
return le(e, n), e ? /* @__PURE__ */ p(X, { children: [
|
|
798
|
+
/* @__PURE__ */ a("div", { className: "modal d-block", tabIndex: -1, role: "dialog", "aria-modal": "true", children: /* @__PURE__ */ a("div", { className: f("modal-dialog", s), role: "document", children: /* @__PURE__ */ p("div", { className: "modal-content", children: [
|
|
799
|
+
/* @__PURE__ */ p("div", { className: "modal-header", children: [
|
|
800
|
+
t && /* @__PURE__ */ a("h5", { className: "modal-title", children: t }),
|
|
801
|
+
/* @__PURE__ */ a("button", { type: "button", className: "btn-close", "aria-label": "Close", onClick: n })
|
|
802
|
+
] }),
|
|
803
|
+
/* @__PURE__ */ a("div", { className: "modal-body", children: r }),
|
|
804
|
+
l && /* @__PURE__ */ a("div", { className: "modal-footer", children: l })
|
|
805
|
+
] }) }) }),
|
|
806
|
+
/* @__PURE__ */ a("div", { className: "modal-backdrop show", onClick: n })
|
|
807
|
+
] }) : null;
|
|
808
|
+
}
|
|
809
|
+
function Re(e, n, t) {
|
|
810
|
+
const r = [], l = Math.max(1, e - t), s = Math.min(n, e + t);
|
|
811
|
+
l > 1 && (r.push(1), l > 2 && r.push("ellipsis"));
|
|
812
|
+
for (let c = l; c <= s; c++)
|
|
813
|
+
r.push(c);
|
|
814
|
+
return s < n && (s < n - 1 && r.push("ellipsis"), r.push(n)), r;
|
|
815
|
+
}
|
|
816
|
+
function $e({ currentPage: e, pageSize: n, totalItems: t, onPageChange: r, siblingCount: l = 1, className: s }) {
|
|
817
|
+
const c = Math.max(1, Math.ceil(t / n)), o = Re(e, c, l);
|
|
818
|
+
return /* @__PURE__ */ a("nav", { "aria-label": "Pagination", className: s, children: /* @__PURE__ */ p("ul", { className: "pagination mb-0", children: [
|
|
819
|
+
/* @__PURE__ */ a("li", { className: f("page-item", e <= 1 && "disabled"), children: /* @__PURE__ */ a(
|
|
820
|
+
"button",
|
|
821
|
+
{
|
|
822
|
+
type: "button",
|
|
823
|
+
className: "page-link",
|
|
824
|
+
disabled: e <= 1,
|
|
825
|
+
onClick: () => r(e - 1),
|
|
826
|
+
children: "Previous"
|
|
827
|
+
}
|
|
828
|
+
) }),
|
|
829
|
+
o.map(
|
|
830
|
+
(i, d) => i === "ellipsis" ? /* @__PURE__ */ a("li", { className: "page-item disabled", children: /* @__PURE__ */ a("span", { className: "page-link", children: "…" }) }, `ellipsis-${d}`) : /* @__PURE__ */ a("li", { className: f("page-item", i === e && "active"), children: /* @__PURE__ */ a(
|
|
831
|
+
"button",
|
|
832
|
+
{
|
|
833
|
+
type: "button",
|
|
834
|
+
className: "page-link",
|
|
835
|
+
"aria-current": i === e ? "page" : void 0,
|
|
836
|
+
onClick: () => r(i),
|
|
837
|
+
children: i
|
|
838
|
+
}
|
|
839
|
+
) }, i)
|
|
840
|
+
),
|
|
841
|
+
/* @__PURE__ */ a("li", { className: f("page-item", e >= c && "disabled"), children: /* @__PURE__ */ a(
|
|
842
|
+
"button",
|
|
843
|
+
{
|
|
844
|
+
type: "button",
|
|
845
|
+
className: "page-link",
|
|
846
|
+
disabled: e >= c,
|
|
847
|
+
onClick: () => r(e + 1),
|
|
848
|
+
children: "Next"
|
|
849
|
+
}
|
|
850
|
+
) })
|
|
851
|
+
] }) });
|
|
852
|
+
}
|
|
853
|
+
function Oe(e, n) {
|
|
854
|
+
return !e || e.key !== n ? { key: n, direction: "asc" } : e.direction === "asc" ? { key: n, direction: "desc" } : null;
|
|
855
|
+
}
|
|
856
|
+
function Ae({
|
|
857
|
+
columns: e,
|
|
858
|
+
rows: n,
|
|
859
|
+
rowKey: t,
|
|
860
|
+
loading: r,
|
|
861
|
+
error: l,
|
|
862
|
+
emptyText: s = "No data",
|
|
863
|
+
className: c,
|
|
864
|
+
selectedRowKeys: o,
|
|
865
|
+
onSelectionChange: i,
|
|
866
|
+
sort: d,
|
|
867
|
+
onSortChange: u,
|
|
868
|
+
page: h,
|
|
869
|
+
pageSize: m,
|
|
870
|
+
totalCount: b,
|
|
871
|
+
onPageChange: v
|
|
872
|
+
}) {
|
|
873
|
+
const x = !!i, N = new Set(o ?? []), g = h !== void 0 && m !== void 0 && b !== void 0, w = g ? Math.max(1, Math.ceil(b / m)) : 1;
|
|
874
|
+
function y() {
|
|
875
|
+
i && (N.size === n.length ? i([]) : i(n.map(t)));
|
|
876
|
+
}
|
|
877
|
+
function S(k) {
|
|
878
|
+
if (!i)
|
|
879
|
+
return;
|
|
880
|
+
const C = new Set(N);
|
|
881
|
+
C.has(k) ? C.delete(k) : C.add(k), i(Array.from(C));
|
|
882
|
+
}
|
|
883
|
+
return /* @__PURE__ */ p("div", { className: f("table-responsive", c), children: [
|
|
884
|
+
/* @__PURE__ */ p("table", { className: "table table-hover align-middle", children: [
|
|
885
|
+
/* @__PURE__ */ a("thead", { children: /* @__PURE__ */ p("tr", { children: [
|
|
886
|
+
x && /* @__PURE__ */ a("th", { style: { width: "2.5rem" }, children: /* @__PURE__ */ a(
|
|
887
|
+
"input",
|
|
888
|
+
{
|
|
889
|
+
type: "checkbox",
|
|
890
|
+
className: "form-check-input",
|
|
891
|
+
checked: n.length > 0 && N.size === n.length,
|
|
892
|
+
onChange: y,
|
|
893
|
+
"aria-label": "Select all rows"
|
|
894
|
+
}
|
|
895
|
+
) }),
|
|
896
|
+
e.map((k) => /* @__PURE__ */ p(
|
|
897
|
+
"th",
|
|
898
|
+
{
|
|
899
|
+
style: { width: k.width },
|
|
900
|
+
role: k.sortable ? "button" : void 0,
|
|
901
|
+
onClick: k.sortable && u ? () => u(Oe(d, k.key)) : void 0,
|
|
902
|
+
children: [
|
|
903
|
+
k.header,
|
|
904
|
+
k.sortable && (d == null ? void 0 : d.key) === k.key && /* @__PURE__ */ p("span", { "aria-hidden": "true", children: [
|
|
905
|
+
" ",
|
|
906
|
+
d.direction === "asc" ? "▲" : "▼"
|
|
907
|
+
] })
|
|
908
|
+
]
|
|
909
|
+
},
|
|
910
|
+
k.key
|
|
911
|
+
))
|
|
912
|
+
] }) }),
|
|
913
|
+
/* @__PURE__ */ a("tbody", { children: r ? /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a("td", { colSpan: e.length + (x ? 1 : 0), className: "text-center text-body-secondary py-4", children: "Loading…" }) }) : l ? /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a("td", { colSpan: e.length + (x ? 1 : 0), className: "text-center text-danger py-4", children: l }) }) : n.length === 0 ? /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a("td", { colSpan: e.length + (x ? 1 : 0), className: "text-center text-body-secondary py-4", children: s }) }) : n.map((k) => {
|
|
914
|
+
const C = t(k);
|
|
915
|
+
return /* @__PURE__ */ p("tr", { children: [
|
|
916
|
+
x && /* @__PURE__ */ a("td", { children: /* @__PURE__ */ a(
|
|
917
|
+
"input",
|
|
918
|
+
{
|
|
919
|
+
type: "checkbox",
|
|
920
|
+
className: "form-check-input",
|
|
921
|
+
checked: N.has(C),
|
|
922
|
+
onChange: () => S(C),
|
|
923
|
+
"aria-label": "Select row"
|
|
924
|
+
}
|
|
925
|
+
) }),
|
|
926
|
+
e.map((D) => /* @__PURE__ */ a("td", { children: D.render ? D.render(k) : String(k[D.key] ?? "") }, D.key))
|
|
927
|
+
] }, C);
|
|
928
|
+
}) })
|
|
929
|
+
] }),
|
|
930
|
+
g && /* @__PURE__ */ p("div", { className: "d-flex justify-content-between align-items-center mt-2", children: [
|
|
931
|
+
/* @__PURE__ */ p("span", { className: "text-body-secondary small", children: [
|
|
932
|
+
"Page ",
|
|
933
|
+
h,
|
|
934
|
+
" of ",
|
|
935
|
+
w,
|
|
936
|
+
" (",
|
|
937
|
+
b,
|
|
938
|
+
" rows)"
|
|
939
|
+
] }),
|
|
940
|
+
/* @__PURE__ */ a($e, { currentPage: h, pageSize: m, totalItems: b, onPageChange: v })
|
|
941
|
+
] })
|
|
942
|
+
] });
|
|
943
|
+
}
|
|
944
|
+
function Pe({ size: e = "md", variant: n, className: t, label: r = "Loading..." }) {
|
|
945
|
+
return /* @__PURE__ */ a(
|
|
946
|
+
"span",
|
|
947
|
+
{
|
|
948
|
+
className: f("spinner-border", e === "sm" && "spinner-border-sm", n && `text-${n}`, t),
|
|
949
|
+
role: "status",
|
|
950
|
+
children: /* @__PURE__ */ a("span", { className: "visually-hidden", children: r })
|
|
951
|
+
}
|
|
952
|
+
);
|
|
953
|
+
}
|
|
954
|
+
function re({
|
|
955
|
+
variant: e = "primary",
|
|
956
|
+
size: n,
|
|
957
|
+
disabled: t,
|
|
958
|
+
loading: r,
|
|
959
|
+
type: l = "button",
|
|
960
|
+
className: s,
|
|
961
|
+
children: c,
|
|
962
|
+
onClick: o,
|
|
963
|
+
...i
|
|
964
|
+
}) {
|
|
965
|
+
const d = t || r;
|
|
966
|
+
return /* @__PURE__ */ p(
|
|
967
|
+
"button",
|
|
968
|
+
{
|
|
969
|
+
type: l,
|
|
970
|
+
className: f("btn", `btn-${e}`, n && `btn-${n}`, s),
|
|
971
|
+
disabled: d,
|
|
972
|
+
"aria-busy": r || void 0,
|
|
973
|
+
onClick: d ? void 0 : o,
|
|
974
|
+
...i,
|
|
975
|
+
children: [
|
|
976
|
+
r && /* @__PURE__ */ a(Pe, { size: "sm", className: "me-2", label: "" }),
|
|
977
|
+
c
|
|
978
|
+
]
|
|
979
|
+
}
|
|
980
|
+
);
|
|
981
|
+
}
|
|
982
|
+
function ve({ variant: e = "info", dismissible: n, onDismiss: t, className: r, children: l }) {
|
|
983
|
+
return /* @__PURE__ */ p("div", { className: f("alert", `alert-${e}`, n && "alert-dismissible", r), role: "alert", children: [
|
|
984
|
+
l,
|
|
985
|
+
n && /* @__PURE__ */ a("button", { type: "button", className: "btn-close", "aria-label": "Close", onClick: t })
|
|
986
|
+
] });
|
|
987
|
+
}
|
|
988
|
+
const pe = ce(null), Fe = 4e3;
|
|
989
|
+
function Cn({ children: e }) {
|
|
990
|
+
const [n, t] = T([]), r = M(0), l = M(/* @__PURE__ */ new Map());
|
|
991
|
+
B(() => {
|
|
992
|
+
const i = l.current;
|
|
993
|
+
return () => {
|
|
994
|
+
i.forEach(clearTimeout), i.clear();
|
|
995
|
+
};
|
|
996
|
+
}, []);
|
|
997
|
+
const s = R((i) => {
|
|
998
|
+
const d = l.current.get(i);
|
|
999
|
+
d && (clearTimeout(d), l.current.delete(i)), t((u) => u.filter((h) => h.id !== i));
|
|
1000
|
+
}, []), c = R(
|
|
1001
|
+
(i, d) => {
|
|
1002
|
+
const u = r.current++, h = (d == null ? void 0 : d.variant) ?? "info", m = (d == null ? void 0 : d.duration) ?? Fe;
|
|
1003
|
+
return t((b) => [...b, { id: u, message: i, variant: h }]), m > 0 && l.current.set(
|
|
1004
|
+
u,
|
|
1005
|
+
setTimeout(() => s(u), m)
|
|
1006
|
+
), u;
|
|
1007
|
+
},
|
|
1008
|
+
[s]
|
|
1009
|
+
), o = W(
|
|
1010
|
+
() => ({
|
|
1011
|
+
show: c,
|
|
1012
|
+
dismiss: s,
|
|
1013
|
+
success: (i, d) => c(i, { ...d, variant: "success" }),
|
|
1014
|
+
error: (i, d) => c(i, { ...d, variant: "danger" }),
|
|
1015
|
+
info: (i, d) => c(i, { ...d, variant: "info" }),
|
|
1016
|
+
warning: (i, d) => c(i, { ...d, variant: "warning" })
|
|
1017
|
+
}),
|
|
1018
|
+
[c, s]
|
|
1019
|
+
);
|
|
1020
|
+
return /* @__PURE__ */ p(pe.Provider, { value: o, children: [
|
|
1021
|
+
e,
|
|
1022
|
+
/* @__PURE__ */ a("div", { className: "toast-container position-fixed bottom-0 end-0 p-3", style: { zIndex: 1090 }, children: n.map((i) => /* @__PURE__ */ a(ve, { variant: i.variant, dismissible: !0, onDismiss: () => s(i.id), className: "shadow-sm", children: i.message }, i.id)) })
|
|
1023
|
+
] });
|
|
1024
|
+
}
|
|
1025
|
+
function In() {
|
|
1026
|
+
const e = de(pe);
|
|
1027
|
+
if (!e)
|
|
1028
|
+
throw new Error("useToast must be used within a ToastProvider");
|
|
1029
|
+
return e;
|
|
1030
|
+
}
|
|
1031
|
+
const ge = ce(null);
|
|
1032
|
+
function Dn({ children: e }) {
|
|
1033
|
+
const [n, t] = T(null), r = R((s) => new Promise((c) => {
|
|
1034
|
+
t({ ...s, resolve: c });
|
|
1035
|
+
}), []), l = R(
|
|
1036
|
+
(s) => {
|
|
1037
|
+
n == null || n.resolve(s), t(null);
|
|
1038
|
+
},
|
|
1039
|
+
[n]
|
|
1040
|
+
);
|
|
1041
|
+
return /* @__PURE__ */ p(ge.Provider, { value: r, children: [
|
|
1042
|
+
e,
|
|
1043
|
+
/* @__PURE__ */ a(
|
|
1044
|
+
Ee,
|
|
1045
|
+
{
|
|
1046
|
+
open: n !== null,
|
|
1047
|
+
onClose: () => l(!1),
|
|
1048
|
+
title: (n == null ? void 0 : n.title) ?? "Confirm",
|
|
1049
|
+
footer: /* @__PURE__ */ p(X, { children: [
|
|
1050
|
+
/* @__PURE__ */ a(re, { variant: "outline-secondary", onClick: () => l(!1), children: (n == null ? void 0 : n.cancelLabel) ?? "Cancel" }),
|
|
1051
|
+
/* @__PURE__ */ a(re, { variant: (n == null ? void 0 : n.confirmVariant) ?? "danger", onClick: () => l(!0), children: (n == null ? void 0 : n.confirmLabel) ?? "Confirm" })
|
|
1052
|
+
] }),
|
|
1053
|
+
children: n == null ? void 0 : n.message
|
|
1054
|
+
}
|
|
1055
|
+
)
|
|
1056
|
+
] });
|
|
1057
|
+
}
|
|
1058
|
+
function Vn() {
|
|
1059
|
+
const e = de(ge);
|
|
1060
|
+
if (!e)
|
|
1061
|
+
throw new Error("useConfirm must be used within a ConfirmProvider");
|
|
1062
|
+
return e;
|
|
1063
|
+
}
|
|
1064
|
+
function Tn({ variant: e = "primary", pill: n, className: t, children: r }) {
|
|
1065
|
+
return /* @__PURE__ */ a("span", { className: f("badge", `bg-${e}`, n && "rounded-pill", t), children: r });
|
|
1066
|
+
}
|
|
1067
|
+
function Mn({ items: e, activeKey: n, defaultActiveKey: t, onChange: r, className: l }) {
|
|
1068
|
+
var i;
|
|
1069
|
+
const [s, c] = V({
|
|
1070
|
+
value: n,
|
|
1071
|
+
defaultValue: t ?? ((i = e[0]) == null ? void 0 : i.key) ?? "",
|
|
1072
|
+
onChange: r
|
|
1073
|
+
}), o = e.find((d) => d.key === s);
|
|
1074
|
+
return /* @__PURE__ */ p("div", { className: l, children: [
|
|
1075
|
+
/* @__PURE__ */ a("ul", { className: "nav nav-tabs", role: "tablist", children: e.map((d) => /* @__PURE__ */ a("li", { className: "nav-item", role: "presentation", children: /* @__PURE__ */ a(
|
|
1076
|
+
"button",
|
|
1077
|
+
{
|
|
1078
|
+
type: "button",
|
|
1079
|
+
className: f("nav-link", d.key === s && "active"),
|
|
1080
|
+
role: "tab",
|
|
1081
|
+
"aria-selected": d.key === s,
|
|
1082
|
+
disabled: d.disabled,
|
|
1083
|
+
onClick: () => c(d.key),
|
|
1084
|
+
children: d.label
|
|
1085
|
+
}
|
|
1086
|
+
) }, d.key)) }),
|
|
1087
|
+
/* @__PURE__ */ a("div", { className: "tab-content pt-3", role: "tabpanel", children: o == null ? void 0 : o.content })
|
|
1088
|
+
] });
|
|
1089
|
+
}
|
|
1090
|
+
function Le({ items: e, multiple: n = !1, openKeys: t, defaultOpenKeys: r, onChange: l, className: s }) {
|
|
1091
|
+
const [c, o] = V({
|
|
1092
|
+
value: t,
|
|
1093
|
+
defaultValue: r ?? [],
|
|
1094
|
+
onChange: l
|
|
1095
|
+
}), i = new Set(c);
|
|
1096
|
+
function d(u) {
|
|
1097
|
+
i.has(u) ? o(c.filter((h) => h !== u)) : o(n ? [...c, u] : [u]);
|
|
1098
|
+
}
|
|
1099
|
+
return /* @__PURE__ */ a("div", { className: f("accordion", s), children: e.map((u) => {
|
|
1100
|
+
const h = i.has(u.key);
|
|
1101
|
+
return /* @__PURE__ */ p("div", { className: "accordion-item", children: [
|
|
1102
|
+
/* @__PURE__ */ a("h2", { className: "accordion-header", children: /* @__PURE__ */ a(
|
|
1103
|
+
"button",
|
|
1104
|
+
{
|
|
1105
|
+
type: "button",
|
|
1106
|
+
className: f("accordion-button", !h && "collapsed"),
|
|
1107
|
+
"aria-expanded": h,
|
|
1108
|
+
disabled: u.disabled,
|
|
1109
|
+
onClick: () => d(u.key),
|
|
1110
|
+
children: u.header
|
|
1111
|
+
}
|
|
1112
|
+
) }),
|
|
1113
|
+
h && /* @__PURE__ */ a("div", { className: "accordion-collapse", children: /* @__PURE__ */ a("div", { className: "accordion-body", children: u.content }) })
|
|
1114
|
+
] }, u.key);
|
|
1115
|
+
}) });
|
|
1116
|
+
}
|
|
1117
|
+
function En({ content: e, children: n, placement: t = "top", className: r }) {
|
|
1118
|
+
const [l, s] = T(!1), c = M(null), o = P();
|
|
1119
|
+
return /* @__PURE__ */ p(
|
|
1120
|
+
"span",
|
|
1121
|
+
{
|
|
1122
|
+
ref: c,
|
|
1123
|
+
className: "position-relative d-inline-block",
|
|
1124
|
+
onMouseEnter: () => s(!0),
|
|
1125
|
+
onMouseLeave: () => s(!1),
|
|
1126
|
+
onFocus: () => s(!0),
|
|
1127
|
+
onBlur: () => s(!1),
|
|
1128
|
+
"aria-describedby": l ? o : void 0,
|
|
1129
|
+
children: [
|
|
1130
|
+
n,
|
|
1131
|
+
/* @__PURE__ */ a(
|
|
1132
|
+
G,
|
|
1133
|
+
{
|
|
1134
|
+
open: l,
|
|
1135
|
+
onClose: () => s(!1),
|
|
1136
|
+
anchorRef: c,
|
|
1137
|
+
className: f("tooltip show", `bs-tooltip-${t}`, "position-absolute", "w-auto", r),
|
|
1138
|
+
children: /* @__PURE__ */ a("span", { id: o, role: "tooltip", className: "tooltip-inner", children: e })
|
|
1139
|
+
}
|
|
1140
|
+
)
|
|
1141
|
+
]
|
|
1142
|
+
}
|
|
1143
|
+
);
|
|
1144
|
+
}
|
|
1145
|
+
function Rn({ title: e, content: n, children: t, placement: r = "bottom", className: l }) {
|
|
1146
|
+
const [s, c] = T(!1), o = M(null);
|
|
1147
|
+
return /* @__PURE__ */ p("span", { ref: o, className: "position-relative d-inline-block", onClick: () => c((i) => !i), children: [
|
|
1148
|
+
t,
|
|
1149
|
+
/* @__PURE__ */ p(
|
|
1150
|
+
G,
|
|
1151
|
+
{
|
|
1152
|
+
open: s,
|
|
1153
|
+
onClose: () => c(!1),
|
|
1154
|
+
anchorRef: o,
|
|
1155
|
+
className: f("popover show", `bs-popover-${r}`, "position-absolute", "w-auto", l),
|
|
1156
|
+
children: [
|
|
1157
|
+
e && /* @__PURE__ */ a("h3", { className: "popover-header", children: e }),
|
|
1158
|
+
/* @__PURE__ */ a("div", { className: "popover-body", children: n })
|
|
1159
|
+
]
|
|
1160
|
+
}
|
|
1161
|
+
)
|
|
1162
|
+
] });
|
|
1163
|
+
}
|
|
1164
|
+
function $n({ header: e, footer: n, className: t, children: r }) {
|
|
1165
|
+
return /* @__PURE__ */ p("div", { className: f("card", t), children: [
|
|
1166
|
+
e && /* @__PURE__ */ a("div", { className: "card-header", children: e }),
|
|
1167
|
+
/* @__PURE__ */ a("div", { className: "card-body", children: r }),
|
|
1168
|
+
n && /* @__PURE__ */ a("div", { className: "card-footer", children: n })
|
|
1169
|
+
] });
|
|
1170
|
+
}
|
|
1171
|
+
function On({ className: e, vertical: n, label: t }) {
|
|
1172
|
+
return n ? /* @__PURE__ */ a("div", { className: f("vr", e), role: "separator", "aria-orientation": "vertical" }) : t ? /* @__PURE__ */ p("div", { className: f("d-flex align-items-center gap-2 my-3", e), role: "separator", children: [
|
|
1173
|
+
/* @__PURE__ */ a("hr", { className: "flex-grow-1 m-0" }),
|
|
1174
|
+
/* @__PURE__ */ a("span", { className: "text-body-secondary small", children: t }),
|
|
1175
|
+
/* @__PURE__ */ a("hr", { className: "flex-grow-1 m-0" })
|
|
1176
|
+
] }) : /* @__PURE__ */ a("hr", { className: f("my-3", e), role: "separator" });
|
|
1177
|
+
}
|
|
1178
|
+
function An({ direction: e = "column", gap: n = 2, align: t, justify: r, wrap: l, className: s, children: c }) {
|
|
1179
|
+
return /* @__PURE__ */ a(
|
|
1180
|
+
"div",
|
|
1181
|
+
{
|
|
1182
|
+
className: f(
|
|
1183
|
+
"d-flex",
|
|
1184
|
+
e === "row" ? "flex-row" : "flex-column",
|
|
1185
|
+
`gap-${n}`,
|
|
1186
|
+
t && `align-items-${t}`,
|
|
1187
|
+
r && `justify-content-${r}`,
|
|
1188
|
+
l && "flex-wrap",
|
|
1189
|
+
s
|
|
1190
|
+
),
|
|
1191
|
+
children: c
|
|
1192
|
+
}
|
|
1193
|
+
);
|
|
1194
|
+
}
|
|
1195
|
+
function Pn({ fluid: e, className: n, children: t }) {
|
|
1196
|
+
return /* @__PURE__ */ a("div", { className: f(e ? "container-fluid" : "container", n), children: t });
|
|
1197
|
+
}
|
|
1198
|
+
function Fn({ className: e, children: n }) {
|
|
1199
|
+
return /* @__PURE__ */ a("div", { className: f("row", e), children: n });
|
|
1200
|
+
}
|
|
1201
|
+
function Ln({ span: e, sm: n, md: t, lg: r, xl: l, className: s, children: c }) {
|
|
1202
|
+
return /* @__PURE__ */ a(
|
|
1203
|
+
"div",
|
|
1204
|
+
{
|
|
1205
|
+
className: f(
|
|
1206
|
+
e ? `col-${e}` : "col",
|
|
1207
|
+
n ? `col-sm-${n}` : void 0,
|
|
1208
|
+
t ? `col-md-${t}` : void 0,
|
|
1209
|
+
r ? `col-lg-${r}` : void 0,
|
|
1210
|
+
l ? `col-xl-${l}` : void 0,
|
|
1211
|
+
s
|
|
1212
|
+
),
|
|
1213
|
+
children: c
|
|
1214
|
+
}
|
|
1215
|
+
);
|
|
1216
|
+
}
|
|
1217
|
+
function Ke({ items: e, className: n }) {
|
|
1218
|
+
return /* @__PURE__ */ a("nav", { "aria-label": "breadcrumb", className: n, children: /* @__PURE__ */ a("ol", { className: "breadcrumb mb-0", children: e.map((t, r) => {
|
|
1219
|
+
const l = r === e.length - 1, s = !l && (t.href || t.onClick);
|
|
1220
|
+
return /* @__PURE__ */ a("li", { className: f("breadcrumb-item", l && "active"), "aria-current": l ? "page" : void 0, children: s ? /* @__PURE__ */ a(
|
|
1221
|
+
"a",
|
|
1222
|
+
{
|
|
1223
|
+
href: t.href ?? "#",
|
|
1224
|
+
onClick: (c) => {
|
|
1225
|
+
var o;
|
|
1226
|
+
t.href || c.preventDefault(), (o = t.onClick) == null || o.call(t);
|
|
1227
|
+
},
|
|
1228
|
+
children: t.label
|
|
1229
|
+
}
|
|
1230
|
+
) : t.label }, r);
|
|
1231
|
+
}) }) });
|
|
1232
|
+
}
|
|
1233
|
+
function Kn({ items: e, children: n, placement: t = "start", className: r }) {
|
|
1234
|
+
const [l, s] = T(!1), c = M(null), o = R(() => s(!1), []), i = R(
|
|
1235
|
+
(m) => {
|
|
1236
|
+
var v;
|
|
1237
|
+
const b = e[m];
|
|
1238
|
+
!b || b.disabled || ((v = b.onSelect) == null || v.call(b), o());
|
|
1239
|
+
},
|
|
1240
|
+
[e, o]
|
|
1241
|
+
), { activeIndex: d, setActiveIndex: u, handleKeyDown: h } = ee({
|
|
1242
|
+
itemCount: e.length,
|
|
1243
|
+
isOpen: l,
|
|
1244
|
+
onSelect: i,
|
|
1245
|
+
onClose: o
|
|
1246
|
+
});
|
|
1247
|
+
return /* @__PURE__ */ p(
|
|
1248
|
+
"span",
|
|
1249
|
+
{
|
|
1250
|
+
ref: c,
|
|
1251
|
+
className: "position-relative d-inline-block",
|
|
1252
|
+
onClick: () => s((m) => !m),
|
|
1253
|
+
onKeyDown: h,
|
|
1254
|
+
children: [
|
|
1255
|
+
n,
|
|
1256
|
+
/* @__PURE__ */ a(
|
|
1257
|
+
G,
|
|
1258
|
+
{
|
|
1259
|
+
open: l,
|
|
1260
|
+
onClose: o,
|
|
1261
|
+
anchorRef: c,
|
|
1262
|
+
role: "menu",
|
|
1263
|
+
className: f("dropdown-menu show", t === "end" && "dropdown-menu-end", r),
|
|
1264
|
+
children: e.map((m, b) => /* @__PURE__ */ a(
|
|
1265
|
+
"button",
|
|
1266
|
+
{
|
|
1267
|
+
type: "button",
|
|
1268
|
+
role: "menuitem",
|
|
1269
|
+
className: f("dropdown-item", b === d && "active", m.disabled && "disabled", m.danger && "text-danger"),
|
|
1270
|
+
disabled: m.disabled,
|
|
1271
|
+
onMouseEnter: () => u(b),
|
|
1272
|
+
onMouseDown: (v) => v.preventDefault(),
|
|
1273
|
+
onClick: (v) => {
|
|
1274
|
+
v.stopPropagation(), i(b);
|
|
1275
|
+
},
|
|
1276
|
+
children: m.label
|
|
1277
|
+
},
|
|
1278
|
+
m.key
|
|
1279
|
+
))
|
|
1280
|
+
}
|
|
1281
|
+
)
|
|
1282
|
+
]
|
|
1283
|
+
}
|
|
1284
|
+
);
|
|
1285
|
+
}
|
|
1286
|
+
function jn({ steps: e, currentStep: n, className: t }) {
|
|
1287
|
+
return /* @__PURE__ */ a("ol", { className: f("d-flex list-unstyled align-items-center", t), children: e.map((r, l) => {
|
|
1288
|
+
const s = l < n ? "complete" : l === n ? "active" : "upcoming", c = l === e.length - 1;
|
|
1289
|
+
return /* @__PURE__ */ p("li", { className: f("d-flex align-items-center", !c && "flex-grow-1"), children: [
|
|
1290
|
+
/* @__PURE__ */ p("div", { className: "d-flex align-items-center gap-2", children: [
|
|
1291
|
+
/* @__PURE__ */ a(
|
|
1292
|
+
"span",
|
|
1293
|
+
{
|
|
1294
|
+
className: f(
|
|
1295
|
+
"d-flex align-items-center justify-content-center rounded-circle flex-shrink-0",
|
|
1296
|
+
s === "complete" ? "bg-primary text-white" : s === "active" ? "border border-primary text-primary" : "border text-body-secondary"
|
|
1297
|
+
),
|
|
1298
|
+
style: { width: "2rem", height: "2rem" },
|
|
1299
|
+
"aria-current": s === "active" ? "step" : void 0,
|
|
1300
|
+
children: s === "complete" ? "✓" : l + 1
|
|
1301
|
+
}
|
|
1302
|
+
),
|
|
1303
|
+
/* @__PURE__ */ p("div", { children: [
|
|
1304
|
+
/* @__PURE__ */ a("div", { className: f("small fw-semibold", s === "upcoming" && "text-body-secondary"), children: r.label }),
|
|
1305
|
+
r.description && /* @__PURE__ */ a("div", { className: "small text-body-secondary", children: r.description })
|
|
1306
|
+
] })
|
|
1307
|
+
] }),
|
|
1308
|
+
!c && /* @__PURE__ */ a("hr", { className: "flex-grow-1 mx-2" })
|
|
1309
|
+
] }, r.key);
|
|
1310
|
+
}) });
|
|
1311
|
+
}
|
|
1312
|
+
function je(e) {
|
|
1313
|
+
var l, s;
|
|
1314
|
+
const n = e.trim().split(/\s+/), t = ((l = n[0]) == null ? void 0 : l[0]) ?? "", r = n.length > 1 ? ((s = n[n.length - 1]) == null ? void 0 : s[0]) ?? "" : "";
|
|
1315
|
+
return (t + r).toUpperCase();
|
|
1316
|
+
}
|
|
1317
|
+
const Be = {
|
|
1318
|
+
sm: "1.75rem",
|
|
1319
|
+
md: "2.5rem",
|
|
1320
|
+
lg: "3.5rem"
|
|
1321
|
+
};
|
|
1322
|
+
function Bn({ src: e, name: n, size: t = "md", className: r }) {
|
|
1323
|
+
const l = Be[t];
|
|
1324
|
+
return e ? /* @__PURE__ */ a(
|
|
1325
|
+
"img",
|
|
1326
|
+
{
|
|
1327
|
+
src: e,
|
|
1328
|
+
alt: n ?? "",
|
|
1329
|
+
className: f("rounded-circle", r),
|
|
1330
|
+
style: { width: l, height: l, objectFit: "cover" }
|
|
1331
|
+
}
|
|
1332
|
+
) : /* @__PURE__ */ a(
|
|
1333
|
+
"span",
|
|
1334
|
+
{
|
|
1335
|
+
className: f("d-inline-flex align-items-center justify-content-center rounded-circle bg-secondary text-white", r),
|
|
1336
|
+
style: { width: l, height: l, fontSize: `calc(${l} * 0.4)` },
|
|
1337
|
+
role: n ? "img" : void 0,
|
|
1338
|
+
"aria-label": n,
|
|
1339
|
+
children: n ? je(n) : null
|
|
1340
|
+
}
|
|
1341
|
+
);
|
|
1342
|
+
}
|
|
1343
|
+
function Hn({ variant: e = "secondary", onRemove: n, className: t, children: r }) {
|
|
1344
|
+
return /* @__PURE__ */ p("span", { className: f("badge d-inline-flex align-items-center gap-1", `bg-${e}`, t), children: [
|
|
1345
|
+
r,
|
|
1346
|
+
n && /* @__PURE__ */ a(
|
|
1347
|
+
"button",
|
|
1348
|
+
{
|
|
1349
|
+
type: "button",
|
|
1350
|
+
className: "btn-close btn-close-white",
|
|
1351
|
+
style: { fontSize: "0.55rem" },
|
|
1352
|
+
"aria-label": "Remove",
|
|
1353
|
+
onClick: n
|
|
1354
|
+
}
|
|
1355
|
+
)
|
|
1356
|
+
] });
|
|
1357
|
+
}
|
|
1358
|
+
function qn({ width: e = "100%", height: n = "1rem", circle: t, className: r }) {
|
|
1359
|
+
return /* @__PURE__ */ a("span", { className: f("placeholder-glow d-inline-block", r), style: { width: e, height: n }, "aria-hidden": "true", children: /* @__PURE__ */ a("span", { className: f("placeholder w-100 h-100 d-block", t && "rounded-circle") }) });
|
|
1360
|
+
}
|
|
1361
|
+
function Un({
|
|
1362
|
+
value: e,
|
|
1363
|
+
defaultValue: n,
|
|
1364
|
+
onChange: t,
|
|
1365
|
+
min: r = 0,
|
|
1366
|
+
max: l = 100,
|
|
1367
|
+
step: s = 1,
|
|
1368
|
+
id: c,
|
|
1369
|
+
name: o,
|
|
1370
|
+
disabled: i,
|
|
1371
|
+
required: d,
|
|
1372
|
+
className: u,
|
|
1373
|
+
label: h,
|
|
1374
|
+
helpText: m,
|
|
1375
|
+
error: b
|
|
1376
|
+
}) {
|
|
1377
|
+
const [v, x] = V({
|
|
1378
|
+
value: e,
|
|
1379
|
+
defaultValue: n ?? r,
|
|
1380
|
+
onChange: t
|
|
1381
|
+
}), N = P(), g = c ?? N;
|
|
1382
|
+
return /* @__PURE__ */ p(K, { id: g, label: h, required: d, error: b, helpText: m, className: u, children: [
|
|
1383
|
+
/* @__PURE__ */ a(
|
|
1384
|
+
"input",
|
|
1385
|
+
{
|
|
1386
|
+
id: g,
|
|
1387
|
+
name: o,
|
|
1388
|
+
type: "range",
|
|
1389
|
+
className: "form-range",
|
|
1390
|
+
disabled: i,
|
|
1391
|
+
required: d,
|
|
1392
|
+
min: r,
|
|
1393
|
+
max: l,
|
|
1394
|
+
step: s,
|
|
1395
|
+
value: v,
|
|
1396
|
+
onChange: (w) => x(Number(w.target.value))
|
|
1397
|
+
}
|
|
1398
|
+
),
|
|
1399
|
+
/* @__PURE__ */ a("div", { className: "small text-body-secondary", children: v })
|
|
1400
|
+
] });
|
|
1401
|
+
}
|
|
1402
|
+
function Gn({ value: e, defaultValue: n, onChange: t, max: r = 5, disabled: l, className: s }) {
|
|
1403
|
+
const [c, o] = V({
|
|
1404
|
+
value: e,
|
|
1405
|
+
defaultValue: n ?? 0,
|
|
1406
|
+
onChange: t
|
|
1407
|
+
});
|
|
1408
|
+
return /* @__PURE__ */ a("div", { className: f("d-inline-flex gap-1", s), role: "radiogroup", "aria-label": "Rating", children: Array.from({ length: r }, (i, d) => d + 1).map((i) => /* @__PURE__ */ a(
|
|
1409
|
+
"button",
|
|
1410
|
+
{
|
|
1411
|
+
type: "button",
|
|
1412
|
+
className: "btn btn-link p-0 border-0",
|
|
1413
|
+
disabled: l,
|
|
1414
|
+
role: "radio",
|
|
1415
|
+
"aria-checked": i === c,
|
|
1416
|
+
"aria-label": `${i} star${i > 1 ? "s" : ""}`,
|
|
1417
|
+
onClick: () => o(i),
|
|
1418
|
+
children: /* @__PURE__ */ a("span", { "aria-hidden": "true", style: { fontSize: "1.25rem", color: i <= c ? "#f5b301" : "#ced4da" }, children: "★" })
|
|
1419
|
+
},
|
|
1420
|
+
i
|
|
1421
|
+
)) });
|
|
1422
|
+
}
|
|
1423
|
+
function _n({ value: e, variant: n = "primary", label: t, className: r }) {
|
|
1424
|
+
const l = Math.max(0, Math.min(100, e));
|
|
1425
|
+
return /* @__PURE__ */ a("div", { className: f("progress", r), role: "progressbar", "aria-valuenow": l, "aria-valuemin": 0, "aria-valuemax": 100, children: /* @__PURE__ */ a("div", { className: f("progress-bar", `bg-${n}`), style: { width: `${l}%` }, children: t ? `${Math.round(l)}%` : null }) });
|
|
1426
|
+
}
|
|
1427
|
+
const He = {
|
|
1428
|
+
sm: "0.875em",
|
|
1429
|
+
lg: "1.5em",
|
|
1430
|
+
xl: "2em"
|
|
1431
|
+
};
|
|
1432
|
+
function Jn({ name: e, size: n, className: t, label: r }) {
|
|
1433
|
+
return /* @__PURE__ */ a(
|
|
1434
|
+
"i",
|
|
1435
|
+
{
|
|
1436
|
+
className: f(e, t),
|
|
1437
|
+
style: n ? { fontSize: He[n] } : void 0,
|
|
1438
|
+
role: r ? "img" : void 0,
|
|
1439
|
+
"aria-label": r,
|
|
1440
|
+
"aria-hidden": r ? void 0 : !0
|
|
1441
|
+
}
|
|
1442
|
+
);
|
|
1443
|
+
}
|
|
1444
|
+
function Yn({ brand: e, start: n, end: t, variant: r = "light", className: l }) {
|
|
1445
|
+
return /* @__PURE__ */ a(
|
|
1446
|
+
"nav",
|
|
1447
|
+
{
|
|
1448
|
+
className: f(
|
|
1449
|
+
"navbar navbar-expand-lg border-bottom",
|
|
1450
|
+
r === "dark" ? "navbar-dark bg-dark" : "navbar-light bg-light",
|
|
1451
|
+
l
|
|
1452
|
+
),
|
|
1453
|
+
children: /* @__PURE__ */ p("div", { className: "container-fluid", children: [
|
|
1454
|
+
e && /* @__PURE__ */ a("span", { className: "navbar-brand mb-0", children: e }),
|
|
1455
|
+
n && /* @__PURE__ */ a("div", { className: "d-flex align-items-center gap-3", children: n }),
|
|
1456
|
+
t && /* @__PURE__ */ a("div", { className: "d-flex align-items-center gap-3 ms-auto", children: t })
|
|
1457
|
+
] })
|
|
1458
|
+
}
|
|
1459
|
+
);
|
|
1460
|
+
}
|
|
1461
|
+
function qe(e) {
|
|
1462
|
+
return "items" in e;
|
|
1463
|
+
}
|
|
1464
|
+
function se({ item: e }) {
|
|
1465
|
+
return /* @__PURE__ */ p(
|
|
1466
|
+
"a",
|
|
1467
|
+
{
|
|
1468
|
+
href: e.href ?? "#",
|
|
1469
|
+
className: f("nav-link d-flex align-items-center gap-2", e.active && "active", e.disabled && "disabled"),
|
|
1470
|
+
"aria-current": e.active ? "page" : void 0,
|
|
1471
|
+
"aria-disabled": e.disabled,
|
|
1472
|
+
onClick: (n) => {
|
|
1473
|
+
var t;
|
|
1474
|
+
e.href || n.preventDefault(), !e.disabled && ((t = e.onClick) == null || t.call(e));
|
|
1475
|
+
},
|
|
1476
|
+
children: [
|
|
1477
|
+
e.icon,
|
|
1478
|
+
e.label
|
|
1479
|
+
]
|
|
1480
|
+
}
|
|
1481
|
+
);
|
|
1482
|
+
}
|
|
1483
|
+
function zn({ sections: e, header: n, footer: t, className: r }) {
|
|
1484
|
+
return /* @__PURE__ */ p("div", { className: f("d-flex flex-column h-100", r), children: [
|
|
1485
|
+
n && /* @__PURE__ */ a("div", { className: "p-3 border-bottom", children: n }),
|
|
1486
|
+
/* @__PURE__ */ a("nav", { className: "nav flex-column flex-grow-1 p-2 gap-1", children: e.map(
|
|
1487
|
+
(l) => qe(l) ? /* @__PURE__ */ a(
|
|
1488
|
+
Le,
|
|
1489
|
+
{
|
|
1490
|
+
className: "border-0",
|
|
1491
|
+
defaultOpenKeys: l.defaultOpen ? [l.key] : [],
|
|
1492
|
+
items: [
|
|
1493
|
+
{
|
|
1494
|
+
key: l.key,
|
|
1495
|
+
header: l.label,
|
|
1496
|
+
content: /* @__PURE__ */ a("div", { className: "nav flex-column ps-2 gap-1", children: l.items.map((s) => /* @__PURE__ */ a(se, { item: s }, s.key)) })
|
|
1497
|
+
}
|
|
1498
|
+
]
|
|
1499
|
+
},
|
|
1500
|
+
l.key
|
|
1501
|
+
) : /* @__PURE__ */ a(se, { item: l }, l.key)
|
|
1502
|
+
) }),
|
|
1503
|
+
t && /* @__PURE__ */ a("div", { className: "p-3 border-top", children: t })
|
|
1504
|
+
] });
|
|
1505
|
+
}
|
|
1506
|
+
function Zn({ title: e, description: n, breadcrumbItems: t, actions: r, className: l }) {
|
|
1507
|
+
return /* @__PURE__ */ p("div", { className: f("mb-4", l), children: [
|
|
1508
|
+
t && t.length > 0 && /* @__PURE__ */ a(Ke, { items: t, className: "mb-2" }),
|
|
1509
|
+
/* @__PURE__ */ p("div", { className: "d-flex align-items-start justify-content-between gap-3 flex-wrap", children: [
|
|
1510
|
+
/* @__PURE__ */ p("div", { children: [
|
|
1511
|
+
/* @__PURE__ */ a("h1", { className: "h3 mb-1", children: e }),
|
|
1512
|
+
n && /* @__PURE__ */ a("p", { className: "text-body-secondary mb-0", children: n })
|
|
1513
|
+
] }),
|
|
1514
|
+
r && /* @__PURE__ */ a("div", { className: "d-flex align-items-center gap-2", children: r })
|
|
1515
|
+
] })
|
|
1516
|
+
] });
|
|
1517
|
+
}
|
|
1518
|
+
class Ue extends Error {
|
|
1519
|
+
constructor(n, t, r) {
|
|
1520
|
+
super(`HTTP ${n} ${t} for ${r}`), this.name = "HttpError", this.status = n, this.statusText = t, this.url = r;
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
function Ge(e) {
|
|
1524
|
+
if (!e)
|
|
1525
|
+
return "";
|
|
1526
|
+
const n = new URLSearchParams();
|
|
1527
|
+
for (const [r, l] of Object.entries(e))
|
|
1528
|
+
l != null && n.set(r, String(l));
|
|
1529
|
+
const t = n.toString();
|
|
1530
|
+
return t ? `?${t}` : "";
|
|
1531
|
+
}
|
|
1532
|
+
function _e(e = {}) {
|
|
1533
|
+
const { baseUrl: n = "", fetcher: t = fetch, buildRequestInit: r } = e;
|
|
1534
|
+
return {
|
|
1535
|
+
async get(l, s = {}) {
|
|
1536
|
+
const c = `${n}${l}${Ge(s.params)}`;
|
|
1537
|
+
let o = { method: "GET", signal: s.signal };
|
|
1538
|
+
r && (o = r(c, o));
|
|
1539
|
+
const i = await t(c, o);
|
|
1540
|
+
if (!i.ok)
|
|
1541
|
+
throw new Ue(i.status, i.statusText, c);
|
|
1542
|
+
return await i.json();
|
|
1543
|
+
}
|
|
1544
|
+
};
|
|
1545
|
+
}
|
|
1546
|
+
const Je = _e();
|
|
1547
|
+
function Ye(e) {
|
|
1548
|
+
return Object.keys(e).sort().reduce((n, t) => (n[t] = e[t], n), {});
|
|
1549
|
+
}
|
|
1550
|
+
function z({
|
|
1551
|
+
client: e = Je,
|
|
1552
|
+
url: n,
|
|
1553
|
+
params: t,
|
|
1554
|
+
mapResponse: r,
|
|
1555
|
+
enabled: l = !0
|
|
1556
|
+
}) {
|
|
1557
|
+
const [s, c] = T("idle"), [o, i] = T([]), [d, u] = T(null), [h, m] = T(0), b = W(() => t ? JSON.stringify(Ye(t)) : "", [t]), v = M(0), x = M(r);
|
|
1558
|
+
x.current = r, B(() => {
|
|
1559
|
+
if (!l || !n) {
|
|
1560
|
+
c("idle"), i([]), u(null);
|
|
1561
|
+
return;
|
|
1562
|
+
}
|
|
1563
|
+
const g = ++v.current, w = new AbortController();
|
|
1564
|
+
return c("loading"), u(null), e.get(n, { params: t, signal: w.signal }).then((y) => {
|
|
1565
|
+
if (g !== v.current)
|
|
1566
|
+
return;
|
|
1567
|
+
const S = x.current(y);
|
|
1568
|
+
i(S), c(S.length === 0 ? "empty" : "success");
|
|
1569
|
+
}).catch((y) => {
|
|
1570
|
+
g === v.current && (y instanceof DOMException && y.name === "AbortError" || (u(y instanceof Error ? y : new Error(String(y))), c("error")));
|
|
1571
|
+
}), () => {
|
|
1572
|
+
w.abort();
|
|
1573
|
+
};
|
|
1574
|
+
}, [e, n, b, l, h]);
|
|
1575
|
+
const N = R(() => m((g) => g + 1), []);
|
|
1576
|
+
return { state: s, items: o, error: d, reload: N };
|
|
1577
|
+
}
|
|
1578
|
+
function ze(e, n) {
|
|
1579
|
+
const [t, r] = T(e);
|
|
1580
|
+
return B(() => {
|
|
1581
|
+
const l = setTimeout(() => r(e), n);
|
|
1582
|
+
return () => clearTimeout(l);
|
|
1583
|
+
}, [e, n]), t;
|
|
1584
|
+
}
|
|
1585
|
+
function Z(e) {
|
|
1586
|
+
if (Array.isArray(e))
|
|
1587
|
+
return e;
|
|
1588
|
+
if (e && typeof e == "object" && Array.isArray(e.items))
|
|
1589
|
+
return e.items;
|
|
1590
|
+
throw new Error(
|
|
1591
|
+
"Unable to normalize remote response into an array. Provide an explicit `mapResponse` for this endpoint's response shape."
|
|
1592
|
+
);
|
|
1593
|
+
}
|
|
1594
|
+
function ne(e, n, t) {
|
|
1595
|
+
if (e === null || typeof e != "object")
|
|
1596
|
+
throw new Error("Remote item is not an object; cannot read valueMember/displayMember from it.");
|
|
1597
|
+
const r = e;
|
|
1598
|
+
return {
|
|
1599
|
+
value: r[n],
|
|
1600
|
+
label: String(r[t] ?? "")
|
|
1601
|
+
};
|
|
1602
|
+
}
|
|
1603
|
+
function Ze({
|
|
1604
|
+
url: e,
|
|
1605
|
+
params: n,
|
|
1606
|
+
valueMember: t,
|
|
1607
|
+
displayMember: r,
|
|
1608
|
+
mapResponse: l,
|
|
1609
|
+
client: s,
|
|
1610
|
+
enabled: c,
|
|
1611
|
+
...o
|
|
1612
|
+
}) {
|
|
1613
|
+
const { state: i, items: d, error: u } = z({
|
|
1614
|
+
client: s,
|
|
1615
|
+
url: e,
|
|
1616
|
+
params: n,
|
|
1617
|
+
enabled: c,
|
|
1618
|
+
mapResponse: (m) => (l ? l(m) : Z(m)).map((v) => ne(v, t, r))
|
|
1619
|
+
}), h = o.error ?? (i === "error" ? (u == null ? void 0 : u.message) ?? "Failed to load options" : void 0);
|
|
1620
|
+
return /* @__PURE__ */ a(Ve, { ...o, options: d, loading: i === "loading", error: h });
|
|
1621
|
+
}
|
|
1622
|
+
function Qn({
|
|
1623
|
+
url: e,
|
|
1624
|
+
params: n,
|
|
1625
|
+
searchParam: t,
|
|
1626
|
+
valueMember: r,
|
|
1627
|
+
displayMember: l,
|
|
1628
|
+
mapResponse: s,
|
|
1629
|
+
minSearchLength: c = 1,
|
|
1630
|
+
debounceMs: o = 300,
|
|
1631
|
+
client: i,
|
|
1632
|
+
inputValue: d,
|
|
1633
|
+
onInputValueChange: u,
|
|
1634
|
+
...h
|
|
1635
|
+
}) {
|
|
1636
|
+
const [m, b] = V({
|
|
1637
|
+
value: d,
|
|
1638
|
+
defaultValue: "",
|
|
1639
|
+
onChange: u
|
|
1640
|
+
}), v = ze(m, o), x = v.length >= c, { state: N, items: g, error: w } = z({
|
|
1641
|
+
client: i,
|
|
1642
|
+
url: e,
|
|
1643
|
+
enabled: x,
|
|
1644
|
+
params: { ...n, [t]: v },
|
|
1645
|
+
mapResponse: (S) => (s ? s(S) : Z(S)).map((C) => ne(C, r, l))
|
|
1646
|
+
}), y = h.error ?? (N === "error" ? (w == null ? void 0 : w.message) ?? "Failed to load suggestions" : void 0);
|
|
1647
|
+
return /* @__PURE__ */ a(
|
|
1648
|
+
Me,
|
|
1649
|
+
{
|
|
1650
|
+
...h,
|
|
1651
|
+
options: g,
|
|
1652
|
+
loading: N === "loading",
|
|
1653
|
+
error: y,
|
|
1654
|
+
inputValue: m,
|
|
1655
|
+
onInputValueChange: b,
|
|
1656
|
+
filter: () => !0
|
|
1657
|
+
}
|
|
1658
|
+
);
|
|
1659
|
+
}
|
|
1660
|
+
function Qe({
|
|
1661
|
+
url: e,
|
|
1662
|
+
params: n,
|
|
1663
|
+
mapResponse: t,
|
|
1664
|
+
getTotalCount: r,
|
|
1665
|
+
pageSize: l = 20,
|
|
1666
|
+
client: s,
|
|
1667
|
+
...c
|
|
1668
|
+
}) {
|
|
1669
|
+
const [o, i] = T(1), [d, u] = T(null), h = W(() => JSON.stringify(n ?? {}), [n]), m = M(!0);
|
|
1670
|
+
B(() => {
|
|
1671
|
+
if (m.current) {
|
|
1672
|
+
m.current = !1;
|
|
1673
|
+
return;
|
|
1674
|
+
}
|
|
1675
|
+
i(1);
|
|
1676
|
+
}, [h]);
|
|
1677
|
+
const b = W(
|
|
1678
|
+
() => ({
|
|
1679
|
+
...n,
|
|
1680
|
+
page: o,
|
|
1681
|
+
pageSize: l,
|
|
1682
|
+
...d ? { sortKey: d.key, sortDirection: d.direction } : {}
|
|
1683
|
+
}),
|
|
1684
|
+
[n, o, l, d]
|
|
1685
|
+
), v = M(void 0), { state: x, items: N, error: g } = z({
|
|
1686
|
+
client: s,
|
|
1687
|
+
url: e,
|
|
1688
|
+
params: b,
|
|
1689
|
+
mapResponse: (C) => (v.current = C, t ? t(C) : Z(C))
|
|
1690
|
+
}), w = v.current !== void 0 ? r == null ? void 0 : r(v.current) : void 0, S = N.length >= l && l > 0 ? o * l + 1 : (o - 1) * l + N.length, k = w ?? S;
|
|
1691
|
+
return /* @__PURE__ */ a(
|
|
1692
|
+
Ae,
|
|
1693
|
+
{
|
|
1694
|
+
...c,
|
|
1695
|
+
rows: N,
|
|
1696
|
+
loading: x === "loading",
|
|
1697
|
+
error: g == null ? void 0 : g.message,
|
|
1698
|
+
page: o,
|
|
1699
|
+
pageSize: l,
|
|
1700
|
+
totalCount: k,
|
|
1701
|
+
onPageChange: i,
|
|
1702
|
+
sort: d,
|
|
1703
|
+
onSortChange: (C) => {
|
|
1704
|
+
u(C), i(1);
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
);
|
|
1708
|
+
}
|
|
1709
|
+
function Wn({
|
|
1710
|
+
url: e,
|
|
1711
|
+
params: n,
|
|
1712
|
+
valueMember: t,
|
|
1713
|
+
displayMember: r,
|
|
1714
|
+
mapResponse: l,
|
|
1715
|
+
client: s,
|
|
1716
|
+
enabled: c,
|
|
1717
|
+
...o
|
|
1718
|
+
}) {
|
|
1719
|
+
const { state: i, items: d, error: u } = z({
|
|
1720
|
+
client: s,
|
|
1721
|
+
url: e,
|
|
1722
|
+
params: n,
|
|
1723
|
+
enabled: c,
|
|
1724
|
+
mapResponse: (m) => (l ? l(m) : Z(m)).map((v) => ne(v, t, r))
|
|
1725
|
+
}), h = o.error ?? (i === "error" ? (u == null ? void 0 : u.message) ?? "Failed to load options" : void 0);
|
|
1726
|
+
return /* @__PURE__ */ a(Ce, { ...o, options: d, loading: i === "loading", error: h });
|
|
1727
|
+
}
|
|
1728
|
+
function Xn({
|
|
1729
|
+
url: e,
|
|
1730
|
+
params: n,
|
|
1731
|
+
valueMember: t,
|
|
1732
|
+
displayMember: r,
|
|
1733
|
+
mapResponse: l,
|
|
1734
|
+
client: s,
|
|
1735
|
+
enabled: c,
|
|
1736
|
+
...o
|
|
1737
|
+
}) {
|
|
1738
|
+
const { state: i, items: d, error: u } = z({
|
|
1739
|
+
client: s,
|
|
1740
|
+
url: e,
|
|
1741
|
+
params: n,
|
|
1742
|
+
enabled: c,
|
|
1743
|
+
mapResponse: (m) => (l ? l(m) : Z(m)).map((v) => ne(v, t, r))
|
|
1744
|
+
}), h = o.error ?? (i === "error" ? (u == null ? void 0 : u.message) ?? "Failed to load options" : void 0);
|
|
1745
|
+
return /* @__PURE__ */ a(Ie, { ...o, options: d, loading: i === "loading", error: h });
|
|
1746
|
+
}
|
|
1747
|
+
function et() {
|
|
1748
|
+
const e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set();
|
|
1749
|
+
return {
|
|
1750
|
+
register(t, r) {
|
|
1751
|
+
e.set(t, r);
|
|
1752
|
+
},
|
|
1753
|
+
resolve(t, r) {
|
|
1754
|
+
const l = e.get(t.component);
|
|
1755
|
+
return l ? l(t, r) : (n.has(t.component) || (n.add(t.component), console.warn(
|
|
1756
|
+
`Smart: no resolver registered for component "${t.component}" (field "${t.name}"). Skipping.`
|
|
1757
|
+
)), null);
|
|
1758
|
+
},
|
|
1759
|
+
has(t) {
|
|
1760
|
+
return e.has(t);
|
|
1761
|
+
}
|
|
1762
|
+
};
|
|
1763
|
+
}
|
|
1764
|
+
function nt(e) {
|
|
1765
|
+
const n = new Map(Object.entries(e ?? {}));
|
|
1766
|
+
return {
|
|
1767
|
+
register(t, r) {
|
|
1768
|
+
n.set(t, r);
|
|
1769
|
+
},
|
|
1770
|
+
resolve(t) {
|
|
1771
|
+
return n.get(t);
|
|
1772
|
+
}
|
|
1773
|
+
};
|
|
1774
|
+
}
|
|
1775
|
+
function tt() {
|
|
1776
|
+
const e = /* @__PURE__ */ new Map();
|
|
1777
|
+
return {
|
|
1778
|
+
register(n, t) {
|
|
1779
|
+
e.set(n, t);
|
|
1780
|
+
},
|
|
1781
|
+
resolve(n) {
|
|
1782
|
+
return e.get(n);
|
|
1783
|
+
}
|
|
1784
|
+
};
|
|
1785
|
+
}
|
|
1786
|
+
function We(e) {
|
|
1787
|
+
return "dataSource" in e;
|
|
1788
|
+
}
|
|
1789
|
+
function Xe(e, n) {
|
|
1790
|
+
if (!e)
|
|
1791
|
+
return;
|
|
1792
|
+
const t = {};
|
|
1793
|
+
for (const [r, l] of Object.entries(e))
|
|
1794
|
+
t[r] = l.kind === "static" ? l.value : n[l.field];
|
|
1795
|
+
return t;
|
|
1796
|
+
}
|
|
1797
|
+
function ie(e, n, t) {
|
|
1798
|
+
return n && t ? t(n) : e;
|
|
1799
|
+
}
|
|
1800
|
+
function Q(e, n) {
|
|
1801
|
+
const { values: t, translate: r } = n;
|
|
1802
|
+
return {
|
|
1803
|
+
metadata: e,
|
|
1804
|
+
visible: e.visible ?? !0,
|
|
1805
|
+
readOnly: e.readOnly ?? !1,
|
|
1806
|
+
disabled: e.disabled ?? !1,
|
|
1807
|
+
required: e.required ?? !1,
|
|
1808
|
+
label: ie(e.label, e.labelKey, r),
|
|
1809
|
+
placeholder: e.placeholder,
|
|
1810
|
+
helpText: e.helpText,
|
|
1811
|
+
validationMessage: ie(e.validationMessage, e.validationMessageKey, r),
|
|
1812
|
+
params: We(e) ? Xe(e.dataSource.params, t) : void 0
|
|
1813
|
+
};
|
|
1814
|
+
}
|
|
1815
|
+
function rt(e, n, t) {
|
|
1816
|
+
const r = n == null ? void 0 : n.fields.find((l) => l.name === e);
|
|
1817
|
+
if (r)
|
|
1818
|
+
return Q(r, t);
|
|
1819
|
+
}
|
|
1820
|
+
const en = [];
|
|
1821
|
+
function nn(e, n) {
|
|
1822
|
+
const t = {};
|
|
1823
|
+
for (const r of n)
|
|
1824
|
+
t[r] = e[r];
|
|
1825
|
+
return t;
|
|
1826
|
+
}
|
|
1827
|
+
function tn(e, n, t) {
|
|
1828
|
+
const r = e ?? en, l = nn(n, r), s = r.length === 0 ? "" : JSON.stringify(l), c = M(null), o = M(t);
|
|
1829
|
+
o.current = t, B(() => {
|
|
1830
|
+
var d;
|
|
1831
|
+
if (r.length === 0)
|
|
1832
|
+
return;
|
|
1833
|
+
const i = c.current;
|
|
1834
|
+
if (i && i.key !== s)
|
|
1835
|
+
for (const u of r)
|
|
1836
|
+
Object.is(i.snapshot[u], l[u]) || (d = o.current) == null || d.call(o, u);
|
|
1837
|
+
c.current = { key: s, snapshot: l };
|
|
1838
|
+
}, [s]);
|
|
1839
|
+
}
|
|
1840
|
+
function ye(e, n) {
|
|
1841
|
+
const { actions: t, translate: r } = n, l = t.resolve(e.id);
|
|
1842
|
+
return {
|
|
1843
|
+
metadata: e,
|
|
1844
|
+
visible: e.visible ?? !0,
|
|
1845
|
+
enabled: (e.enabled ?? !0) && !!l,
|
|
1846
|
+
label: e.labelKey && r ? r(e.labelKey) : e.label,
|
|
1847
|
+
handler: l
|
|
1848
|
+
};
|
|
1849
|
+
}
|
|
1850
|
+
function lt(e, n, t) {
|
|
1851
|
+
var l;
|
|
1852
|
+
const r = (l = n == null ? void 0 : n.actions) == null ? void 0 : l.find((s) => s.id === e);
|
|
1853
|
+
if (r)
|
|
1854
|
+
return ye(r, t);
|
|
1855
|
+
}
|
|
1856
|
+
const rn = (e, n) => {
|
|
1857
|
+
const t = Q(e, { values: n.values, translate: n.translate });
|
|
1858
|
+
if (!t.visible)
|
|
1859
|
+
return null;
|
|
1860
|
+
const r = n.dataSources.resolve(e.dataSource.id);
|
|
1861
|
+
return r ? /* @__PURE__ */ a(
|
|
1862
|
+
Ze,
|
|
1863
|
+
{
|
|
1864
|
+
label: t.label,
|
|
1865
|
+
url: r.url,
|
|
1866
|
+
client: r.client,
|
|
1867
|
+
params: t.params,
|
|
1868
|
+
valueMember: e.valueMember,
|
|
1869
|
+
displayMember: e.displayMember,
|
|
1870
|
+
required: t.required,
|
|
1871
|
+
readOnly: t.readOnly,
|
|
1872
|
+
disabled: t.disabled,
|
|
1873
|
+
helpText: t.helpText,
|
|
1874
|
+
error: t.validationMessage,
|
|
1875
|
+
value: n.values[e.name] ?? null,
|
|
1876
|
+
onChange: (l) => n.onFieldChange(e.name, l)
|
|
1877
|
+
}
|
|
1878
|
+
) : (console.warn(`Smart: no data source registered for id "${e.dataSource.id}" (field "${e.name}"). Skipping.`), null);
|
|
1879
|
+
}, ln = {
|
|
1880
|
+
text: (e) => e == null ? "" : String(e),
|
|
1881
|
+
boolean: (e, n) => n ? n(e ? "smart.boolean.true" : "smart.boolean.false") : e ? "Yes" : "No",
|
|
1882
|
+
date: (e) => {
|
|
1883
|
+
if (e == null || e === "")
|
|
1884
|
+
return "";
|
|
1885
|
+
const n = e instanceof Date ? e : new Date(String(e));
|
|
1886
|
+
return Number.isNaN(n.getTime()) ? String(e) : n.toLocaleDateString();
|
|
1887
|
+
},
|
|
1888
|
+
currency: (e) => {
|
|
1889
|
+
const n = Number(e);
|
|
1890
|
+
return Number.isFinite(n) ? n.toLocaleString(void 0, { style: "currency", currency: "USD" }) : String(e ?? "");
|
|
1891
|
+
}
|
|
1892
|
+
};
|
|
1893
|
+
function an(e, n) {
|
|
1894
|
+
if (e.visible === !1)
|
|
1895
|
+
return null;
|
|
1896
|
+
const t = e.headerKey && n ? n(e.headerKey) : e.header ?? e.key, r = e.format ? ln[e.format] : void 0;
|
|
1897
|
+
return {
|
|
1898
|
+
key: e.key,
|
|
1899
|
+
header: t,
|
|
1900
|
+
sortable: e.sortable,
|
|
1901
|
+
render: r ? (l) => r(l[e.key], n) : void 0
|
|
1902
|
+
};
|
|
1903
|
+
}
|
|
1904
|
+
const sn = (e, n) => {
|
|
1905
|
+
const t = Q(e, { values: n.values, translate: n.translate });
|
|
1906
|
+
if (!t.visible)
|
|
1907
|
+
return null;
|
|
1908
|
+
const r = n.dataSources.resolve(e.dataSource.id);
|
|
1909
|
+
if (!r)
|
|
1910
|
+
return console.warn(`Smart: no data source registered for id "${e.dataSource.id}" (field "${e.name}"). Skipping.`), null;
|
|
1911
|
+
const l = e.columns.map((o) => an(o, n.translate)).filter((o) => o !== null), s = e.totalCountField, c = s ? (o) => {
|
|
1912
|
+
const i = o == null ? void 0 : o[s];
|
|
1913
|
+
return typeof i == "number" ? i : void 0;
|
|
1914
|
+
} : void 0;
|
|
1915
|
+
return /* @__PURE__ */ a(
|
|
1916
|
+
Qe,
|
|
1917
|
+
{
|
|
1918
|
+
url: r.url,
|
|
1919
|
+
client: r.client,
|
|
1920
|
+
params: t.params,
|
|
1921
|
+
columns: l,
|
|
1922
|
+
rowKey: (o) => o[e.rowKey],
|
|
1923
|
+
getTotalCount: c
|
|
1924
|
+
}
|
|
1925
|
+
);
|
|
1926
|
+
};
|
|
1927
|
+
function oe(e) {
|
|
1928
|
+
if (!e)
|
|
1929
|
+
return;
|
|
1930
|
+
const n = new Date(e);
|
|
1931
|
+
return Number.isNaN(n.getTime()) ? void 0 : n;
|
|
1932
|
+
}
|
|
1933
|
+
const on = (e, n) => {
|
|
1934
|
+
const t = Q(e, { values: n.values, translate: n.translate });
|
|
1935
|
+
return t.visible ? /* @__PURE__ */ a(
|
|
1936
|
+
De,
|
|
1937
|
+
{
|
|
1938
|
+
label: t.label,
|
|
1939
|
+
required: t.required,
|
|
1940
|
+
readOnly: t.readOnly,
|
|
1941
|
+
disabled: t.disabled,
|
|
1942
|
+
helpText: t.helpText,
|
|
1943
|
+
error: t.validationMessage,
|
|
1944
|
+
min: oe(e.minDate),
|
|
1945
|
+
max: oe(e.maxDate),
|
|
1946
|
+
value: n.values[e.name] ?? null,
|
|
1947
|
+
onChange: (r) => n.onFieldChange(e.name, r)
|
|
1948
|
+
}
|
|
1949
|
+
) : null;
|
|
1950
|
+
}, cn = (e, n) => {
|
|
1951
|
+
const t = Q(e, { values: n.values, translate: n.translate });
|
|
1952
|
+
return t.visible ? /* @__PURE__ */ a(
|
|
1953
|
+
Y,
|
|
1954
|
+
{
|
|
1955
|
+
label: t.label,
|
|
1956
|
+
required: t.required,
|
|
1957
|
+
readOnly: t.readOnly,
|
|
1958
|
+
disabled: t.disabled,
|
|
1959
|
+
helpText: t.helpText,
|
|
1960
|
+
placeholder: t.placeholder,
|
|
1961
|
+
error: t.validationMessage,
|
|
1962
|
+
maxLength: e.maxLength,
|
|
1963
|
+
value: n.values[e.name] ?? "",
|
|
1964
|
+
onChange: (r) => n.onFieldChange(e.name, r)
|
|
1965
|
+
}
|
|
1966
|
+
) : null;
|
|
1967
|
+
};
|
|
1968
|
+
function at(e) {
|
|
1969
|
+
e.register("Input", cn), e.register("ComboBox", rn), e.register("DatePicker", on), e.register("DataGrid", sn);
|
|
1970
|
+
}
|
|
1971
|
+
function dn({ metadata: e, ctx: n }) {
|
|
1972
|
+
const t = n.onMetadataRefreshNeeded;
|
|
1973
|
+
return tn(
|
|
1974
|
+
e.dependsOn,
|
|
1975
|
+
n.values,
|
|
1976
|
+
t ? (r) => t(e.name, r) : void 0
|
|
1977
|
+
), e.visible === !1 ? null : n.registry.resolve(e, n);
|
|
1978
|
+
}
|
|
1979
|
+
const Ne = 1;
|
|
1980
|
+
function un(e) {
|
|
1981
|
+
const n = Number(e.split(".")[0]);
|
|
1982
|
+
return Number.isFinite(n) && n === Ne;
|
|
1983
|
+
}
|
|
1984
|
+
function st({ metadata: e, ctx: n }) {
|
|
1985
|
+
return un(e.schemaVersion) ? /* @__PURE__ */ a(X, { children: e.fields.map((t) => /* @__PURE__ */ a(dn, { metadata: t, ctx: n }, t.name)) }) : /* @__PURE__ */ p(ve, { variant: "danger", children: [
|
|
1986
|
+
'Unsupported form schema version "',
|
|
1987
|
+
e.schemaVersion,
|
|
1988
|
+
'" — this app understands schema version ',
|
|
1989
|
+
Ne,
|
|
1990
|
+
".x."
|
|
1991
|
+
] });
|
|
1992
|
+
}
|
|
1993
|
+
function fn({ metadata: e, ctx: n }) {
|
|
1994
|
+
const t = ye(e, n);
|
|
1995
|
+
return t.visible ? /* @__PURE__ */ a(re, { disabled: !t.enabled, onClick: () => {
|
|
1996
|
+
var r;
|
|
1997
|
+
return (r = t.handler) == null ? void 0 : r.call(t);
|
|
1998
|
+
}, children: t.label ?? e.id }) : null;
|
|
1999
|
+
}
|
|
2000
|
+
function it({ metadata: e, ctx: n }) {
|
|
2001
|
+
return !e.actions || e.actions.length === 0 ? null : /* @__PURE__ */ a(X, { children: e.actions.map((t) => /* @__PURE__ */ a(fn, { metadata: t, ctx: n }, t.id)) });
|
|
2002
|
+
}
|
|
2003
|
+
export {
|
|
2004
|
+
Le as Accordion,
|
|
2005
|
+
ve as Alert,
|
|
2006
|
+
Me as AutoComplete,
|
|
2007
|
+
Bn as Avatar,
|
|
2008
|
+
Tn as Badge,
|
|
2009
|
+
Ke as Breadcrumb,
|
|
2010
|
+
re as Button,
|
|
2011
|
+
$n as Card,
|
|
2012
|
+
yn as CheckBox,
|
|
2013
|
+
Ln as Col,
|
|
2014
|
+
Ve as ComboBox,
|
|
2015
|
+
Dn as ConfirmProvider,
|
|
2016
|
+
Pn as Container,
|
|
2017
|
+
Ae as DataGrid,
|
|
2018
|
+
De as DatePicker,
|
|
2019
|
+
kn as DateTimePicker,
|
|
2020
|
+
On as Divider,
|
|
2021
|
+
gn as FileInput,
|
|
2022
|
+
Sn as FormField,
|
|
2023
|
+
Ue as HttpError,
|
|
2024
|
+
Jn as Icon,
|
|
2025
|
+
Y as Input,
|
|
2026
|
+
ke as Label,
|
|
2027
|
+
Kn as Menu,
|
|
2028
|
+
Ee as Modal,
|
|
2029
|
+
Ie as MultiSelect,
|
|
2030
|
+
Yn as Navbar,
|
|
2031
|
+
vn as NumberInput,
|
|
2032
|
+
Zn as PageHeader,
|
|
2033
|
+
$e as Pagination,
|
|
2034
|
+
pn as PasswordInput,
|
|
2035
|
+
Rn as Popover,
|
|
2036
|
+
G as Popup,
|
|
2037
|
+
_n as ProgressBar,
|
|
2038
|
+
Se as RadioButton,
|
|
2039
|
+
wn as RadioGroup,
|
|
2040
|
+
Gn as Rating,
|
|
2041
|
+
Qn as RemoteAutoComplete,
|
|
2042
|
+
Ze as RemoteComboBox,
|
|
2043
|
+
Qe as RemoteDataGrid,
|
|
2044
|
+
Xn as RemoteMultiSelect,
|
|
2045
|
+
Wn as RemoteSelect,
|
|
2046
|
+
Fn as Row,
|
|
2047
|
+
Ce as Select,
|
|
2048
|
+
zn as Sidebar,
|
|
2049
|
+
qn as Skeleton,
|
|
2050
|
+
Un as Slider,
|
|
2051
|
+
fn as SmartAction,
|
|
2052
|
+
it as SmartActions,
|
|
2053
|
+
dn as SmartField,
|
|
2054
|
+
st as SmartForm,
|
|
2055
|
+
Pe as Spinner,
|
|
2056
|
+
An as Stack,
|
|
2057
|
+
jn as Stepper,
|
|
2058
|
+
Nn as Switch,
|
|
2059
|
+
Mn as Tabs,
|
|
2060
|
+
Hn as Tag,
|
|
2061
|
+
bn as TextArea,
|
|
2062
|
+
xn as TimePicker,
|
|
2063
|
+
Cn as ToastProvider,
|
|
2064
|
+
En as Tooltip,
|
|
2065
|
+
ue as ValidationMessage,
|
|
2066
|
+
rn as comboBoxResolver,
|
|
2067
|
+
_e as createHttpClient,
|
|
2068
|
+
tt as createSmartActionRegistry,
|
|
2069
|
+
et as createSmartComponentRegistry,
|
|
2070
|
+
nt as createSmartDataSourceRegistry,
|
|
2071
|
+
sn as dataGridResolver,
|
|
2072
|
+
on as datePickerResolver,
|
|
2073
|
+
Z as defaultArrayNormalization,
|
|
2074
|
+
Je as defaultHttpClient,
|
|
2075
|
+
me as fromDateInputValue,
|
|
2076
|
+
be as fromTimeInputValue,
|
|
2077
|
+
cn as inputResolver,
|
|
2078
|
+
at as registerBuiltInResolvers,
|
|
2079
|
+
ye as resolveSmartActionMetadata,
|
|
2080
|
+
Q as resolveSmartFieldMetadata,
|
|
2081
|
+
H as toDateInputValue,
|
|
2082
|
+
ne as toSelectOption,
|
|
2083
|
+
he as toTimeInputValue,
|
|
2084
|
+
Vn as useConfirm,
|
|
2085
|
+
ze as useDebouncedValue,
|
|
2086
|
+
z as useRemoteData,
|
|
2087
|
+
lt as useSmartAction,
|
|
2088
|
+
tn as useSmartDependencies,
|
|
2089
|
+
rt as useSmartField,
|
|
2090
|
+
In as useToast
|
|
2091
|
+
};
|
|
2092
|
+
//# sourceMappingURL=index.js.map
|