@opengis/filter 0.0.13 → 0.0.14

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/dist/filter.js ADDED
@@ -0,0 +1,2744 @@
1
+ import { defineComponent as O, ref as _, createElementBlock as w, openBlock as f, createElementVNode as u, withModifiers as _e, normalizeClass as D, createCommentVNode as V, toDisplayString as F, computed as I, watch as M, createStaticVNode as Le, Fragment as R, renderList as W, unref as e, createBlock as S, createVNode as N, createTextVNode as z, withDirectives as T, vShow as X, vModelText as G, onMounted as ne, onBeforeUnmount as ce, Teleport as $e, normalizeStyle as Ae, renderSlot as ue, nextTick as fe, isRef as Ee, withCtx as le, resolveDynamicComponent as ee, mergeProps as P, toRaw as Z, cloneVNode as Ie, useSlots as pe } from "vue";
2
+ const Te = { class: "flex items-center justify-between w-full text-sm" }, Oe = { class: "flex items-center cursor-pointer w-full" }, Ue = {
3
+ key: 0,
4
+ width: "16",
5
+ height: "auto",
6
+ src: "data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PScwIDAgMTYgMTYnIGZpbGw9J3doaXRlJyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnPjxwYXRoIGQ9J00xMi4yMDcgNC43OTNhMSAxIDAgMDEwIDEuNDE0bC01IDVhMSAxIDAgMDEtMS40MTQgMGwtMi0yYTEgMSAwIDAxMS40MTQtMS40MTRMNi41IDkuMDg2bDQuMjkzLTQuMjkzYTEgMSAwIDAxMS40MTQgMHonLz48L3N2Zz4="
7
+ }, ze = ["value"], Ne = { class: "w-[calc(100%-18px)] flex flex-row items-center justify-between pl-[10px]" }, He = { class: "flex flex-row items-center font-normal text-gray-800 gap-x-1" }, Ye = {
8
+ key: 0,
9
+ class: "text-xs text-gray-500 dark:text-neutral-500 pr-1"
10
+ }, me = /* @__PURE__ */ O({
11
+ __name: "list-item",
12
+ props: {
13
+ layout: {},
14
+ count: {},
15
+ type: {},
16
+ label: {},
17
+ value: {},
18
+ isSelected: { type: Boolean },
19
+ color: {},
20
+ highlighted: { type: Boolean }
21
+ },
22
+ emits: ["itemClick"],
23
+ setup(i, { expose: n, emit: v }) {
24
+ const t = i, s = v;
25
+ function r() {
26
+ s("itemClick", t.value);
27
+ }
28
+ const d = _(null);
29
+ return n({ el: d }), (m, c) => (f(), w("div", {
30
+ class: "flex items-center w-full rounded-lg group hover:bg-gray-100",
31
+ ref_key: "el",
32
+ ref: d
33
+ }, [
34
+ u("div", Te, [
35
+ u("div", Oe, [
36
+ u("label", {
37
+ for: "radio-9740",
38
+ class: D([
39
+ ["inline", "popover"].includes(m.layout) ? "text-sm text-gray-500 px-2 w-full py-2 cursor-pointer !flex flex-row items-center" : "flex flex-row items-center w-full px-2 py-2 text-sm text-gray-500 cursor-pointer",
40
+ { "bg-blue-100": m.highlighted }
41
+ ]),
42
+ onClick: _e(r, ["stop", "prevent"])
43
+ }, [
44
+ u("div", {
45
+ class: D(["w-[18px] h-[18px] border flex items-center justify-center", [
46
+ m.type == "checkbox" ? "rounded-[4px]" : "rounded-full",
47
+ m.color ? `bg-[${m.color}] border-[#ffffff]` : m.isSelected ? "bg-[#2563eb] border-[#ffffff]" : "bg-[#ffffff] border-[#d9d9d9]"
48
+ ]])
49
+ }, [
50
+ m.isSelected ? (f(), w("img", Ue)) : V("", !0)
51
+ ], 2),
52
+ u("input", {
53
+ type: "checkbox",
54
+ class: "hidden",
55
+ id: "radio-9740",
56
+ value: m.value
57
+ }, null, 8, ze),
58
+ u("div", Ne, [
59
+ u("span", He, F(m.label ?? "Відсутні данні"), 1),
60
+ m.count ? (f(), w("div", Ye, " (" + F(m.count) + ") ", 1)) : V("", !0)
61
+ ])
62
+ ], 2)
63
+ ])
64
+ ])
65
+ ], 512));
66
+ }
67
+ });
68
+ function Be(i, n) {
69
+ const {
70
+ options: v = [],
71
+ limit: t = 20
72
+ } = i;
73
+ function s(l) {
74
+ return Array.isArray(l) ? l[0] : l;
75
+ }
76
+ const r = _(s(i.modelValue)), d = _(""), m = _(!1), c = _([]), x = _("id"), p = _("text"), a = _(!1), o = _(i.layout !== "popover" && v.length > t);
77
+ function h(l) {
78
+ const b = l.find(Boolean) ?? {}, K = ["id", "value", "code", "key"].find((Y) => Y in b) ?? "id", A = ["text", "label", "name", "title"].find((Y) => Y in b) ?? "text";
79
+ return { autoValueKey: K, autoLabelKey: A };
80
+ }
81
+ if (v.length > 0) {
82
+ const l = h(v);
83
+ x.value = l.autoValueKey, p.value = l.autoLabelKey;
84
+ }
85
+ const g = I(() => {
86
+ const l = c.value;
87
+ return i.layout === "popover" || a.value ? l : l.slice(0, t);
88
+ });
89
+ M(() => i.modelValue, (l) => {
90
+ r.value = s(l);
91
+ }, { immediate: !0 }), c.value = [...v].sort((l, b) => i.sort === "count" ? b.count && l.count ? b.count - l.count : 0 : i.sort === "name" ? String(l[p.value] ?? "").localeCompare(String(b[p.value] ?? "")) : 0);
92
+ function k(l) {
93
+ return r.value === l[x.value];
94
+ }
95
+ function y(l) {
96
+ r.value = l[x.value], n("update:modelValue", r.value), n("change", { name: i.name, value: r.value });
97
+ }
98
+ function $() {
99
+ r.value = void 0, n("update:modelValue", r.value), n("clear", i.name);
100
+ }
101
+ function C() {
102
+ a.value = !a.value;
103
+ }
104
+ return {
105
+ innerValue: r,
106
+ searchTerm: d,
107
+ filteredOptions: g,
108
+ isSelected: k,
109
+ selectItem: y,
110
+ clear: $,
111
+ toggleShowAll: C,
112
+ isReqProc: m,
113
+ showAll: a,
114
+ isEnableShowAll: o,
115
+ labelKey: p,
116
+ valueKey: x,
117
+ allOptions: c
118
+ };
119
+ }
120
+ const J = (i, n) => {
121
+ const v = i.__vccOpts || i;
122
+ for (const [t, s] of n)
123
+ v[t] = s;
124
+ return v;
125
+ }, Pe = {}, We = {
126
+ class: "w-48 mx-auto",
127
+ viewBox: "0 0 178 90",
128
+ fill: "none",
129
+ xmlns: "http://www.w3.org/2000/svg"
130
+ };
131
+ function qe(i, n) {
132
+ return f(), w("svg", We, n[0] || (n[0] = [
133
+ Le('<rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs>', 12)
134
+ ]));
135
+ }
136
+ const ve = /* @__PURE__ */ J(Pe, [["render", qe]]), Qe = {}, Ge = {
137
+ xmlns: "http://www.w3.org/2000/svg",
138
+ width: "24",
139
+ height: "24",
140
+ viewBox: "0 0 24 24",
141
+ fill: "none",
142
+ stroke: "currentColor",
143
+ "stroke-width": "2",
144
+ "stroke-linecap": "round",
145
+ "stroke-linejoin": "round",
146
+ class: "icon icon-tabler icons-tabler-outline icon-tabler-chevron-down w-[14px] rotate"
147
+ };
148
+ function Xe(i, n) {
149
+ return f(), w("svg", Ge, n[0] || (n[0] = [
150
+ u("path", {
151
+ stroke: "none",
152
+ d: "M0 0h24v24H0z",
153
+ fill: "none"
154
+ }, null, -1),
155
+ u("path", { d: "M6 9l6 6l6 -6" }, null, -1)
156
+ ]));
157
+ }
158
+ const ie = /* @__PURE__ */ J(Qe, [["render", Xe]]), Je = {}, Ze = {
159
+ xmlns: "http://www.w3.org/2000/svg",
160
+ width: "24",
161
+ height: "24",
162
+ viewBox: "0 0 24 24",
163
+ fill: "none",
164
+ stroke: "currentColor",
165
+ "stroke-width": "2",
166
+ "stroke-linecap": "round",
167
+ "stroke-linejoin": "round",
168
+ class: "icon icon-tabler icons-tabler-outline icon-tabler-chevron-down w-[14px] rotate-[180deg]"
169
+ };
170
+ function et(i, n) {
171
+ return f(), w("svg", Ze, n[0] || (n[0] = [
172
+ u("path", {
173
+ stroke: "none",
174
+ d: "M0 0h24v24H0z",
175
+ fill: "none"
176
+ }, null, -1),
177
+ u("path", { d: "M6 9l6 6l6 -6" }, null, -1)
178
+ ]));
179
+ }
180
+ const ye = /* @__PURE__ */ J(Je, [["render", et]]), tt = {
181
+ key: 0,
182
+ class: "w-full"
183
+ }, lt = { class: "flex flex-col items-center justify-center p-5 text-center" }, ot = {
184
+ key: 0,
185
+ class: "flex justify-between p-2 border-t bg-gray-50 text-xs text-gray-500"
186
+ }, at = {
187
+ key: 1,
188
+ class: "flex justify-between items-center text-xs text-gray-500 p-1 border-t"
189
+ }, nt = /* @__PURE__ */ O({
190
+ __name: "radio",
191
+ props: {
192
+ id: {},
193
+ name: {},
194
+ type: {},
195
+ label: {},
196
+ width: {},
197
+ options: { default: () => [] },
198
+ placeHolder: {},
199
+ api: {},
200
+ data: {},
201
+ default: {},
202
+ modelValue: {},
203
+ disabled: { type: Boolean, default: !1 },
204
+ layout: { default: "inline" },
205
+ cleanable: { type: Boolean },
206
+ limit: { default: 10 },
207
+ multi: { type: Boolean },
208
+ dataKey: {},
209
+ valueKey: {},
210
+ mode: {},
211
+ labelKey: {},
212
+ sort: {}
213
+ },
214
+ emits: ["update:modelValue", "change", "clear"],
215
+ setup(i, { expose: n, emit: v }) {
216
+ const t = i, s = _(null), r = v, {
217
+ innerValue: d,
218
+ filteredOptions: m,
219
+ isSelected: c,
220
+ selectItem: x,
221
+ clear: p,
222
+ toggleShowAll: a,
223
+ isReqProc: o,
224
+ showAll: h,
225
+ isEnableShowAll: g,
226
+ labelKey: k,
227
+ valueKey: y,
228
+ allOptions: $
229
+ } = Be({
230
+ ...t,
231
+ modelValue: t.modelValue ?? t.default ?? ""
232
+ }, r);
233
+ return n({
234
+ clear: p,
235
+ inputTextRef: s
236
+ }), M(
237
+ () => t.modelValue,
238
+ (C) => {
239
+ C === void 0 && (d.value = void 0);
240
+ }
241
+ ), (C, l) => (f(), w("div", {
242
+ class: D([C.layout === "popover" ? "flex flex-col h-full" : "flex flex-col vs-filter-checkbox"])
243
+ }, [
244
+ u("div", {
245
+ class: D([
246
+ C.layout === "popover" ? "flex-1 overflow-y-auto max-h-64 p-2" : "",
247
+ C.layout === "inline" ? "flex-1 overflow-y-auto max-h-80" : ""
248
+ ])
249
+ }, [
250
+ (f(!0), w(R, null, W(e(m), (b) => (f(), S(me, {
251
+ layout: C.layout,
252
+ key: b[e(y)],
253
+ count: b.count,
254
+ label: b[e(k)],
255
+ color: b.color,
256
+ type: "radio",
257
+ value: b[e(y)],
258
+ "is-selected": e(c)(b),
259
+ onItemClick: (K) => e(x)(b)
260
+ }, null, 8, ["layout", "count", "label", "color", "value", "is-selected", "onItemClick"]))), 128))
261
+ ], 2),
262
+ C.type === "select" && e(m).length === 0 && !e(o) ? (f(), w("div", tt, [
263
+ u("div", lt, [
264
+ N(ve),
265
+ l[4] || (l[4] = u("div", { class: "max-w-sm mx-auto mt-6" }, [
266
+ u("p", { class: "font-medium text-gray-800 dark:text-neutral-200" }, "За вашим запитом нічого не знайдено"),
267
+ u("p", { class: "mt-2 text-sm text-gray-500 dark:text-neutral-500" })
268
+ ], -1))
269
+ ])
270
+ ])) : V("", !0),
271
+ C.layout !== "popover" && C.type !== "select" ? (f(), w(R, { key: 1 }, [
272
+ !e(h) && e(g) ? (f(), w("div", {
273
+ key: 0,
274
+ onClick: l[0] || (l[0] = //@ts-ignore
275
+ (...b) => e(a) && e(a)(...b)),
276
+ class: "inline-flex cursor-pointer items-center gap-x-1.5 text-[13px] text-gray-800 underline underline-offset-4 hover:text-blue-600 focus:outline-none focus:text-blue-600 mt-1 px-2"
277
+ }, [
278
+ l[5] || (l[5] = z(" Показати більше ", -1)),
279
+ N(ie)
280
+ ])) : V("", !0),
281
+ e(h) ? (f(), w("div", {
282
+ key: 1,
283
+ onClick: l[1] || (l[1] = //@ts-ignore
284
+ (...b) => e(a) && e(a)(...b)),
285
+ class: "inline-flex cursor-pointer items-center gap-x-1.5 text-[13px] text-gray-800 underline underline-offset-4 hover:text-blue-600 focus:outline-none focus:text-blue-600 mt-1 px-2"
286
+ }, [
287
+ l[6] || (l[6] = z(" Показати менше ", -1)),
288
+ N(ye)
289
+ ])) : V("", !0)
290
+ ], 64)) : V("", !0),
291
+ C.cleanable ? (f(), w(R, { key: 2 }, [
292
+ C.layout === "inline" ? (f(), w("div", ot, [
293
+ z(F(e(d) || e(d) === null ? 1 : 0) + " з " + F(e($).length) + " обрано ", 1),
294
+ T(u("button", {
295
+ class: "text-gray-600 hover:text-gray-800",
296
+ onClick: l[2] || (l[2] = //@ts-ignore
297
+ (...b) => e(p) && e(p)(...b))
298
+ }, " Очистити ", 512), [
299
+ [X, e(d) !== "" && e(d) !== void 0]
300
+ ])
301
+ ])) : V("", !0),
302
+ C.layout === "popover" ? (f(), w("div", at, [
303
+ u("span", null, F(e(d) || e(d) === null ? 1 : 0) + " з " + F(e($).length) + " обрано", 1),
304
+ T(u("button", {
305
+ class: "text-gray-600 hover:text-gray-800",
306
+ onClick: l[3] || (l[3] = //@ts-ignore
307
+ (...b) => e(p) && e(p)(...b))
308
+ }, " Очистити ", 512), [
309
+ [X, e(d) !== "" && e(d) !== void 0]
310
+ ])
311
+ ])) : V("", !0)
312
+ ], 64)) : V("", !0)
313
+ ], 2));
314
+ }
315
+ });
316
+ function Se(i, n) {
317
+ const {
318
+ options: v = [],
319
+ limit: t = 20
320
+ } = i;
321
+ function s(l) {
322
+ return Array.isArray(l) ? l : l ? [l] : [];
323
+ }
324
+ const r = _(s(i.modelValue)), d = _(""), m = _(!1), c = _([]), x = _("id"), p = _("text"), a = _(!1), o = _(i.layout !== "popover" && v.length > t);
325
+ function h(l) {
326
+ const b = l.find(Boolean) ?? {}, K = ["id", "value", "code", "key"].find((Y) => Y in b) ?? "id", A = ["text", "label", "name", "title"].find((Y) => Y in b) ?? "text";
327
+ return { autoValueKey: K, autoLabelKey: A };
328
+ }
329
+ if (v.length > 0) {
330
+ const l = h(v);
331
+ x.value = l.autoValueKey, p.value = l.autoLabelKey;
332
+ }
333
+ const g = I(() => {
334
+ const l = c.value;
335
+ return i.layout === "popover" || a.value ? l : l.slice(0, t);
336
+ });
337
+ M(() => i.modelValue, (l) => {
338
+ r.value = s(l);
339
+ }, { immediate: !0 }), c.value = [...v].sort((l, b) => i.sort === "count" ? b.count && l.count ? b.count - l.count : 0 : i.sort === "name" ? String(l[p.value]).localeCompare(String(b[p.value])) : 0);
340
+ function k(l) {
341
+ return r.value && r.value.includes(l[x.value]);
342
+ }
343
+ function y(l) {
344
+ const b = r.value.includes(l[x.value]);
345
+ r.value = b ? r.value.filter((K) => K !== l[x.value]) : [...r.value, l[x.value]], n("update:modelValue", r.value), n("change", { name: i.name, value: r.value });
346
+ }
347
+ function $() {
348
+ r.value = [], n("update:modelValue", r.value), n("clear", i.name);
349
+ }
350
+ function C() {
351
+ a.value = !a.value;
352
+ }
353
+ return {
354
+ innerValue: r,
355
+ searchTerm: d,
356
+ filteredOptions: g,
357
+ isSelected: k,
358
+ selectItem: y,
359
+ clear: $,
360
+ toggleShowAll: C,
361
+ isReqProc: m,
362
+ showAll: a,
363
+ isEnableShowAll: o,
364
+ labelKey: p,
365
+ valueKey: x,
366
+ allOptions: c
367
+ };
368
+ }
369
+ const rt = {
370
+ key: 0,
371
+ class: "w-full"
372
+ }, st = { class: "flex flex-col items-center justify-center p-5 text-center" }, ut = {
373
+ key: 0,
374
+ class: "flex justify-between p-2 border-t bg-gray-50 text-xs text-gray-500"
375
+ }, it = {
376
+ key: 1,
377
+ class: "flex justify-between items-center text-xs text-gray-500 p-1 border-t"
378
+ }, xe = /* @__PURE__ */ O({
379
+ __name: "checkbox",
380
+ props: {
381
+ id: {},
382
+ name: {},
383
+ type: {},
384
+ label: {},
385
+ width: {},
386
+ options: { default: () => [] },
387
+ placeHolder: {},
388
+ api: {},
389
+ data: {},
390
+ default: {},
391
+ modelValue: {},
392
+ disabled: { type: Boolean, default: !1 },
393
+ layout: { default: "inline" },
394
+ cleanable: { type: Boolean },
395
+ limit: { default: 10 },
396
+ multi: { type: Boolean },
397
+ dataKey: {},
398
+ valueKey: {},
399
+ mode: {},
400
+ labelKey: {},
401
+ sort: {}
402
+ },
403
+ emits: ["update:modelValue", "change", "clear"],
404
+ setup(i, { expose: n, emit: v }) {
405
+ const t = i, s = v, {
406
+ innerValue: r,
407
+ filteredOptions: d,
408
+ isSelected: m,
409
+ selectItem: c,
410
+ clear: x,
411
+ toggleShowAll: p,
412
+ isReqProc: a,
413
+ showAll: o,
414
+ isEnableShowAll: h,
415
+ labelKey: g,
416
+ valueKey: k,
417
+ allOptions: y
418
+ } = Se({
419
+ ...t,
420
+ modelValue: t.modelValue
421
+ }, s);
422
+ return M(
423
+ () => t.modelValue,
424
+ ($) => {
425
+ $ === void 0 && (r.value = []);
426
+ }
427
+ ), n({
428
+ clear: x
429
+ }), ($, C) => (f(), w("div", {
430
+ class: D([$.layout === "popover" ? "flex flex-col h-full" : "flex flex-col vs-filter-checkbox space-y-0.5"])
431
+ }, [
432
+ u("div", {
433
+ class: D([
434
+ $.layout === "popover" ? "flex-1 overflow-y-auto max-h-64 p-2" : "",
435
+ $.layout === "inline" ? "flex-1 overflow-y-auto max-h-80" : ""
436
+ ])
437
+ }, [
438
+ (f(!0), w(R, null, W(e(d), (l) => (f(), S(me, {
439
+ layout: $.layout,
440
+ count: l.count,
441
+ label: l[e(g)],
442
+ color: l.color,
443
+ type: "checkbox",
444
+ value: l[e(k)],
445
+ "is-selected": e(m)(l),
446
+ onItemClick: (b) => e(c)(l)
447
+ }, null, 8, ["layout", "count", "label", "color", "value", "is-selected", "onItemClick"]))), 256))
448
+ ], 2),
449
+ $.type === "select" && e(d).length === 0 && !e(a) ? (f(), w("div", rt, [
450
+ u("div", st, [
451
+ N(ve),
452
+ C[4] || (C[4] = u("div", { class: "max-w-sm mx-auto mt-6" }, [
453
+ u("p", { class: "font-medium text-gray-800 dark:text-neutral-200" }, "За вашим запитом нічого не знайдено"),
454
+ u("p", { class: "mt-2 text-sm text-gray-500 dark:text-neutral-500" })
455
+ ], -1))
456
+ ])
457
+ ])) : V("", !0),
458
+ $.layout !== "popover" && $.type !== "select" ? (f(), w(R, { key: 1 }, [
459
+ !e(o) && e(h) ? (f(), w("div", {
460
+ key: 0,
461
+ onClick: C[0] || (C[0] = //@ts-ignore
462
+ (...l) => e(p) && e(p)(...l)),
463
+ class: "inline-flex cursor-pointer items-center gap-x-1.5 text-[13px] text-gray-800 underline underline-offset-4 hover:text-blue-600 focus:outline-none focus:text-blue-600 mt-1 px-2"
464
+ }, [
465
+ C[5] || (C[5] = z(" Показати більше ", -1)),
466
+ N(ie)
467
+ ])) : V("", !0),
468
+ e(o) ? (f(), w("div", {
469
+ key: 1,
470
+ onClick: C[1] || (C[1] = //@ts-ignore
471
+ (...l) => e(p) && e(p)(...l)),
472
+ class: "inline-flex cursor-pointer items-center gap-x-1.5 text-[13px] text-gray-800 underline underline-offset-4 hover:text-blue-600 focus:outline-none focus:text-blue-600 mt-1 px-2"
473
+ }, [
474
+ C[6] || (C[6] = z(" Показати менше ", -1)),
475
+ N(ye)
476
+ ])) : V("", !0)
477
+ ], 64)) : V("", !0),
478
+ $.cleanable ? (f(), w(R, { key: 2 }, [
479
+ $.layout === "inline" ? (f(), w("div", ut, [
480
+ z(F(e(r).length) + " з " + F(e(y).length) + " обрано ", 1),
481
+ T(u("button", {
482
+ class: "text-gray-600 hover:text-gray-800",
483
+ onClick: C[2] || (C[2] = //@ts-ignore
484
+ (...l) => e(x) && e(x)(...l))
485
+ }, " Очистити ", 512), [
486
+ [X, e(r).length !== 0]
487
+ ])
488
+ ])) : V("", !0),
489
+ $.layout === "popover" ? (f(), w("div", it, [
490
+ u("span", null, F(e(r).length) + " з " + F(e(y).length) + " обрано", 1),
491
+ T(u("button", {
492
+ class: "text-gray-600 hover:text-gray-800",
493
+ onClick: C[3] || (C[3] = //@ts-ignore
494
+ (...l) => e(x) && e(x)(...l))
495
+ }, " Очистити ", 512), [
496
+ [X, e(r).length !== 0]
497
+ ])
498
+ ])) : V("", !0)
499
+ ], 64)) : V("", !0)
500
+ ], 2));
501
+ }
502
+ }), dt = {}, ct = {
503
+ xmlns: "http://www.w3.org/2000/svg",
504
+ width: "15px",
505
+ height: "15px",
506
+ viewBox: "0 0 24 24",
507
+ fill: "none",
508
+ stroke: "currentColor",
509
+ "stroke-width": "2",
510
+ "stroke-linecap": "round",
511
+ "stroke-linejoin": "round",
512
+ class: "icon icon-tabler icons-tabler-outline icon-tabler-search stroke-gray-500 transition-all"
513
+ };
514
+ function ft(i, n) {
515
+ return f(), w("svg", ct, n[0] || (n[0] = [
516
+ u("path", {
517
+ stroke: "none",
518
+ d: "M0 0h24v24H0z",
519
+ fill: "none"
520
+ }, null, -1),
521
+ u("path", { d: "M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0" }, null, -1),
522
+ u("path", { d: "M21 21l-6 -6" }, null, -1)
523
+ ]));
524
+ }
525
+ const De = /* @__PURE__ */ J(dt, [["render", ft]]), pt = {}, mt = {
526
+ xmlns: "http://www.w3.org/2000/svg",
527
+ viewBox: "0 0 24 24",
528
+ fill: "none",
529
+ stroke: "currentColor",
530
+ "stroke-width": "2",
531
+ "stroke-linecap": "round",
532
+ "stroke-linejoin": "round",
533
+ class: "icon icon-tabler icons-tabler-outline icon-tabler-x stroke-gray-500 hover:stroke-red-500 transition-all",
534
+ width: "15px",
535
+ height: "15px"
536
+ };
537
+ function vt(i, n) {
538
+ return f(), w("svg", mt, n[0] || (n[0] = [
539
+ u("path", {
540
+ stroke: "none",
541
+ d: "M0 0h24v24H0z",
542
+ fill: "none"
543
+ }, null, -1),
544
+ u("path", { d: "M18 6l-12 12" }, null, -1),
545
+ u("path", { d: "M6 6l12 12" }, null, -1)
546
+ ]));
547
+ }
548
+ const Re = /* @__PURE__ */ J(pt, [["render", vt]]);
549
+ class de {
550
+ static getWidthClass(n) {
551
+ return typeof n == "number" ? `max-w-[${n}px]` : typeof n == "string" ? n.endsWith("%") || n.endsWith("px") ? `max-w-[${n}]` : `max-w-${n}` : "w-full";
552
+ }
553
+ }
554
+ const yt = { class: "absolute bottom-2/4 translate-y-2/4 cursor-pointer left-3" }, gt = ["placeholder"], bt = /* @__PURE__ */ O({
555
+ __name: "text-input",
556
+ props: {
557
+ id: {},
558
+ name: {},
559
+ type: {},
560
+ label: {},
561
+ width: { default: 220 },
562
+ options: {},
563
+ placeHolder: {},
564
+ api: {},
565
+ data: {},
566
+ default: {},
567
+ modelValue: {},
568
+ disabled: { type: Boolean },
569
+ layout: { default: "inline" },
570
+ cleanable: { type: Boolean },
571
+ limit: {},
572
+ multi: { type: Boolean },
573
+ dataKey: {},
574
+ valueKey: {},
575
+ mode: {},
576
+ labelKey: {},
577
+ sort: {}
578
+ },
579
+ emits: ["update:modelValue", "change", "clear"],
580
+ setup(i, { emit: n }) {
581
+ const v = i, t = _((v.placeHolder || v.label || v.name).toString()), s = n, r = _(v.modelValue ?? "");
582
+ M(
583
+ () => v.modelValue,
584
+ (c) => {
585
+ c !== r.value && (r.value = c ?? "");
586
+ }
587
+ );
588
+ function d() {
589
+ s("update:modelValue", r.value), s("change", { name: v.name, value: r.value });
590
+ }
591
+ function m() {
592
+ r.value = "", s("update:modelValue", ""), s("clear", v.name);
593
+ }
594
+ return (c, x) => (f(), w("div", {
595
+ class: D([
596
+ "vs-form-text relative bg-white rounded-lg [&>input]:py-[7px] [&>input]:max-h-[38px] [&>input]:ps-10 [&>input]:pe-8 [&>input]:block [&>input]:w-full [&>input]:bg-gray-100 [&>input]:border-transparent [&>input]:rounded-lg [&>input]:text-sm [&>input]:focus:bg-white [&>input]:focus:border-blue-500 [&>input]:focus:ring-blue-500 [&>input]:disabled:opacity-50 [&>input]:disabled:pointer-events-none [&>input]:dark:bg-neutral-700 [&>input]:dark:border-transparent [&>input]:dark:text-neutral-400 [&>input]:dark:placeholder:text-neutral-400 dark:focus:bg-neutral-800 dark:focus:ring-neutral-600",
597
+ c.layout === "inline" ? e(de).getWidthClass(c.width) : "w-full mb-2"
598
+ ])
599
+ }, [
600
+ u("div", yt, [
601
+ N(De)
602
+ ]),
603
+ r.value !== "" ? (f(), w("div", {
604
+ key: 0,
605
+ onClick: m,
606
+ class: "absolute bottom-2/4 translate-y-2/4 right-3 cursor-pointer"
607
+ }, [
608
+ N(Re)
609
+ ])) : V("", !0),
610
+ T(u("input", {
611
+ type: "text",
612
+ "onUpdate:modelValue": x[0] || (x[0] = (p) => r.value = p),
613
+ onInput: d,
614
+ placeholder: t.value,
615
+ class: "!pr-7 !pl-8 bg-white h-[38px] text-sm py-2 px-3 block w-full border border-solid placeholder:text-nowrap border-stone-200 rounded-lg text-sm text-stone-800 placeholder:text-stone-400 focus:border-2 focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"
616
+ }, null, 40, gt), [
617
+ [G, r.value]
618
+ ])
619
+ ], 2));
620
+ }
621
+ });
622
+ function Me(i = { color: "blue" }) {
623
+ return I(() => {
624
+ const v = `w-full px-3 py-2 border-solid border border-gray-300 text-sm rounded focus:outline-none focus:ring-2 focus:ring-${i.color}-500 focus:border-transparent`;
625
+ return i?.size === "sm" ? `${v}h-[32px]` : `${v}h-[38px]`;
626
+ });
627
+ }
628
+ function ht() {
629
+ return "rounded-md font-medium border-gray-200 border-solid disabled:pointer-events-none disabled:opacity-50 px-4 py-2 w-full bg-transparent border text-black text-sm h-[38px]";
630
+ }
631
+ function xt() {
632
+ return "font-medium border-gray-200 border-solid disabled:pointer-events-none disabled:opacity-50 border h-7 rounded-md text-xs px-2 py-1 hover:bg-gray-100";
633
+ }
634
+ function Ke(i) {
635
+ return i === "ghost" ? "inline-flex relative py-2 px-4 items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent text-gray-600 hover:bg-blue-100 hover:text-gray-800 focus:outline-hidden focus:bg-gray-100 focus:text-gray-800 disabled:opacity-50 disabled:pointer-events-none dark:text-gray-500 dark:hover:bg-blue-800/30 dark:hover:text-blue-400 dark:focus:bg-blue-800/30 dark:focus:text-blue-400" : i === "soft" ? "inline-flex relative py-2 px-4 items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 hover:bg-gray-200 focus:outline-hidden focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:text-blue-400 dark:hover:bg-blue-900 dark:focus:bg-blue-900" : "relative border-solid border-gray-200 focus-visible:outline-hidden focus-visible:ring-ring inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 border-input hover:bg-gray-100 border px-4 py-2 gap-2 bg-transparent h-[38px]";
636
+ }
637
+ const kt = {
638
+ key: 0,
639
+ class: "block text-xs font-medium text-gray-600 mb-1"
640
+ }, wt = ["placeholder", "disabled"], Ct = {
641
+ key: 0,
642
+ class: "block text-xs font-medium text-gray-600 mb-1"
643
+ }, Vt = {
644
+ key: 0,
645
+ class: "block text-xs font-medium text-gray-600 mb-1"
646
+ }, _t = ["placeholder", "disabled"], $t = ["disabled"];
647
+ const At = /* @__PURE__ */ O({
648
+ __name: "range-input",
649
+ props: {
650
+ id: {},
651
+ name: {},
652
+ type: {},
653
+ label: {},
654
+ width: {},
655
+ options: {},
656
+ placeHolder: {},
657
+ api: {},
658
+ data: {},
659
+ default: {},
660
+ modelValue: {},
661
+ disabled: { type: Boolean, default: !1 },
662
+ layout: { default: "inline" },
663
+ cleanable: { type: Boolean },
664
+ limit: {},
665
+ multi: { type: Boolean },
666
+ dataKey: {},
667
+ valueKey: {},
668
+ mode: {},
669
+ labelKey: {},
670
+ sort: {}
671
+ },
672
+ emits: ["update:modelValue", "change", "clear"],
673
+ setup(i, { expose: n, emit: v }) {
674
+ const t = Me(), s = ht(), r = i, d = _(
675
+ r.modelValue ?? r.default ?? []
676
+ ), m = v, c = I({
677
+ get: () => r.modelValue ?? d.value,
678
+ set: (a) => {
679
+ r.modelValue !== void 0 ? m("update:modelValue", a) : d.value = a;
680
+ }
681
+ });
682
+ function x() {
683
+ m("change", { name: r.name, value: c.value || d.value });
684
+ }
685
+ function p() {
686
+ d.value = [], c.value = d.value, m("clear", r.name);
687
+ }
688
+ return M(() => r.modelValue, (a) => {
689
+ a !== void 0 && r.layout !== "popover" ? (d.value = a, m("update:modelValue", a)) : d.value = [];
690
+ }), n({
691
+ clear: p,
692
+ currentValue: c
693
+ }), (a, o) => (f(), w(R, null, [
694
+ u("div", null, [
695
+ u("div", {
696
+ class: D(a.layout === "vertical" ? "inline-flex items-center gap-2" : "space-y-3 p-2")
697
+ }, [
698
+ u("div", null, [
699
+ a.layout !== "vertical" ? (f(), w("label", kt, "Від")) : V("", !0),
700
+ T(u("input", {
701
+ type: "number",
702
+ class: D(e(t)),
703
+ placeholder: a.placeHolder?.[0] ?? "min",
704
+ step: "1",
705
+ style: { outline: "none" },
706
+ "onUpdate:modelValue": o[0] || (o[0] = (h) => c.value[0] = h),
707
+ disabled: a.disabled
708
+ }, null, 10, wt), [
709
+ [G, c.value[0]]
710
+ ])
711
+ ]),
712
+ a.layout === "vertical" ? (f(), w("label", Ct, " - ")) : V("", !0),
713
+ u("div", null, [
714
+ a.layout !== "vertical" ? (f(), w("label", Vt, "До")) : V("", !0),
715
+ T(u("input", {
716
+ type: "number",
717
+ class: D(e(t)),
718
+ placeholder: a.placeHolder?.[1] ?? "max",
719
+ min: "0",
720
+ max: "1000000000000000",
721
+ step: "1",
722
+ style: { outline: "none" },
723
+ "onUpdate:modelValue": o[1] || (o[1] = (h) => c.value[1] = h),
724
+ disabled: a.disabled
725
+ }, null, 10, _t), [
726
+ [G, c.value[1]]
727
+ ])
728
+ ]),
729
+ ["popover", "inline", "vertical"].includes(a.layout) ? (f(), w("button", {
730
+ key: 1,
731
+ onClick: x,
732
+ class: D(e(s) + (a.layout === "vertical" ? " w-[50px]" : " bg-blue-100 hover:bg-blue-200"))
733
+ }, F(a.layout === "vertical" ? "Ok" : "Застосувати"), 3)) : V("", !0),
734
+ ["popover", "inline"].includes(a.layout) ? (f(), w("button", {
735
+ key: 2,
736
+ disabled: !(c.value[0] || c.value[1]),
737
+ onClick: p,
738
+ class: D(e(s) + " hover:bg-gray-100")
739
+ }, "Очистити", 10, $t)) : V("", !0)
740
+ ], 2)
741
+ ]),
742
+ (a.cleanable && d.value.length, V("", !0))
743
+ ], 64));
744
+ }
745
+ }), Bt = ["disabled", "title"], St = {
746
+ key: 0,
747
+ class: "absolute top-0 end-0 inline-flex min-h-[10px] min-w-[10px] z-10 items-center py-0.5 rounded-full text-xs font-medium transform -translate-y-1/2 translate-x-1/2 bg-blue-600 text-white px-1"
748
+ }, Dt = { class: "w-full text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg focus:outline-none focus:bg-stone-100 after:h-4 after:absolute after:-bottom-4 after:start-0 after:w-full before:h-4 before:absolute before:-top-4 before:start-0 before:w-full" }, Rt = { class: "w-[360px] max-h-[500px] overflow-auto [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-1 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-stone-100 [&::-webkit-scrollbar-thumb]:bg-stone-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500 before:w-full p-2" }, ge = /* @__PURE__ */ O({
749
+ __name: "popover-field",
750
+ props: {
751
+ disabled: { type: Boolean, default: !1 },
752
+ label: {},
753
+ currentValue: {},
754
+ fieldRef: {},
755
+ width: {},
756
+ mode: {},
757
+ layout: {}
758
+ },
759
+ setup(i, { expose: n }) {
760
+ const v = i, t = I(() => Ke(v.mode)), s = _(!1), r = _({ top: 0, left: 0 }), d = _(null), m = _(null), c = _(null);
761
+ function x() {
762
+ const y = m.value, $ = c.value;
763
+ if (!y || !$) return;
764
+ const C = y.getBoundingClientRect(), l = $.offsetWidth, b = window.innerWidth, K = C.bottom + 8;
765
+ let { left: A } = C;
766
+ A + l > b && (A = Math.max(b - l - 10, 10)), r.value = { top: K, left: A };
767
+ }
768
+ function p() {
769
+ s.value = !s.value, s.value && fe(() => {
770
+ x(), v.fieldRef?.inputTextRef && v.fieldRef?.inputTextRef.focus();
771
+ });
772
+ }
773
+ function a(y) {
774
+ !d.value?.contains(y.target) && !c.value?.contains(y.target) && (s.value = !1);
775
+ }
776
+ function o(y) {
777
+ y.key === "Escape" && (s.value = !1);
778
+ }
779
+ const h = _(!1);
780
+ ne(() => {
781
+ h.value = !0;
782
+ }), ne(() => {
783
+ document.addEventListener("click", a, !0), document.addEventListener("keydown", o), window.addEventListener("scroll", x, !0);
784
+ }), ce(() => {
785
+ document.removeEventListener("click", a, !0), document.removeEventListener("keydown", o), window.removeEventListener("scroll", x, !0);
786
+ });
787
+ function g() {
788
+ s.value = !1;
789
+ }
790
+ n({ close: g });
791
+ const k = I(() => {
792
+ const y = v.fieldRef?.selectedLabels;
793
+ return y ? Array.isArray(y) ? y.length > 0 ? y.join(", ") : v.label ?? "" : String(y) : v.label ?? "";
794
+ });
795
+ return (y, $) => (f(), w("div", null, [
796
+ u("button", {
797
+ onClick: p,
798
+ disabled: y.disabled,
799
+ ref_key: "triggerRef",
800
+ ref: m,
801
+ title: y.label,
802
+ class: D(t.value + " " + (y.width ? e(de).getWidthClass(y.width) : "w-full"))
803
+ }, [
804
+ u("span", {
805
+ class: D(["truncate text-ellipsis block", y.width ? e(de).getWidthClass(y.width - 50) : "w-full"])
806
+ }, F(k.value), 3),
807
+ N(ie, { class: "h-4 w-4" }),
808
+ (Array.isArray(y.currentValue) ? y.currentValue === null || y.currentValue.length > 0 : y.currentValue === null || y.currentValue) && y.layout === "inline" ? (f(), w("span", St)) : V("", !0)
809
+ ], 10, Bt),
810
+ h.value ? (f(), S($e, {
811
+ key: 0,
812
+ to: "body"
813
+ }, [
814
+ T(u("div", {
815
+ ref_key: "popperRef",
816
+ ref: c,
817
+ class: "vsTailwind vs-popover__content bottom-right w-fit fixed z-[1000]",
818
+ style: Ae({ top: `${r.value.top}px`, left: `${r.value.left}px` }),
819
+ "data-inside-popover": ""
820
+ }, [
821
+ u("div", Dt, [
822
+ u("div", Rt, [
823
+ ue(y.$slots, "default")
824
+ ])
825
+ ])
826
+ ], 4), [
827
+ [X, s.value]
828
+ ])
829
+ ])) : V("", !0)
830
+ ]));
831
+ }
832
+ });
833
+ function Mt(i) {
834
+ return String(i).charAt(0).toUpperCase() + String(i).slice(1);
835
+ }
836
+ class H {
837
+ static format(n) {
838
+ const v = n.getFullYear(), t = (n.getMonth() + 1).toString().padStart(2, "0"), s = n.getDate().toString().padStart(2, "0");
839
+ return `${v}-${t}-${s}`;
840
+ }
841
+ static getShiftedDay(n, v = 0) {
842
+ const t = n ? new Date(n) : /* @__PURE__ */ new Date();
843
+ return t.setDate(t.getDate() + v), this.format(t);
844
+ }
845
+ static getLastWeekRange(n, v, t = 0) {
846
+ if (n && v) {
847
+ const x = new Date(n), p = new Date(v);
848
+ return x.setDate(x.getDate() + t * 7), p.setDate(p.getDate() + t * 7), [this.format(x), this.format(p)];
849
+ }
850
+ const s = /* @__PURE__ */ new Date(), r = s.getDay(), d = r === 0 ? 13 : r - 1 + 7, m = new Date(s);
851
+ m.setDate(s.getDate() - d + t * 7);
852
+ const c = new Date(m);
853
+ return c.setDate(m.getDate() + 6), [this.format(m), this.format(c)];
854
+ }
855
+ static getMonthRange(n, v, t = 0) {
856
+ let s;
857
+ n ? s = new Date(n) : s = /* @__PURE__ */ new Date(), s = new Date(s.getFullYear(), s.getMonth() + t, 1);
858
+ const r = s, d = new Date(s.getFullYear(), s.getMonth() + 1, 0);
859
+ return [this.format(r), this.format(d)];
860
+ }
861
+ static getQuarterRange(n, v, t = 0) {
862
+ const s = n || v, r = s ? new Date(s) : /* @__PURE__ */ new Date();
863
+ let d = Math.floor(r.getMonth() / 3);
864
+ d += t;
865
+ const m = (d % 4 + 4) % 4 * 3, c = r.getFullYear() + Math.floor(d / 4), x = new Date(c, m, 1), p = new Date(c, m + 3, 0);
866
+ return [this.format(x), this.format(p)];
867
+ }
868
+ static getYear(n, v = 0) {
869
+ let t;
870
+ return n && /^\d{4}$/.test(n) ? t = parseInt(n, 10) : n ? t = new Date(n).getFullYear() : t = (/* @__PURE__ */ new Date()).getFullYear(), String(t + v);
871
+ }
872
+ static getYearRange(n, v = 0) {
873
+ let t;
874
+ return n && /^\d{4}$/.test(n) ? t = parseInt(n, 10) : n ? t = new Date(n).getFullYear() : t = (/* @__PURE__ */ new Date()).getFullYear(), [
875
+ this.format(new Date(t + v, 0, 1)),
876
+ this.format(new Date(t + v + 1, 0, 0))
877
+ ];
878
+ }
879
+ static getRangeFromDaysBefore(n) {
880
+ const v = /* @__PURE__ */ new Date(), t = new Date(v.getTime());
881
+ return t.setDate(v.getDate() - n), [this.format(t), this.format(v)];
882
+ }
883
+ }
884
+ function Fe(i, n) {
885
+ const {
886
+ popoverRef: v
887
+ } = i, t = _(""), s = _(
888
+ i.modelValue ?? i.default ?? []
889
+ ), r = _(0);
890
+ function d() {
891
+ const k = H.getRangeFromDaysBefore(r.value);
892
+ return s.value = [...k], n("change", { name: i.name, value: s.value }), n("update:modelValue", s.value), k;
893
+ }
894
+ function m(k) {
895
+ t.value = k, v.value?.close();
896
+ const y = [];
897
+ switch (t.value) {
898
+ case "today":
899
+ y.push(H.getShiftedDay()), y.push(H.getShiftedDay());
900
+ break;
901
+ case "week":
902
+ y.push(...H.getLastWeekRange());
903
+ break;
904
+ case "month":
905
+ y.push(...H.getMonthRange());
906
+ break;
907
+ case "quarter":
908
+ y.push(...H.getQuarterRange());
909
+ break;
910
+ case "year":
911
+ y.push(...H.getYearRange());
912
+ break;
913
+ case "last_7_days":
914
+ r.value = 7, d();
915
+ break;
916
+ case "range":
917
+ r.value = 7, y.push(...d());
918
+ break;
919
+ }
920
+ s.value = [...y], n("change", { name: i.name, value: s.value }), n("update:modelValue", s.value);
921
+ }
922
+ function c() {
923
+ const k = [];
924
+ switch (t.value) {
925
+ case "today":
926
+ k.push(H.getShiftedDay(s.value[0], 1));
927
+ break;
928
+ case "week":
929
+ k.push(...H.getLastWeekRange(s.value[0], s.value[1], 1));
930
+ break;
931
+ case "month":
932
+ k.push(...H.getMonthRange(s.value[0], s.value[1], 1));
933
+ break;
934
+ case "quarter":
935
+ k.push(...H.getQuarterRange(s.value[0], s.value[1], 1));
936
+ break;
937
+ case "year":
938
+ k.push(...H.getYearRange(s.value[0], 1));
939
+ break;
940
+ }
941
+ s.value = [...k], n("change", { name: i.name, value: s.value }), n("update:modelValue", s.value);
942
+ }
943
+ function x() {
944
+ const k = [];
945
+ switch (t.value) {
946
+ case "today":
947
+ k.push(H.getShiftedDay(s.value[0], -1));
948
+ break;
949
+ case "week":
950
+ k.push(...H.getLastWeekRange(s.value[0], s.value[1], -1));
951
+ break;
952
+ case "month":
953
+ k.push(...H.getMonthRange(s.value[0], s.value[1], -1));
954
+ break;
955
+ case "quarter":
956
+ k.push(...H.getQuarterRange(s.value[0], s.value[1], -1));
957
+ break;
958
+ case "year":
959
+ k.push(...H.getYearRange(s.value[0], -1));
960
+ break;
961
+ }
962
+ s.value = [...k], n("change", { name: i.name, value: s.value }), n("update:modelValue", s.value);
963
+ }
964
+ const p = [
965
+ "Січень",
966
+ "Лютий",
967
+ "Березень",
968
+ "Квітень",
969
+ "Травень",
970
+ "Червень",
971
+ "Липень",
972
+ "Серпень",
973
+ "Вересень",
974
+ "Жовтень",
975
+ "Листопад",
976
+ "Грудень"
977
+ ];
978
+ function a(k) {
979
+ const [y, $, C] = k.split("-");
980
+ return `${C}.${$}.${y}`;
981
+ }
982
+ function o(k) {
983
+ const { value: y } = s;
984
+ switch (k) {
985
+ case "today":
986
+ return a(y[0]);
987
+ case "range":
988
+ return "Період";
989
+ case "week":
990
+ return y[0] && y[1] ? `${a(y[0])} – ${a(y[1])}` : "";
991
+ case "quarter":
992
+ if (y[0]) {
993
+ const $ = new Date(y[0]), C = $.getFullYear(), l = $.getMonth();
994
+ return `${Math.floor(l / 3) + 1} квартал ${C}`;
995
+ }
996
+ return "";
997
+ case "month":
998
+ if (y[0]) {
999
+ const [$, C] = y[0].split("-");
1000
+ return `${p[parseInt(C, 10) - 1]} ${$}`;
1001
+ }
1002
+ return "";
1003
+ case "year":
1004
+ return y[0] || "";
1005
+ case "last_7_days":
1006
+ return "За останні дні";
1007
+ default:
1008
+ return i.label ?? "";
1009
+ }
1010
+ }
1011
+ const h = I(() => t.value ? o(t.value) : i.label ?? "");
1012
+ function g() {
1013
+ t.value = "", s.value = [], n("update:modelValue", []), n("clear", i.name);
1014
+ }
1015
+ return {
1016
+ activeMode: t,
1017
+ innerValue: s,
1018
+ daysBefore: r,
1019
+ onDaysBeforeChange: d,
1020
+ onSelectChange: m,
1021
+ nextClick: c,
1022
+ prevClick: x,
1023
+ ukMonths: p,
1024
+ formatDisplayDate: a,
1025
+ getModeLabel: o,
1026
+ currentLabel: h,
1027
+ clear: g
1028
+ };
1029
+ }
1030
+ const Kt = {
1031
+ key: 0,
1032
+ class: "relative flex w-full h-auto gap-2 filter-date m-2 flex-wrap"
1033
+ }, Ft = {
1034
+ key: 0,
1035
+ class: "flex gap-1 !w-[75%] rounded-lg"
1036
+ }, jt = ["max", "disabled"], Lt = ["min", "disabled"], Et = {
1037
+ key: 0,
1038
+ class: "block text-xs font-medium text-gray-600 mb-1"
1039
+ }, It = ["max", "disabled"], Tt = {
1040
+ key: 0,
1041
+ class: "block text-xs font-medium text-gray-600 mb-1"
1042
+ }, Ot = {
1043
+ key: 0,
1044
+ class: "block text-xs font-medium text-gray-600 mb-1"
1045
+ }, Ut = ["min", "disabled"], zt = { class: "flex gap-1 pt-2" }, Nt = ["onClick"];
1046
+ const Ht = /* @__PURE__ */ O({
1047
+ __name: "date-input",
1048
+ props: {
1049
+ id: {},
1050
+ name: {},
1051
+ type: {},
1052
+ label: {},
1053
+ width: {},
1054
+ options: {},
1055
+ placeHolder: {},
1056
+ api: {},
1057
+ data: {},
1058
+ default: {},
1059
+ modelValue: {},
1060
+ disabled: { type: Boolean },
1061
+ layout: { default: "inline" },
1062
+ cleanable: { type: Boolean },
1063
+ limit: {},
1064
+ multi: { type: Boolean },
1065
+ dataKey: {},
1066
+ valueKey: {},
1067
+ mode: {},
1068
+ labelKey: {},
1069
+ sort: {}
1070
+ },
1071
+ emits: ["update:modelValue", "change", "clear"],
1072
+ setup(i, { expose: n, emit: v }) {
1073
+ const t = i, s = Me(), r = xt(), d = v, m = _(null), {
1074
+ activeMode: c,
1075
+ innerValue: x,
1076
+ onSelectChange: p,
1077
+ nextClick: a,
1078
+ prevClick: o,
1079
+ clear: h
1080
+ } = Fe({
1081
+ ...t,
1082
+ popoverRef: m
1083
+ }, d);
1084
+ return M(() => t.modelValue, (g) => {
1085
+ g !== void 0 ? (x.value = g, d("update:modelValue", g)) : (c.value = "", x.value = []);
1086
+ }), n({
1087
+ clear: h,
1088
+ popoverRef: m
1089
+ }), (g, k) => (f(), w(R, null, [
1090
+ g.layout === "inline" ? (f(), w("div", Kt, [
1091
+ e(c) !== "" && e(c) === "range" ? (f(), w("div", Ft, [
1092
+ T(u("input", {
1093
+ type: "date",
1094
+ max: e(x)[1],
1095
+ locale: "uk-UA",
1096
+ "onUpdate:modelValue": k[0] || (k[0] = (y) => e(x)[0] = y),
1097
+ class: "px-2 p-0 border text-[12px] max-w-[calc(50%-5px)] h-[38px] rounded-lg focus:outline-blue-600",
1098
+ disabled: g.disabled
1099
+ }, null, 8, jt), [
1100
+ [G, e(x)[0]]
1101
+ ]),
1102
+ T(u("input", {
1103
+ type: "date",
1104
+ min: e(x)[0],
1105
+ locale: "uk-UA",
1106
+ "onUpdate:modelValue": k[1] || (k[1] = (y) => e(x)[1] = y),
1107
+ class: "px-2 p-0 border text-[12px] max-w-[calc(50%-5px)] h-[38px] rounded-lg focus:outline-blue-600 appearance-auto",
1108
+ disabled: g.disabled
1109
+ }, null, 8, Lt), [
1110
+ [G, e(x)[1]]
1111
+ ])
1112
+ ])) : V("", !0)
1113
+ ])) : V("", !0),
1114
+ u("div", {
1115
+ class: D(g.layout === "popover" ? "space-y-3 p-2" : "flex items-center gap-2")
1116
+ }, [
1117
+ u("div", {
1118
+ class: D(g.layout !== "popover" ? "w-[48%]" : "")
1119
+ }, [
1120
+ g.layout === "popover" ? (f(), w("label", Et, "Від")) : V("", !0),
1121
+ T(u("input", {
1122
+ type: "date",
1123
+ max: e(x)[1],
1124
+ locale: "uk-UA",
1125
+ "onUpdate:modelValue": k[2] || (k[2] = (y) => e(x)[0] = y),
1126
+ class: D(e(s)),
1127
+ disabled: g.disabled
1128
+ }, null, 10, It), [
1129
+ [G, e(x)[0]]
1130
+ ])
1131
+ ], 2),
1132
+ g.layout !== "popover" ? (f(), w("label", Tt, " - ")) : V("", !0),
1133
+ u("div", {
1134
+ class: D(g.layout !== "popover" ? "w-[48%]" : "")
1135
+ }, [
1136
+ g.layout === "popover" ? (f(), w("label", Ot, "До")) : V("", !0),
1137
+ T(u("input", {
1138
+ type: "date",
1139
+ min: e(x)[0],
1140
+ locale: "uk-UA",
1141
+ "onUpdate:modelValue": k[3] || (k[3] = (y) => e(x)[1] = y),
1142
+ class: D(e(s)),
1143
+ disabled: g.disabled
1144
+ }, null, 10, Ut), [
1145
+ [G, e(x)[1]]
1146
+ ])
1147
+ ], 2)
1148
+ ], 2),
1149
+ u("div", zt, [
1150
+ (f(), w(R, null, W(["today", "week", "month", "quarter", "year"], (y) => u("button", {
1151
+ key: y,
1152
+ class: D(e(r) + (e(c) === y ? " bg-blue-100" : "")),
1153
+ onClick: ($) => e(p)(y)
1154
+ }, F(e(Mt)(y)), 11, Nt)), 64)),
1155
+ u("button", {
1156
+ class: D(e(r)),
1157
+ onClick: k[4] || (k[4] = //@ts-ignore
1158
+ (...y) => e(o) && e(o)(...y))
1159
+ }, " <", 2),
1160
+ u("button", {
1161
+ class: D(e(r)),
1162
+ onClick: k[5] || (k[5] = //@ts-ignore
1163
+ (...y) => e(a) && e(a)(...y))
1164
+ }, " >", 2)
1165
+ ]),
1166
+ (g.cleanable, V("", !0))
1167
+ ], 64));
1168
+ }
1169
+ });
1170
+ function Yt(i, n) {
1171
+ const {
1172
+ api: v,
1173
+ options: t = [],
1174
+ limit: s = 20,
1175
+ dataKey: r = "data"
1176
+ } = i, d = i.multi;
1177
+ function m(B) {
1178
+ return d ? Array.isArray(B) ? B : B ? [B] : [] : Array.isArray(B) ? B[0] : B;
1179
+ }
1180
+ const c = _(m(i.modelValue)), x = _(""), p = _(!1), a = _([]), o = _("id"), h = _("text"), g = _(!1), k = _(i.layout !== "popover" && t.length > s), y = _([]), $ = _(0);
1181
+ function C(B) {
1182
+ const U = B.find(Boolean) ?? {}, q = ["id", "value", "code", "key"].find((oe) => oe in U) ?? "id", se = ["text", "label", "name", "title"].find((oe) => oe in U) ?? "text";
1183
+ return { autoValueKey: q, autoLabelKey: se };
1184
+ }
1185
+ if (t.length > 0) {
1186
+ const B = C(t);
1187
+ o.value = B.autoValueKey, h.value = B.autoLabelKey;
1188
+ }
1189
+ const l = I(() => {
1190
+ if (v) return a.value;
1191
+ const B = a.value;
1192
+ if (i.layout === "popover") return B;
1193
+ if (!x.value)
1194
+ return g.value ? B : B.slice(0, s);
1195
+ const U = x.value.toLowerCase();
1196
+ return B.filter((q) => q[h.value].toLowerCase().includes(U));
1197
+ });
1198
+ let b = null;
1199
+ async function K(B) {
1200
+ if (v) {
1201
+ p.value = !0;
1202
+ try {
1203
+ const U = new URL(v, window.location.origin);
1204
+ U.searchParams.set("json", "1"), U.searchParams.set("key", B), U.searchParams.set("limit", s.toString());
1205
+ const q = await fetch(U.toString());
1206
+ if (!q.ok)
1207
+ throw new Error(`HTTP error! status: ${q.status}`);
1208
+ const se = await q.json();
1209
+ if (a.value = se[r], a.value.length > 0) {
1210
+ const oe = C(a.value);
1211
+ o.value = oe.autoValueKey, h.value = oe.autoLabelKey;
1212
+ }
1213
+ $.value = se.total;
1214
+ } catch (U) {
1215
+ console.error("Failed to fetch remote options:", U);
1216
+ } finally {
1217
+ p.value = !1;
1218
+ }
1219
+ }
1220
+ }
1221
+ M(x, (B) => {
1222
+ v && (b && clearTimeout(b), b = setTimeout(() => {
1223
+ K(B);
1224
+ }, 200));
1225
+ }), M(() => i.modelValue, (B) => {
1226
+ c.value = m(B);
1227
+ }, { immediate: !0 }), v ? K("") : a.value = t;
1228
+ function A(B) {
1229
+ return d && Array.isArray(c.value) ? c.value.includes(B[o.value]) : c.value && c.value === B[o.value];
1230
+ }
1231
+ function Y(B) {
1232
+ if (d && !Array.isArray(c.value) && (c.value = []), d && Array.isArray(c.value)) {
1233
+ const U = c.value.includes(B[o.value]);
1234
+ c.value = U ? c.value.filter((q) => q !== B[o.value]) : [...c.value, B[o.value]], y.value = U ? y.value.filter((q) => q !== B[h.value]) : [...y.value, B[h.value]];
1235
+ } else
1236
+ c.value = B[o.value], y.value = B[h.value];
1237
+ n("update:modelValue", c.value), n("change", { name: i.name, value: c.value });
1238
+ }
1239
+ function L() {
1240
+ d ? (c.value = [], y.value = []) : (c.value = void 0, y.value = []), n("update:modelValue", c.value), n("clear", i.name);
1241
+ }
1242
+ function j() {
1243
+ b && clearTimeout(b), x.value = "", g.value = !1;
1244
+ }
1245
+ function E() {
1246
+ g.value = !g.value;
1247
+ }
1248
+ ce(() => {
1249
+ b && clearTimeout(b);
1250
+ });
1251
+ const Q = _(-1);
1252
+ M(l, () => {
1253
+ Q.value = l.value.length > 0 ? 0 : -1;
1254
+ });
1255
+ function re(B) {
1256
+ const U = l.value.length;
1257
+ if (B.key === "ArrowDown")
1258
+ B.preventDefault(), Q.value = (Q.value + 1) % U;
1259
+ else if (B.key === "ArrowUp")
1260
+ B.preventDefault(), Q.value = (Q.value - 1 + U) % U;
1261
+ else if (B.key === "Enter" && (B.preventDefault(), Q.value >= 0 && Q.value < l.value.length)) {
1262
+ const q = l.value[Q.value];
1263
+ Y(q);
1264
+ }
1265
+ }
1266
+ return {
1267
+ innerValue: c,
1268
+ searchTerm: x,
1269
+ filteredOptions: l,
1270
+ isSelected: A,
1271
+ selectItem: Y,
1272
+ clear: L,
1273
+ resetSearch: j,
1274
+ toggleShowAll: E,
1275
+ isReqProc: p,
1276
+ showAll: g,
1277
+ isEnableShowAll: k,
1278
+ labelKey: h,
1279
+ valueKey: o,
1280
+ allOptions: a,
1281
+ highlightedIndex: Q,
1282
+ onKeyDown: re,
1283
+ selectedLabels: y,
1284
+ totalCount: $
1285
+ };
1286
+ }
1287
+ const Pt = { class: "h-[45px] shrink-0 px-[6px] py-[4px] flex items-center relative justify-center" }, Wt = {
1288
+ key: 0,
1289
+ class: "w-full"
1290
+ }, qt = { class: "flex flex-col items-center justify-center p-5 text-center" }, Qt = {
1291
+ key: 0,
1292
+ class: "flex justify-between p-2 border-t bg-gray-50 text-xs text-gray-500"
1293
+ }, Gt = {
1294
+ key: 1,
1295
+ class: "flex justify-between items-center text-xs text-gray-500 p-1 border-t"
1296
+ }, Xt = /* @__PURE__ */ O({
1297
+ __name: "select",
1298
+ props: {
1299
+ id: {},
1300
+ name: {},
1301
+ type: {},
1302
+ label: {},
1303
+ width: {},
1304
+ options: { default: () => [] },
1305
+ placeHolder: {},
1306
+ api: {},
1307
+ data: {},
1308
+ default: {},
1309
+ modelValue: {},
1310
+ disabled: { type: Boolean, default: !1 },
1311
+ layout: { default: "inline" },
1312
+ cleanable: { type: Boolean },
1313
+ limit: { default: 10 },
1314
+ multi: { type: Boolean },
1315
+ dataKey: {},
1316
+ valueKey: {},
1317
+ mode: {},
1318
+ labelKey: {},
1319
+ sort: {}
1320
+ },
1321
+ emits: ["update:modelValue", "change", "clear"],
1322
+ setup(i, { expose: n, emit: v }) {
1323
+ const t = i, s = v, r = _(null), {
1324
+ innerValue: d,
1325
+ filteredOptions: m,
1326
+ isSelected: c,
1327
+ selectItem: x,
1328
+ clear: p,
1329
+ resetSearch: a,
1330
+ toggleShowAll: o,
1331
+ isReqProc: h,
1332
+ showAll: g,
1333
+ isEnableShowAll: k,
1334
+ searchTerm: y,
1335
+ labelKey: $,
1336
+ valueKey: C,
1337
+ highlightedIndex: l,
1338
+ onKeyDown: b,
1339
+ selectedLabels: K,
1340
+ totalCount: A
1341
+ } = Yt({
1342
+ ...t,
1343
+ modelValue: t.modelValue
1344
+ }, s);
1345
+ ne(() => {
1346
+ a();
1347
+ }), M(
1348
+ () => t.modelValue,
1349
+ (L) => {
1350
+ L === void 0 && (t.multi ? d.value = [] : d.value = void 0);
1351
+ }
1352
+ );
1353
+ const Y = _([]);
1354
+ return M(l, (L) => {
1355
+ L >= 0 && Y.value[L] && Y.value[L]?.scrollIntoView({
1356
+ block: "nearest",
1357
+ behavior: "smooth"
1358
+ });
1359
+ }), M(m, () => {
1360
+ Y.value = [];
1361
+ }), n({
1362
+ clear: p,
1363
+ inputTextRef: r,
1364
+ selectedLabels: K
1365
+ }), (L, j) => (f(), w("div", {
1366
+ class: D([L.layout === "popover" ? "flex flex-col h-full" : "flex flex-col vs-filter-checkbox space-y-0.5"])
1367
+ }, [
1368
+ u("div", Pt, [
1369
+ T(u("input", {
1370
+ "onUpdate:modelValue": j[0] || (j[0] = (E) => Ee(y) ? y.value = E : null),
1371
+ onKeydown: j[1] || (j[1] = //@ts-ignore
1372
+ (...E) => e(b) && e(b)(...E)),
1373
+ class: "w-full h-full text-[13px] px-4 border rounded-sm pl-9 focus:outline-none focus:ring-ring focus:ring-1 focus:ring-blue-500",
1374
+ placeholder: "Пошук",
1375
+ type: "text",
1376
+ ref_key: "inputTextRef",
1377
+ ref: r
1378
+ }, null, 544), [
1379
+ [G, e(y)]
1380
+ ]),
1381
+ N(De, { class: "absolute text-gray-400 -translate-y-1/2 left-4 top-1/2" }),
1382
+ N(Re, {
1383
+ onClick: j[2] || (j[2] = (E) => y.value = ""),
1384
+ class: "absolute text-gray-400 -translate-y-1/2 cursor-pointer hover:text-red-500 right-4 top-1/2"
1385
+ })
1386
+ ]),
1387
+ u("div", {
1388
+ class: D([
1389
+ L.layout === "popover" ? "flex-1 overflow-y-auto max-h-64 p-2" : "",
1390
+ L.layout === "inline" ? "flex-1 overflow-y-auto max-h-80" : ""
1391
+ ])
1392
+ }, [
1393
+ (f(!0), w(R, null, W(e(m), (E, Q) => (f(), S(me, {
1394
+ layout: L.layout,
1395
+ count: E.count,
1396
+ label: E[e($)],
1397
+ color: E.color,
1398
+ type: L.multi ? "checkbox" : "radio",
1399
+ value: E[e(C)],
1400
+ "is-selected": e(c)(E),
1401
+ highlighted: Q === e(l),
1402
+ onItemClick: (re) => e(x)(E),
1403
+ ref_for: !0,
1404
+ ref: (re) => Y.value[Q] = re?.el
1405
+ }, null, 8, ["layout", "count", "label", "color", "type", "value", "is-selected", "highlighted", "onItemClick"]))), 256))
1406
+ ], 2),
1407
+ L.type === "select" && e(m).length === 0 && !e(h) ? (f(), w("div", Wt, [
1408
+ u("div", qt, [
1409
+ N(ve),
1410
+ j[7] || (j[7] = u("div", { class: "max-w-sm mx-auto mt-6" }, [
1411
+ u("p", { class: "font-medium text-gray-800 dark:text-neutral-200" }, "За вашим запитом нічого не знайдено"),
1412
+ u("p", { class: "mt-2 text-sm text-gray-500 dark:text-neutral-500" })
1413
+ ], -1))
1414
+ ])
1415
+ ])) : V("", !0),
1416
+ L.layout !== "popover" && L.type !== "select" ? (f(), w(R, { key: 1 }, [
1417
+ !e(g) && e(k) ? (f(), w("div", {
1418
+ key: 0,
1419
+ onClick: j[3] || (j[3] = //@ts-ignore
1420
+ (...E) => e(o) && e(o)(...E)),
1421
+ class: "inline-flex cursor-pointer items-center gap-x-1.5 text-[13px] text-gray-800 underline underline-offset-4 hover:text-blue-600 focus:outline-none focus:text-blue-600 mt-1 px-2"
1422
+ }, [
1423
+ j[8] || (j[8] = z(" Показати більше ", -1)),
1424
+ N(ie)
1425
+ ])) : V("", !0),
1426
+ e(g) ? (f(), w("div", {
1427
+ key: 1,
1428
+ onClick: j[4] || (j[4] = //@ts-ignore
1429
+ (...E) => e(o) && e(o)(...E)),
1430
+ class: "inline-flex cursor-pointer items-center gap-x-1.5 text-[13px] text-gray-800 underline underline-offset-4 hover:text-blue-600 focus:outline-none focus:text-blue-600 mt-1 px-2"
1431
+ }, [
1432
+ j[9] || (j[9] = z(" Показати менше ", -1)),
1433
+ N(ye)
1434
+ ])) : V("", !0)
1435
+ ], 64)) : V("", !0),
1436
+ L.cleanable ? (f(), w(R, { key: 2 }, [
1437
+ L.layout === "inline" ? (f(), w("div", Qt, [
1438
+ z(F(L.multi && Array.isArray(e(d)) ? e(d)?.length : e(d) !== void 0 && (e(d) || e(d) === null) ? 1 : 0) + " з " + F(e(A)) + " обрано ", 1),
1439
+ T(u("button", {
1440
+ class: "text-gray-600 hover:text-gray-800",
1441
+ onClick: j[5] || (j[5] = //@ts-ignore
1442
+ (...E) => e(p) && e(p)(...E))
1443
+ }, " Очистити ", 512), [
1444
+ [X, e(d) !== "" && e(d) !== void 0 || e(d)]
1445
+ ])
1446
+ ])) : V("", !0),
1447
+ L.layout === "popover" ? (f(), w("div", Gt, [
1448
+ u("span", null, F(L.multi && Array.isArray(e(d)) ? e(d)?.length : e(d) !== void 0 && (e(d) || e(d) === null) ? 1 : 0) + " з " + F(e(A)) + " обрано", 1),
1449
+ T(u("button", {
1450
+ class: "text-gray-600 hover:text-gray-800",
1451
+ onClick: j[6] || (j[6] = //@ts-ignore
1452
+ (...E) => e(p) && e(p)(...E))
1453
+ }, " Очистити ", 512), [
1454
+ [X, e(d) !== "" && e(d) !== void 0 || e(d)]
1455
+ ])
1456
+ ])) : V("", !0)
1457
+ ], 64)) : V("", !0)
1458
+ ], 2));
1459
+ }
1460
+ }), Jt = ["for", "onClick"], Zt = ["id", "name", "value"], el = { class: "block" }, tl = {
1461
+ key: 0,
1462
+ class: "flex justify-between p-2 border-t bg-gray-50 text-xs text-gray-500"
1463
+ }, ll = {
1464
+ key: 1,
1465
+ class: "flex justify-between items-center text-xs text-gray-500 p-1 border-t"
1466
+ }, ol = /* @__PURE__ */ O({
1467
+ __name: "tag-field",
1468
+ props: {
1469
+ id: {},
1470
+ name: {},
1471
+ type: {},
1472
+ label: {},
1473
+ width: {},
1474
+ options: { default: () => [] },
1475
+ placeHolder: {},
1476
+ api: {},
1477
+ data: {},
1478
+ default: {},
1479
+ modelValue: {},
1480
+ disabled: { type: Boolean, default: !1 },
1481
+ layout: { default: "inline" },
1482
+ cleanable: { type: Boolean },
1483
+ limit: {},
1484
+ multi: { type: Boolean },
1485
+ dataKey: {},
1486
+ valueKey: {},
1487
+ mode: {},
1488
+ labelKey: {},
1489
+ sort: {}
1490
+ },
1491
+ emits: ["update:modelValue", "change", "clear"],
1492
+ setup(i, { expose: n, emit: v }) {
1493
+ const t = i, s = v, {
1494
+ innerValue: r,
1495
+ isSelected: d,
1496
+ selectItem: m,
1497
+ clear: c,
1498
+ labelKey: x,
1499
+ valueKey: p,
1500
+ allOptions: a
1501
+ } = t.multi ? Se({
1502
+ ...t,
1503
+ modelValue: t.modelValue ?? t.default ?? []
1504
+ }, s) : Be({
1505
+ ...t,
1506
+ modelValue: t.modelValue !== void 0 ? t.modelValue : t.default ?? ""
1507
+ }, s);
1508
+ return n({
1509
+ clear: c
1510
+ }), M(
1511
+ () => t.modelValue,
1512
+ (o) => {
1513
+ o === void 0 && (t.multi ? r.value = [] : r.value = void 0);
1514
+ }
1515
+ ), (o, h) => (f(), w(R, null, [
1516
+ u("div", {
1517
+ class: D(["grid grid-cols-3 gap-2 mx-[1px]", o.layout === "popover" ? "m-1" : "mb-1"])
1518
+ }, [
1519
+ (f(!0), w(R, null, W(e(a), (g) => (f(), w("label", {
1520
+ key: `item-${g[e(p)]}`,
1521
+ for: `item-${g[e(p)]}`,
1522
+ onClick: _e((k) => e(m)(g), ["stop", "prevent"]),
1523
+ class: D([e(d)(g) ? "ring-2 ring-indigo-600" : "", "p-2.5 group relative flex justify-center items-center gap-x-12 text-center text-xs bg-white text-gray-800 border border-gray-200 cursor-pointer rounded-lg dark:bg-neutral-900 dark:border-neutral-700 dark:text-neutral-200 peer-checked:text-indigo-600 dark:has-checked:text-indigo-500 peer-checked:border-indigo-600 dark:has-checked:border-indigo-500 peer-checked:ring peer-checked:shadow focus:ring dark:has-checked:ring-indigo-500 has-disabled:pointer-events-none has-disabled:text-gray-200 dark:has-disabled:text-neutral-700 has-disabled:after:absolute has-disabled:after:inset-0 has-disabled:after:bg-[linear-gradient(to_right_bottom,transparent_calc(50%-1px),var(--color-gray-200)_calc(50%-1px),var(--color-gray-200)_50%,transparent_50%)] dark:has-disabled:after:bg-[linear-gradient(to_right_bottom,transparent_calc(50%-1px),var(--color-neutral-700)_calc(50%-1px),var(--color-neutral-700)_50%,transparent_50%)]"])
1524
+ }, [
1525
+ u("input", {
1526
+ type: "checkbox",
1527
+ id: `item-${g[e(p)]}`,
1528
+ class: "hidden w4poy border-gray-200 g41z1 g22e3 axcnw dark:text-indigo-500 dark:border-neutral-700 dark:focus:ring-neutral-900",
1529
+ name: `item-${g[e(p)]}`,
1530
+ value: g[e(p)]
1531
+ }, null, 8, Zt),
1532
+ u("span", el, F(g[e(x)]), 1)
1533
+ ], 10, Jt))), 128))
1534
+ ], 2),
1535
+ o.cleanable ? (f(), w(R, { key: 0 }, [
1536
+ o.layout === "inline" ? (f(), w("div", tl, [
1537
+ z(F(o.multi && Array.isArray(e(r)) ? e(r)?.length : e(r) !== void 0 && (e(r) || e(r) === null) ? 1 : 0) + " з " + F(e(a).length) + " обрано ", 1),
1538
+ T(u("button", {
1539
+ class: "text-gray-600 hover:text-gray-800",
1540
+ onClick: h[0] || (h[0] = //@ts-ignore
1541
+ (...g) => e(c) && e(c)(...g))
1542
+ }, " Очистити ", 512), [
1543
+ [X, e(r) !== "" && e(r) !== void 0 || e(r)]
1544
+ ])
1545
+ ])) : V("", !0),
1546
+ o.layout === "popover" ? (f(), w("div", ll, [
1547
+ u("span", null, F(o.multi && Array.isArray(e(r)) ? e(r)?.length : e(r) !== void 0 && (e(r) || e(r) === null) ? 1 : 0) + " з " + F(e(a).length) + " обрано", 1),
1548
+ T(u("button", {
1549
+ class: "text-gray-600 hover:text-gray-800",
1550
+ onClick: h[1] || (h[1] = //@ts-ignore
1551
+ (...g) => e(c) && e(c)(...g))
1552
+ }, " Очистити ", 512), [
1553
+ [X, e(r) !== void 0 && e(r) !== "" || e(r)]
1554
+ ])
1555
+ ])) : V("", !0)
1556
+ ], 64)) : V("", !0)
1557
+ ], 64));
1558
+ }
1559
+ }), al = {}, nl = {
1560
+ xmlns: "http://www.w3.org/2000/svg",
1561
+ width: "24",
1562
+ height: "24",
1563
+ viewBox: "0 0 24 24",
1564
+ fill: "none",
1565
+ stroke: "currentColor",
1566
+ "stroke-width": "2",
1567
+ "stroke-linecap": "round",
1568
+ "stroke-linejoin": "round",
1569
+ class: "text-blue-600 w-[16px] h-[16px]"
1570
+ };
1571
+ function rl(i, n) {
1572
+ return f(), w("svg", nl, n[0] || (n[0] = [
1573
+ u("path", { d: "M20 6 9 17l-5-5" }, null, -1)
1574
+ ]));
1575
+ }
1576
+ const te = /* @__PURE__ */ J(al, [["render", rl]]), sl = {}, ul = {
1577
+ xmlns: "http://www.w3.org/2000/svg",
1578
+ width: "15px",
1579
+ height: "24",
1580
+ viewBox: "0 0 24 24",
1581
+ fill: "none",
1582
+ stroke: "currentColor",
1583
+ "stroke-width": "2",
1584
+ "stroke-linecap": "round",
1585
+ "stroke-linejoin": "round",
1586
+ class: "icon icon-tabler icons-tabler-outline icon-tabler-chevron-down text-gray-800 rotate-[90deg]"
1587
+ };
1588
+ function il(i, n) {
1589
+ return f(), w("svg", ul, n[0] || (n[0] = [
1590
+ u("path", {
1591
+ stroke: "none",
1592
+ d: "M0 0h24v24H0z",
1593
+ fill: "none"
1594
+ }, null, -1),
1595
+ u("path", { d: "M6 9l6 6l6 -6" }, null, -1)
1596
+ ]));
1597
+ }
1598
+ const dl = /* @__PURE__ */ J(sl, [["render", il]]), cl = {}, fl = {
1599
+ xmlns: "http://www.w3.org/2000/svg",
1600
+ width: "15px",
1601
+ height: "24",
1602
+ viewBox: "0 0 24 24",
1603
+ fill: "none",
1604
+ stroke: "currentColor",
1605
+ "stroke-width": "2",
1606
+ "stroke-linecap": "round",
1607
+ "stroke-linejoin": "round",
1608
+ class: "icon icon-tabler icons-tabler-outline icon-tabler-chevron-down text-gray-800 rotate-[270deg]"
1609
+ };
1610
+ function pl(i, n) {
1611
+ return f(), w("svg", fl, n[0] || (n[0] = [
1612
+ u("path", {
1613
+ stroke: "none",
1614
+ d: "M0 0h24v24H0z",
1615
+ fill: "none"
1616
+ }, null, -1),
1617
+ u("path", { d: "M6 9l6 6l6 -6" }, null, -1)
1618
+ ]));
1619
+ }
1620
+ const ml = /* @__PURE__ */ J(cl, [["render", pl]]), vl = { class: "flex" }, yl = { class: "mb-1" }, gl = { class: "mb-1" }, bl = { class: "inline-flex rounded-lg shrink-0 pl-1" }, hl = { class: "inline-flex rounded-lg shrink-0 pl-1" }, xl = {
1621
+ key: 1,
1622
+ class: "flex gap-1 !w-[75%] rounded-lg"
1623
+ }, kl = ["max", "disabled"], wl = ["min", "disabled"];
1624
+ const Cl = /* @__PURE__ */ O({
1625
+ __name: "date-input-inline",
1626
+ props: {
1627
+ id: {},
1628
+ name: {},
1629
+ type: {},
1630
+ label: {},
1631
+ width: {},
1632
+ options: {},
1633
+ placeHolder: {},
1634
+ api: {},
1635
+ data: {},
1636
+ default: {},
1637
+ modelValue: {},
1638
+ disabled: { type: Boolean },
1639
+ layout: { default: "inline" },
1640
+ cleanable: { type: Boolean },
1641
+ limit: {},
1642
+ multi: { type: Boolean },
1643
+ dataKey: {},
1644
+ valueKey: {},
1645
+ mode: {},
1646
+ labelKey: {},
1647
+ sort: {}
1648
+ },
1649
+ emits: ["update:modelValue", "change", "clear"],
1650
+ setup(i, { expose: n, emit: v }) {
1651
+ const t = i, s = v, r = _(null), {
1652
+ activeMode: d,
1653
+ innerValue: m,
1654
+ onSelectChange: c,
1655
+ nextClick: x,
1656
+ prevClick: p,
1657
+ currentLabel: a,
1658
+ clear: o
1659
+ } = Fe({
1660
+ ...t,
1661
+ popoverRef: r
1662
+ }, s);
1663
+ return M(() => t.modelValue, (h) => {
1664
+ h !== void 0 ? (m.value = h, s("update:modelValue", h)) : (d.value = "", m.value = []);
1665
+ }), n({
1666
+ clear: o,
1667
+ popoverRef: r
1668
+ }), (h, g) => (f(), w(R, null, [
1669
+ u("div", vl, [
1670
+ N(ge, {
1671
+ ref_key: "popoverRef",
1672
+ ref: r,
1673
+ label: e(a),
1674
+ "current-value": e(m),
1675
+ mode: h.mode,
1676
+ onClear: e(o),
1677
+ layout: h.layout
1678
+ }, {
1679
+ default: le(() => [
1680
+ u("div", null, [
1681
+ u("button", {
1682
+ type: "button",
1683
+ onClick: g[0] || (g[0] = (k) => e(c)("range")),
1684
+ class: "flex items-center justify-between w-full px-4 py-2 text-sm text-left rounded-lg cursor-pointer filter-date__item hs-selected:bg-stone-100 text-stone-800 hover:bg-stone-100 focus:outline-none focus:bg-stone-100"
1685
+ }, [
1686
+ g[12] || (g[12] = z(" Період ", -1)),
1687
+ e(d) === "range" ? (f(), S(te, { key: 0 })) : V("", !0)
1688
+ ])
1689
+ ]),
1690
+ g[19] || (g[19] = u("div", null, [
1691
+ u("div", { class: "pt-1 mt-1 border-t" })
1692
+ ], -1)),
1693
+ u("div", null, [
1694
+ u("button", {
1695
+ type: "button",
1696
+ onClick: g[1] || (g[1] = (k) => e(c)("today")),
1697
+ class: "flex items-center justify-between w-full px-4 py-2 text-sm text-left rounded-lg cursor-pointer filter-date__item hs-selected:bg-stone-100 text-stone-800 hover:bg-stone-100 focus:outline-none focus:bg-stone-100"
1698
+ }, [
1699
+ g[13] || (g[13] = z(" Сьогодні ", -1)),
1700
+ e(d) === "today" ? (f(), S(te, { key: 0 })) : V("", !0)
1701
+ ])
1702
+ ]),
1703
+ u("div", null, [
1704
+ u("button", {
1705
+ type: "button",
1706
+ onClick: g[2] || (g[2] = (k) => e(c)("week")),
1707
+ class: "flex items-center justify-between w-full px-4 py-2 text-sm text-left rounded-lg cursor-pointer filter-date__item hs-selected:bg-stone-100 text-stone-800 hover:bg-stone-100 focus:outline-none focus:bg-stone-100"
1708
+ }, [
1709
+ g[14] || (g[14] = z(" Тиждень ", -1)),
1710
+ e(d) === "week" ? (f(), S(te, { key: 0 })) : V("", !0)
1711
+ ])
1712
+ ]),
1713
+ u("div", null, [
1714
+ u("button", {
1715
+ type: "button",
1716
+ onClick: g[3] || (g[3] = (k) => e(c)("month")),
1717
+ class: "flex items-center justify-between w-full px-4 py-2 text-sm text-left rounded-lg cursor-pointer filter-date__item hs-selected:bg-stone-100 text-stone-800 hover:bg-stone-100 focus:outline-none focus:bg-stone-100"
1718
+ }, [
1719
+ g[15] || (g[15] = z(" Місяць ", -1)),
1720
+ e(d) === "month" ? (f(), S(te, { key: 0 })) : V("", !0)
1721
+ ])
1722
+ ]),
1723
+ u("div", null, [
1724
+ u("button", {
1725
+ type: "button",
1726
+ onClick: g[4] || (g[4] = (k) => e(c)("quarter")),
1727
+ class: "flex items-center justify-between w-full px-4 py-2 text-sm text-left rounded-lg cursor-pointer filter-date__item hs-selected:bg-stone-100 text-stone-800 hover:bg-stone-100 focus:outline-none focus:bg-stone-100"
1728
+ }, [
1729
+ g[16] || (g[16] = z(" Квартал ", -1)),
1730
+ e(d) === "quarter" ? (f(), S(te, { key: 0 })) : V("", !0)
1731
+ ])
1732
+ ]),
1733
+ u("div", yl, [
1734
+ u("button", {
1735
+ type: "button",
1736
+ onClick: g[5] || (g[5] = (k) => e(c)("year")),
1737
+ class: "flex items-center justify-between w-full px-4 py-2 text-sm text-left rounded-lg cursor-pointer filter-date__item hs-selected:bg-stone-100 text-stone-800 hover:bg-stone-100 focus:outline-none focus:bg-stone-100"
1738
+ }, [
1739
+ g[17] || (g[17] = z(" Рік ", -1)),
1740
+ e(d) === "year" ? (f(), S(te, { key: 0 })) : V("", !0)
1741
+ ])
1742
+ ]),
1743
+ u("div", gl, [
1744
+ u("button", {
1745
+ type: "button",
1746
+ onClick: g[6] || (g[6] = (k) => e(o)()),
1747
+ class: "flex items-center justify-between w-full px-4 py-2 text-sm text-left rounded-lg cursor-pointer filter-date__item hs-selected:bg-stone-100 text-stone-800 hover:bg-stone-100 focus:outline-none focus:bg-stone-100"
1748
+ }, [
1749
+ g[18] || (g[18] = z(" Весь час ", -1)),
1750
+ e(m)[0] ? V("", !0) : (f(), S(te, { key: 0 }))
1751
+ ])
1752
+ ])
1753
+ ]),
1754
+ _: 1,
1755
+ __: [19]
1756
+ }, 8, ["label", "current-value", "mode", "onClear", "layout"]),
1757
+ e(d) !== "" && e(d) !== "range" && e(d) !== "last_7_days" ? (f(), w(R, { key: 0 }, [
1758
+ u("div", bl, [
1759
+ u("button", {
1760
+ type: "button",
1761
+ title: "Попередній період",
1762
+ class: "inline-flex h-[38px] items-center px-2 text-sm text-gray-800 bg-gray-100 gap-x-2 -ms-px first:rounded-s-lg first:ms-0 last:rounded-e-lg focus:z-10 hover:bg-gray-200 focus:bg-gray-200 duration-300",
1763
+ onClick: g[7] || (g[7] = //@ts-ignore
1764
+ (...k) => e(p) && e(p)(...k))
1765
+ }, [
1766
+ N(dl)
1767
+ ])
1768
+ ]),
1769
+ u("div", hl, [
1770
+ u("button", {
1771
+ type: "button",
1772
+ title: "Наступний період",
1773
+ class: "inline-flex h-[38px] items-center px-2 text-sm text-gray-800 gap-x-2 bg-gray-100 -ms-px first:rounded-s-lg first:ms-0 last:rounded-e-lg focus:z-10 hover:bg-gray-200 focus:bg-gray-200 duration-300",
1774
+ onClick: g[8] || (g[8] = //@ts-ignore
1775
+ (...k) => e(x) && e(x)(...k))
1776
+ }, [
1777
+ N(ml)
1778
+ ])
1779
+ ])
1780
+ ], 64)) : V("", !0),
1781
+ e(d) !== "" && e(d) === "range" ? (f(), w("div", xl, [
1782
+ T(u("input", {
1783
+ type: "date",
1784
+ max: e(m)[1],
1785
+ locale: "uk-UA",
1786
+ "onUpdate:modelValue": g[9] || (g[9] = (k) => e(m)[0] = k),
1787
+ class: "px-2 p-0 border text-[12px] max-w-[calc(50%-5px)] h-[38px] rounded-lg focus:outline-blue-600",
1788
+ disabled: h.disabled
1789
+ }, null, 8, kl), [
1790
+ [G, e(m)[0]]
1791
+ ]),
1792
+ T(u("input", {
1793
+ type: "date",
1794
+ min: e(m)[0],
1795
+ locale: "uk-UA",
1796
+ "onUpdate:modelValue": g[10] || (g[10] = (k) => e(m)[1] = k),
1797
+ class: "px-2 p-0 border text-[12px] max-w-[calc(50%-5px)] h-[38px] rounded-lg focus:outline-blue-600 appearance-auto",
1798
+ disabled: h.disabled
1799
+ }, null, 8, wl), [
1800
+ [G, e(m)[1]]
1801
+ ])
1802
+ ])) : V("", !0)
1803
+ ]),
1804
+ (h.cleanable, V("", !0))
1805
+ ], 64));
1806
+ }
1807
+ }), ke = {
1808
+ radio: nt,
1809
+ checkbox: xe,
1810
+ check: xe,
1811
+ text: bt,
1812
+ range: At,
1813
+ date: Ht,
1814
+ select: Xt,
1815
+ tag: ol,
1816
+ "date:inline": Cl
1817
+ };
1818
+ function be(i, n) {
1819
+ let v;
1820
+ switch (i.toLowerCase()) {
1821
+ case "autocomplete":
1822
+ v = "select";
1823
+ break;
1824
+ case "check":
1825
+ v = "checkbox";
1826
+ break;
1827
+ default:
1828
+ v = i?.toString().toLowerCase();
1829
+ }
1830
+ return v === "date" && n && n === "inline" && (v = "date:inline"), {
1831
+ component: ke[v] || ke.text,
1832
+ type: v
1833
+ };
1834
+ }
1835
+ const Vl = {}, _l = {
1836
+ xmlns: "http://www.w3.org/2000/svg",
1837
+ width: "15px",
1838
+ height: "24",
1839
+ viewBox: "0 0 24 24",
1840
+ fill: "none",
1841
+ stroke: "currentColor",
1842
+ "stroke-width": "2",
1843
+ "stroke-linecap": "round",
1844
+ "stroke-linejoin": "round",
1845
+ class: "icon icon-tabler icons-tabler-outline icon-tabler-reload absolute inline mr-1 text-gray-800 transition-all cursor-pointer active:rotate-90 right-1 top-1 hover:text-blue-500"
1846
+ };
1847
+ function $l(i, n) {
1848
+ return f(), w("svg", _l, n[0] || (n[0] = [
1849
+ u("path", {
1850
+ stroke: "none",
1851
+ d: "M0 0h24v24H0z",
1852
+ fill: "none"
1853
+ }, null, -1),
1854
+ u("path", { d: "M19.933 13.041a8 8 0 1 1 -9.925 -8.788c3.899 -1 7.935 1.007 9.425 4.747" }, null, -1),
1855
+ u("path", { d: "M20 4v5h-5" }, null, -1)
1856
+ ]));
1857
+ }
1858
+ const Al = /* @__PURE__ */ J(Vl, [["render", $l]]), Bl = { style: { display: "inline-flex", margin: "0px", width: "100%" } }, Sl = { class: "relative w-full mb-2 p-4 bg-white rounded-lg shadow-sm" }, Dl = { class: "block mb-3 text-sm font-medium text-gray-800 dark:text-neutral-200" }, Rl = { class: "flex items-center" }, Ml = { class: "text-sm font-medium max-w-[80%] text-gray-800 flex items-center gap-x-1" }, Kl = { class: "filter-layout__body" }, Fl = /* @__PURE__ */ O({
1859
+ __name: "vertical-layout",
1860
+ props: {
1861
+ id: {},
1862
+ name: {},
1863
+ type: {},
1864
+ label: {},
1865
+ width: {},
1866
+ options: {},
1867
+ placeHolder: {},
1868
+ api: {},
1869
+ data: {},
1870
+ default: {},
1871
+ modelValue: {},
1872
+ disabled: { type: Boolean },
1873
+ layout: {},
1874
+ cleanable: { type: Boolean },
1875
+ limit: {},
1876
+ multi: { type: Boolean },
1877
+ dataKey: {},
1878
+ valueKey: {},
1879
+ mode: {},
1880
+ labelKey: {},
1881
+ sort: {}
1882
+ },
1883
+ emits: ["update:modelValue", "change", "clear"],
1884
+ setup(i, { expose: n, emit: v }) {
1885
+ const t = i, s = v, r = _(), d = be(t.type, t.layout), m = I({
1886
+ get: () => t.modelValue,
1887
+ set: (a) => s("update:modelValue", a)
1888
+ });
1889
+ function c(a) {
1890
+ s("clear", a);
1891
+ }
1892
+ function x(a, o) {
1893
+ s("change", { name: a, value: o }), t.modelValue !== void 0 && s("update:modelValue", o);
1894
+ }
1895
+ function p() {
1896
+ r.value && r.value.clear(), s("clear", t.name);
1897
+ }
1898
+ return M(
1899
+ () => t.default,
1900
+ (a) => {
1901
+ m.value = a;
1902
+ }
1903
+ ), M(
1904
+ () => t.modelValue,
1905
+ (a) => {
1906
+ m.value = a;
1907
+ }
1908
+ ), n({
1909
+ filterRef: r
1910
+ }), (a, o) => (f(), w("div", Bl, [
1911
+ u("div", Sl, [
1912
+ u("div", Dl, [
1913
+ u("div", Rl, [
1914
+ u("span", Ml, F(a.label), 1)
1915
+ ]),
1916
+ typeof m.value == "string" && m.value.trim() !== "" || Array.isArray(m.value) && m.value.length > 0 && m.value.some((h) => h !== void 0) || m.value === null ? (f(), S(Al, {
1917
+ key: 0,
1918
+ onClick: p
1919
+ })) : V("", !0)
1920
+ ]),
1921
+ u("div", Kl, [
1922
+ e(d)?.type !== "select" ? (f(), S(ee(e(d)?.component), P({ key: 0 }, t, {
1923
+ type: e(d)?.type,
1924
+ onChange: o[0] || (o[0] = (h) => x(h.name, h.value)),
1925
+ onClear: o[1] || (o[1] = (h) => c(h)),
1926
+ ref_key: "filterRef",
1927
+ ref: r
1928
+ }), null, 16, ["type"])) : (f(), S(ge, {
1929
+ key: 1,
1930
+ "current-value": m.value,
1931
+ label: a.label,
1932
+ mode: a.mode,
1933
+ onClear: p,
1934
+ fieldRef: r.value,
1935
+ width: void 0,
1936
+ disabled: a.disabled,
1937
+ layout: "vertical"
1938
+ }, {
1939
+ default: le(() => [
1940
+ (f(), S(ee(e(d)?.component), P({
1941
+ ref_key: "filterRef",
1942
+ ref: r
1943
+ }, t, {
1944
+ type: e(d)?.type,
1945
+ onChange: o[2] || (o[2] = (h) => x(h.name, h.value)),
1946
+ onClear: o[3] || (o[3] = (h) => c(h))
1947
+ }), null, 16, ["type"]))
1948
+ ]),
1949
+ _: 1
1950
+ }, 8, ["current-value", "label", "mode", "fieldRef", "disabled"]))
1951
+ ])
1952
+ ])
1953
+ ]));
1954
+ }
1955
+ }), we = /* @__PURE__ */ O({
1956
+ __name: "inline-layout",
1957
+ props: {
1958
+ id: {},
1959
+ name: {},
1960
+ type: {},
1961
+ label: {},
1962
+ width: {},
1963
+ options: {},
1964
+ placeHolder: {},
1965
+ api: {},
1966
+ data: {},
1967
+ default: {},
1968
+ modelValue: {},
1969
+ disabled: { type: Boolean },
1970
+ layout: {},
1971
+ cleanable: { type: Boolean },
1972
+ limit: {},
1973
+ multi: { type: Boolean },
1974
+ dataKey: {},
1975
+ valueKey: {},
1976
+ mode: {},
1977
+ labelKey: {},
1978
+ sort: {}
1979
+ },
1980
+ emits: ["update:modelValue", "change", "clear"],
1981
+ setup(i, { expose: n, emit: v }) {
1982
+ const t = i, s = v, r = _(), d = be(t.type, t.layout), m = I({
1983
+ get: () => t.modelValue,
1984
+ set: (a) => s("update:modelValue", a)
1985
+ });
1986
+ function c(a) {
1987
+ s("clear", a);
1988
+ }
1989
+ function x(a, o) {
1990
+ s("change", { name: a, value: o }), t.modelValue !== void 0 && s("update:modelValue", o);
1991
+ }
1992
+ function p() {
1993
+ r.value && r.value.clear(), s("clear", t.name);
1994
+ }
1995
+ return M(
1996
+ () => t.default,
1997
+ (a) => {
1998
+ m.value = a;
1999
+ }
2000
+ ), M(
2001
+ () => t.modelValue,
2002
+ (a) => {
2003
+ m.value = a;
2004
+ }
2005
+ ), n({
2006
+ filterRef: r
2007
+ }), (a, o) => ["text", "date"].includes(a.type.toLocaleLowerCase()) ? (f(), S(ee(e(d)?.component), P({ key: 0 }, t, {
2008
+ type: e(d)?.type,
2009
+ onChange: o[0] || (o[0] = (h) => x(h.name, h.value)),
2010
+ onClear: o[1] || (o[1] = (h) => c(h)),
2011
+ disabled: a.disabled,
2012
+ modelValue: m.value,
2013
+ "onUpdate:modelValue": o[2] || (o[2] = (h) => m.value = h)
2014
+ }), null, 16, ["type", "disabled", "modelValue"])) : (f(), S(ge, {
2015
+ key: 1,
2016
+ "current-value": m.value,
2017
+ label: a.label,
2018
+ mode: a.mode,
2019
+ onClear: p,
2020
+ fieldRef: r.value,
2021
+ width: t.width,
2022
+ disabled: a.disabled,
2023
+ layout: "inline"
2024
+ }, {
2025
+ default: le(() => [
2026
+ (f(), S(ee(e(d)?.component), P({
2027
+ ref_key: "filterRef",
2028
+ ref: r
2029
+ }, t, {
2030
+ modelValue: m.value,
2031
+ "onUpdate:modelValue": o[3] || (o[3] = (h) => m.value = h),
2032
+ type: e(d)?.type,
2033
+ onChange: o[4] || (o[4] = (h) => x(h.name, h.value)),
2034
+ onClear: o[5] || (o[5] = (h) => c(h))
2035
+ }), null, 16, ["modelValue", "type"]))
2036
+ ]),
2037
+ _: 1
2038
+ }, 8, ["current-value", "label", "mode", "fieldRef", "width", "disabled"]));
2039
+ }
2040
+ }), jl = /* @__PURE__ */ O({
2041
+ __name: "popover-layout",
2042
+ props: {
2043
+ id: {},
2044
+ name: {},
2045
+ type: {},
2046
+ label: {},
2047
+ width: {},
2048
+ options: {},
2049
+ placeHolder: {},
2050
+ api: {},
2051
+ data: {},
2052
+ default: {},
2053
+ modelValue: {},
2054
+ disabled: { type: Boolean },
2055
+ layout: {},
2056
+ cleanable: { type: Boolean },
2057
+ limit: {},
2058
+ multi: { type: Boolean },
2059
+ dataKey: {},
2060
+ valueKey: {},
2061
+ mode: {},
2062
+ labelKey: {},
2063
+ sort: {}
2064
+ },
2065
+ emits: ["update:modelValue", "change", "clear"],
2066
+ setup(i, { expose: n, emit: v }) {
2067
+ const t = i, s = v, r = _(), d = _(be(t.type, t.layout)), m = I({
2068
+ get: () => t.modelValue,
2069
+ set: (p) => s("update:modelValue", p)
2070
+ });
2071
+ function c(p) {
2072
+ s("clear", p);
2073
+ }
2074
+ function x(p, a) {
2075
+ s("change", { name: p, value: a }), t.modelValue !== void 0 && s("update:modelValue", a);
2076
+ }
2077
+ return M(
2078
+ () => t.default,
2079
+ (p) => {
2080
+ m.value = p;
2081
+ }
2082
+ ), M(
2083
+ () => t.modelValue,
2084
+ (p) => {
2085
+ m.value = p;
2086
+ }
2087
+ ), M(
2088
+ () => t,
2089
+ (p) => {
2090
+ m.value = p;
2091
+ }
2092
+ ), n({
2093
+ filterRef: r
2094
+ }), (p, a) => (f(), S(ee(d.value?.component), P(t, {
2095
+ type: d.value?.type,
2096
+ modelValue: m.value,
2097
+ "onUpdate:modelValue": a[0] || (a[0] = (o) => m.value = o),
2098
+ onChange: a[1] || (a[1] = (o) => x(o.name, o.value)),
2099
+ onClear: a[2] || (a[2] = (o) => c(o)),
2100
+ ref_key: "filterRef",
2101
+ ref: r
2102
+ }), null, 16, ["type", "modelValue"]));
2103
+ }
2104
+ }), ae = /* @__PURE__ */ O({
2105
+ __name: "filter-field",
2106
+ props: {
2107
+ id: {},
2108
+ name: {},
2109
+ type: {},
2110
+ label: {},
2111
+ width: {},
2112
+ options: { default: () => [] },
2113
+ placeHolder: {},
2114
+ api: {},
2115
+ data: {},
2116
+ default: {},
2117
+ modelValue: {},
2118
+ disabled: { type: Boolean, default: !1 },
2119
+ layout: { default: "inline" },
2120
+ cleanable: { type: Boolean },
2121
+ limit: { default: 10 },
2122
+ multi: { type: Boolean, default: !0 },
2123
+ dataKey: {},
2124
+ valueKey: {},
2125
+ mode: {},
2126
+ labelKey: {},
2127
+ sort: { default: "name" }
2128
+ },
2129
+ emits: ["update:modelValue", "change", "clear"],
2130
+ setup(i, { expose: n, emit: v }) {
2131
+ const t = i, s = v, r = _(), d = I({
2132
+ get: () => t.modelValue,
2133
+ set: (p) => s("update:modelValue", p)
2134
+ });
2135
+ function m(p) {
2136
+ s("clear", p);
2137
+ }
2138
+ function c(p, a) {
2139
+ s("change", { name: p, value: a }), t.modelValue !== void 0 && s("update:modelValue", a);
2140
+ }
2141
+ M(
2142
+ () => t.default,
2143
+ (p) => {
2144
+ d.value = p;
2145
+ }
2146
+ ), M(
2147
+ () => t.modelValue,
2148
+ (p) => {
2149
+ d.value = p;
2150
+ }
2151
+ ), n({
2152
+ filterRef: r
2153
+ });
2154
+ function x() {
2155
+ switch (t.layout) {
2156
+ case "inline":
2157
+ return we;
2158
+ case "vertical":
2159
+ return Fl;
2160
+ case "popover":
2161
+ return jl;
2162
+ default:
2163
+ return we;
2164
+ }
2165
+ }
2166
+ return (p, a) => (f(), S(ee(x()), P(t, {
2167
+ onChange: a[0] || (a[0] = (o) => c(o.name, o.value)),
2168
+ onClear: a[1] || (a[1] = (o) => m(o)),
2169
+ modelValue: d.value,
2170
+ "onUpdate:modelValue": a[2] || (a[2] = (o) => d.value = o)
2171
+ }), null, 16, ["modelValue"]));
2172
+ }
2173
+ });
2174
+ function he(i, n) {
2175
+ const {
2176
+ slots: v
2177
+ } = i, t = _(i.value ?? {}), s = I(() => (Z(v?.default?.()) ?? []).flatMap((l) => Array.isArray(l.children) ? l.children : [l]));
2178
+ function r(C) {
2179
+ delete t.value[C], n("clear", {
2180
+ data: Z(t.value),
2181
+ name: C
2182
+ });
2183
+ }
2184
+ function d(C, l) {
2185
+ l === void 0 ? (r(C), n("change", {
2186
+ data: Z(t.value),
2187
+ name: C,
2188
+ undefined: void 0
2189
+ })) : t.value = {
2190
+ ...t.value,
2191
+ [C]: l
2192
+ }, n("change", {
2193
+ data: Z(t.value),
2194
+ name: C,
2195
+ value: l
2196
+ });
2197
+ }
2198
+ const m = I(() => s.value.map((C) => {
2199
+ const l = C.props?.name;
2200
+ return Ie(C, {
2201
+ ...C.props,
2202
+ layout: i.view,
2203
+ showClean: !0,
2204
+ modelValue: t[l],
2205
+ "onUpdate:modelValue": (b) => {
2206
+ d(l, b);
2207
+ },
2208
+ onClear: () => r(l)
2209
+ });
2210
+ })), c = I(
2211
+ () => new Map(
2212
+ m.value.map((C) => {
2213
+ const l = C.props?.name;
2214
+ return l ? [l, C] : null;
2215
+ }).filter((C) => C !== null)
2216
+ )
2217
+ );
2218
+ function x() {
2219
+ t.value = {}, n("clearAll", {
2220
+ data: Z(t.value),
2221
+ name: "ALL"
2222
+ });
2223
+ }
2224
+ const p = _(""), a = I(() => i.schema?.value ? Object.entries(t.value).filter(([C, l]) => i.schema && !(C in i.schema.value) ? !1 : Array.isArray(l) ? l.some((b) => b !== "" && b !== void 0) : l !== "" && l !== void 0).length : 0), o = _();
2225
+ M(p, async () => {
2226
+ await fe(), o?.value?.filterRef?.inputTextRef && o.value.filterRef.inputTextRef.focus();
2227
+ });
2228
+ const h = I(() => i.schema?.value ? Object.fromEntries(Object.entries(i.schema?.value).slice(0, i.limit)) : {}), g = I(() => i.schema?.value ? i.view !== "inline" ? i.schema?.value : Object.fromEntries(Object.entries(i.schema?.value).slice(i.limit)) : {}), k = I(() => {
2229
+ if (m.value.length === 0) return [];
2230
+ let C = 0;
2231
+ if (i.schema?.value) {
2232
+ const l = Object.entries(i.schema.value).length;
2233
+ l < i.limit ? C = i.limit - l : C = 0;
2234
+ }
2235
+ return m.value.slice(0, C);
2236
+ }), y = I(() => m.value.length === 0 ? [] : i.view !== "inline" ? m.value : m.value.slice(k.value.length));
2237
+ function $() {
2238
+ if (g.value) {
2239
+ const [C] = Object.keys(g.value);
2240
+ p.value = C;
2241
+ } else y.value.length > 0 ? p.value = y.value[0].props.name : p.value = "";
2242
+ }
2243
+ return {
2244
+ activeFilter: t,
2245
+ activeFilterCount: a,
2246
+ onFilterChange: d,
2247
+ clearFilter: r,
2248
+ clearAllFilters: x,
2249
+ limitedSchema: h,
2250
+ popoverSchema: g,
2251
+ filtersSlot: m,
2252
+ limitedFiltersSlot: k,
2253
+ popoverFiltersSlot: y,
2254
+ vnodeMap: c,
2255
+ onPopoverOpen: $,
2256
+ selectedFilter: p,
2257
+ filterRef: o
2258
+ };
2259
+ }
2260
+ const Ll = /* @__PURE__ */ O({
2261
+ __name: "popover",
2262
+ emits: ["open", "close"],
2263
+ setup(i, { emit: n }) {
2264
+ const v = _(!1), t = _(null), s = _(null), r = _(null), d = _({ top: "0px", left: "0px", position: "absolute" });
2265
+ function m() {
2266
+ v.value = !v.value;
2267
+ }
2268
+ function c() {
2269
+ const o = r.value, h = t.value;
2270
+ if (!o || !h) return;
2271
+ const g = o.getBoundingClientRect(), k = h.offsetWidth, y = window.innerWidth - g.left;
2272
+ let $ = g.left + window.scrollX;
2273
+ k > y && ($ = window.innerWidth - k - 8, $ < 8 && ($ = 8)), d.value = {
2274
+ position: "absolute",
2275
+ top: `${g.bottom + window.scrollY + 8}px`,
2276
+ left: `${$}px`
2277
+ };
2278
+ }
2279
+ function x(o) {
2280
+ const h = o.target;
2281
+ !r.value?.contains(o.target) && !t.value?.contains(o.target) && !h.closest("[data-inside-popover]") && (v.value = !1);
2282
+ }
2283
+ const p = _(!1);
2284
+ ne(() => {
2285
+ p.value = !0;
2286
+ }), ne(() => {
2287
+ r.value = s.value?.querySelector("[data-popover-trigger]") || null, r.value?.addEventListener("click", m), document.addEventListener("click", x), window.addEventListener("resize", c), window.addEventListener("scroll", c, !0);
2288
+ }), ce(() => {
2289
+ r.value?.removeEventListener("click", m), document.removeEventListener("click", x), window.removeEventListener("resize", c), window.removeEventListener("scroll", c, !0);
2290
+ });
2291
+ const a = n;
2292
+ return M(v, async (o) => {
2293
+ o ? (a("open"), await fe(), c()) : a("close");
2294
+ }), (o, h) => (f(), w("div", {
2295
+ ref_key: "wrapperRef",
2296
+ ref: s
2297
+ }, [
2298
+ ue(o.$slots, "trigger"),
2299
+ p.value ? (f(), S($e, {
2300
+ key: 0,
2301
+ to: "body"
2302
+ }, [
2303
+ T(u("div", {
2304
+ ref_key: "popoverRef",
2305
+ ref: t,
2306
+ class: "absolute z-[50] w-[600px] rounded-md border bg-white shadow-md",
2307
+ style: Ae(d.value)
2308
+ }, [
2309
+ ue(o.$slots, "default")
2310
+ ], 4), [
2311
+ [X, v.value]
2312
+ ])
2313
+ ])) : V("", !0)
2314
+ ], 512));
2315
+ }
2316
+ }), El = {}, Il = {
2317
+ xmlns: "http://www.w3.org/2000/svg",
2318
+ width: "24",
2319
+ height: "24",
2320
+ viewBox: "0 0 24 24",
2321
+ fill: "none",
2322
+ stroke: "currentColor",
2323
+ "stroke-width": "2",
2324
+ "stroke-linecap": "round",
2325
+ "stroke-linejoin": "round",
2326
+ class: "lucide lucide-filter h-4 w-4"
2327
+ };
2328
+ function Tl(i, n) {
2329
+ return f(), w("svg", Il, n[0] || (n[0] = [
2330
+ u("polygon", { points: "22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3" }, null, -1)
2331
+ ]));
2332
+ }
2333
+ const Ol = /* @__PURE__ */ J(El, [["render", Tl]]), Ul = {
2334
+ key: 0,
2335
+ class: "inline-flex rounded-sm items-center border font-semibold border-transparent hover:bg-secondary/80 bg-blue-500 text-white text-xs px-1.5"
2336
+ }, zl = { class: "flex" }, Nl = { class: "w-64 border-r border-gray-200" }, Hl = { class: "p-2" }, Yl = ["onClick"], Pl = { class: "flex items-center gap-2" }, Wl = { class: "text-sm font-medium" }, ql = {
2337
+ key: 0,
2338
+ class: "inline-flex items-center rounded-full border font-semibold transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent hover:bg-secondary/80 bg-blue-100 text-blue-700 text-xs p-2"
2339
+ }, Ql = ["onClick"], Gl = { class: "flex items-center gap-2" }, Xl = { class: "text-sm font-medium" }, Jl = {
2340
+ key: 0,
2341
+ class: "inline-flex items-center rounded-full border font-semibold transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent hover:bg-secondary/80 bg-blue-100 text-blue-700 text-xs p-2"
2342
+ }, Zl = {
2343
+ key: 0,
2344
+ class: "p-2 border-t"
2345
+ }, eo = { class: "flex-1 min-h-[300px] overflow-y-auto" }, to = {
2346
+ key: 0,
2347
+ class: "flex items-center justify-center h-full text-gray-500"
2348
+ }, je = /* @__PURE__ */ O({
2349
+ __name: "popover-filter-layout",
2350
+ props: {
2351
+ schema: {},
2352
+ view: {},
2353
+ value: {},
2354
+ history: { type: Boolean },
2355
+ mode: {},
2356
+ limit: { default: 3 }
2357
+ },
2358
+ emits: ["change", "clear", "clearAll"],
2359
+ setup(i, { expose: n, emit: v }) {
2360
+ const t = i, s = Ke(t.mode), r = pe(), d = v, m = _({}), {
2361
+ activeFilter: c,
2362
+ activeFilterCount: x,
2363
+ onFilterChange: p,
2364
+ clearFilter: a,
2365
+ clearAllFilters: o,
2366
+ popoverSchema: h,
2367
+ popoverFiltersSlot: g,
2368
+ onPopoverOpen: k,
2369
+ selectedFilter: y,
2370
+ filterRef: $
2371
+ } = he({
2372
+ ...t,
2373
+ schema: m,
2374
+ slots: r
2375
+ }, d);
2376
+ return M(
2377
+ () => t.schema,
2378
+ (C) => {
2379
+ m.value = C;
2380
+ },
2381
+ { deep: !0, immediate: !0 }
2382
+ ), n({
2383
+ clearFilter: a,
2384
+ clearAllFilters: o
2385
+ }), (C, l) => (f(), S(Ll, {
2386
+ onOpen: e(k),
2387
+ onClose: l[5] || (l[5] = (b) => y.value = "")
2388
+ }, {
2389
+ trigger: le(() => [
2390
+ u("button", {
2391
+ "data-popover-trigger": "",
2392
+ "aria-haspopup": "dialog",
2393
+ "aria-expanded": "false",
2394
+ class: D(
2395
+ e(s) + (e(x) > 0 ? "bg-blue-50 border-blue-200 text-blue-700 hover:bg-blue-100" : "text-gray-800 hover:bg-gray-200 focus:bg-gray-200")
2396
+ ),
2397
+ type: "button"
2398
+ }, [
2399
+ N(Ol),
2400
+ l[6] || (l[6] = z(" Фільтр ", -1)),
2401
+ e(x) > 0 ? (f(), w("div", Ul, F(e(x)), 1)) : V("", !0)
2402
+ ], 2)
2403
+ ]),
2404
+ default: le(() => [
2405
+ u("div", zl, [
2406
+ u("div", Nl, [
2407
+ l[7] || (l[7] = u("div", { class: "p-4 border-b" }, [
2408
+ u("p", { class: "text-sm text-gray-600" }, "Select a field to start creating a filter.")
2409
+ ], -1)),
2410
+ u("div", Hl, [
2411
+ C.schema ? (f(!0), w(R, { key: 0 }, W(Object.entries(e(h)), ([b, K]) => (f(), w("button", {
2412
+ key: b,
2413
+ onClick: () => {
2414
+ y.value = b;
2415
+ },
2416
+ class: D([
2417
+ "w-full flex items-center justify-between px-3 py-2 text-left hover:bg-gray-50 transition-colors",
2418
+ e(y) === b ? "bg-blue-50 text-blue-700 border-l-2 border-blue-500" : ""
2419
+ ])
2420
+ }, [
2421
+ u("div", Pl, [
2422
+ u("span", Wl, F(K.label), 1)
2423
+ ]),
2424
+ (Array.isArray(e(c)[b]) ? e(c)[b]?.length > 0 : e(c)[b] || e(c)[b] === null) ? (f(), w("div", ql)) : V("", !0)
2425
+ ], 10, Yl))), 128)) : V("", !0),
2426
+ (f(!0), w(R, null, W(e(g), (b, K) => (f(), w("button", {
2427
+ key: "slot-" + K,
2428
+ onClick: (A) => y.value = b.props.name,
2429
+ class: D([
2430
+ "w-full flex items-center justify-between px-3 py-2 text-left hover:bg-gray-50 transition-colors",
2431
+ e(y) === b.props.name ? "bg-blue-50 text-blue-700 border-l-2 border-blue-500" : ""
2432
+ ])
2433
+ }, [
2434
+ u("div", Gl, [
2435
+ u("span", Xl, F(b.props.label), 1)
2436
+ ]),
2437
+ e(c)[b.props.name]?.length > 0 ? (f(), w("div", Jl)) : V("", !0)
2438
+ ], 10, Ql))), 128))
2439
+ ]),
2440
+ e(x) > 0 ? (f(), w("div", Zl, [
2441
+ u("button", {
2442
+ class: "w-full px-3 py-2 text-left text-sm text-gray-600 hover:bg-gray-50 transition-colors",
2443
+ onClick: l[0] || (l[0] = //@ts-ignore
2444
+ (...b) => e(o) && e(o)(...b)),
2445
+ "data-inside-popover": ""
2446
+ }, " Очистити всі ")
2447
+ ])) : V("", !0)
2448
+ ]),
2449
+ u("div", eo, [
2450
+ e(y) === "" ? (f(), w("div", to, l[8] || (l[8] = [
2451
+ u("p", { class: "text-sm" }, "Select a field to start creating a filter.", -1)
2452
+ ]))) : V("", !0),
2453
+ e(y) ? (f(), w(R, { key: 1 }, [
2454
+ e(h) ? (f(!0), w(R, { key: 0 }, W(Object.entries(e(h)), ([b, K]) => (f(), w(R, null, [
2455
+ e(y) === b ? (f(), S(ae, P({
2456
+ name: b,
2457
+ key: b,
2458
+ layout: "popover",
2459
+ ref_for: !0,
2460
+ ref_key: "filterRef",
2461
+ ref: $
2462
+ }, { ref_for: !0 }, K, {
2463
+ onChange: l[1] || (l[1] = (A) => e(p)(A.name, A.value)),
2464
+ onClear: l[2] || (l[2] = (A) => {
2465
+ e(a)(A), e(p)(A, void 0);
2466
+ }),
2467
+ modelValue: e(c)[b],
2468
+ "onUpdate:modelValue": (A) => e(c)[b] = A,
2469
+ cleanable: !0
2470
+ }), null, 16, ["name", "modelValue", "onUpdate:modelValue"])) : V("", !0)
2471
+ ], 64))), 256)) : V("", !0),
2472
+ (f(!0), w(R, null, W(e(g), (b, K) => (f(), w(R, {
2473
+ key: "slot-" + K
2474
+ }, [
2475
+ e(y) === b.props.name ? (f(), S(ae, P({
2476
+ key: 0,
2477
+ layout: "popover"
2478
+ }, { ref_for: !0 }, b.props, {
2479
+ ref_for: !0,
2480
+ ref_key: "filterRef",
2481
+ ref: $,
2482
+ onChange: l[3] || (l[3] = (A) => e(p)(A.name, A.value)),
2483
+ onClear: l[4] || (l[4] = (A) => {
2484
+ e(a)(A), e(p)(A, void 0);
2485
+ }),
2486
+ modelValue: e(c)[b.props.name],
2487
+ "onUpdate:modelValue": (A) => e(c)[b.props.name] = A,
2488
+ cleanable: !0
2489
+ }), null, 16, ["modelValue", "onUpdate:modelValue"])) : V("", !0)
2490
+ ], 64))), 128))
2491
+ ], 64)) : V("", !0)
2492
+ ])
2493
+ ])
2494
+ ]),
2495
+ _: 1
2496
+ }, 8, ["onOpen"]));
2497
+ }
2498
+ }), lo = { class: "flex gap-1 items-center flex-wrap" }, Ce = /* @__PURE__ */ O({
2499
+ __name: "inline-filter-layout",
2500
+ props: {
2501
+ schema: {},
2502
+ view: {},
2503
+ value: {},
2504
+ history: { type: Boolean },
2505
+ mode: {},
2506
+ limit: { default: 3 }
2507
+ },
2508
+ emits: ["change", "clear", "clearAll"],
2509
+ setup(i, { emit: n }) {
2510
+ const v = i, t = n, s = pe(), r = _({}), {
2511
+ activeFilter: d,
2512
+ activeFilterCount: m,
2513
+ onFilterChange: c,
2514
+ clearFilter: x,
2515
+ clearAllFilters: p,
2516
+ limitedSchema: a,
2517
+ popoverSchema: o,
2518
+ filtersSlot: h,
2519
+ limitedFiltersSlot: g,
2520
+ popoverFiltersSlot: k
2521
+ } = he(
2522
+ {
2523
+ ...v,
2524
+ schema: r,
2525
+ slots: s
2526
+ },
2527
+ t
2528
+ ), y = _();
2529
+ function $() {
2530
+ y.value && y.value.clearAllFilters(), p();
2531
+ }
2532
+ return M(
2533
+ () => v.schema,
2534
+ (C) => {
2535
+ r.value = C;
2536
+ },
2537
+ { deep: !0, immediate: !0 }
2538
+ ), (C, l) => (f(), w("div", lo, [
2539
+ C.schema ? (f(!0), w(R, { key: 0 }, W(Object.entries(e(a)), ([b, K]) => (f(), S(ae, P({
2540
+ key: b,
2541
+ name: b,
2542
+ mode: C.mode
2543
+ }, { ref_for: !0 }, K, {
2544
+ onChange: l[0] || (l[0] = (A) => e(c)(A.name, A.value)),
2545
+ onClear: l[1] || (l[1] = (A) => {
2546
+ e(x)(A), e(c)(A, void 0);
2547
+ }),
2548
+ layout: "inline",
2549
+ cleanable: !0,
2550
+ modelValue: e(d)[b],
2551
+ "onUpdate:modelValue": (A) => e(d)[b] = A
2552
+ }), null, 16, ["name", "mode", "modelValue", "onUpdate:modelValue"]))), 128)) : V("", !0),
2553
+ (f(!0), w(R, null, W(e(g), (b, K) => (f(), S(ae, P({
2554
+ key: "slot-" + K,
2555
+ layout: "inline"
2556
+ }, { ref_for: !0 }, b.props, {
2557
+ onChange: l[2] || (l[2] = (A) => e(c)(A.name, A.value)),
2558
+ onClear: l[3] || (l[3] = (A) => {
2559
+ e(x)(A), e(c)(A, void 0);
2560
+ }),
2561
+ cleanable: !0,
2562
+ modelValue: e(d)[b.props.name],
2563
+ "onUpdate:modelValue": (A) => e(d)[b.props.name] = A
2564
+ }), null, 16, ["modelValue", "onUpdate:modelValue"]))), 128)),
2565
+ Object.entries(e(o)).length > 0 || e(k).length > 0 ? (f(), S(je, P({ key: 1 }, v, {
2566
+ schema: e(o),
2567
+ limit: 0,
2568
+ onChange: l[4] || (l[4] = (b) => e(c)(b.name, b.value)),
2569
+ onClearAll: e(p),
2570
+ onClear: l[5] || (l[5] = (b) => e(x)(b.name)),
2571
+ mode: C.mode,
2572
+ ref_key: "popoverRef",
2573
+ ref: y,
2574
+ cleanable: !0
2575
+ }), {
2576
+ default: le(() => [
2577
+ (f(!0), w(R, null, W(e(h), (b, K) => (f(), S(ee(b), P({
2578
+ key: "slot-" + K,
2579
+ layout: "popover"
2580
+ }, { ref_for: !0 }, b.props, { cleanable: !0 }), null, 16))), 128))
2581
+ ]),
2582
+ _: 1
2583
+ }, 16, ["schema", "onClearAll", "mode"])) : V("", !0),
2584
+ e(m) > 0 ? (f(), w("button", {
2585
+ key: 2,
2586
+ onClick: $,
2587
+ class: "relative py-2 px-3 inline-flex justify-center items-center gap-x-2 text-sm font-medium rounded-lg bg-gray-100 border border-transparent text-gray-800 hover:bg-gray-200 focus:bg-gray-200"
2588
+ }, " Очистити ")) : V("", !0)
2589
+ ]));
2590
+ }
2591
+ }), oo = {
2592
+ key: 0,
2593
+ class: "p-2 overflow-y-auto overflow-hidden [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500 dark:bg-neutral-800 max-h-[calc(100%-142px)] h-full bg-gray-100"
2594
+ }, ao = { class: "flex items-center vst-filters vsTailwind flex-col w-full" }, no = /* @__PURE__ */ O({
2595
+ __name: "vertical-filter-layout",
2596
+ props: {
2597
+ schema: {},
2598
+ view: {},
2599
+ value: {},
2600
+ history: { type: Boolean },
2601
+ mode: {},
2602
+ limit: { default: 3 }
2603
+ },
2604
+ emits: ["change", "clear", "clearAll"],
2605
+ setup(i, { emit: n }) {
2606
+ const v = i, t = n, s = pe(), {
2607
+ activeFilter: r,
2608
+ activeFilterCount: d,
2609
+ onFilterChange: m,
2610
+ clearFilter: c,
2611
+ clearAllFilters: x,
2612
+ filtersSlot: p
2613
+ } = he({
2614
+ ...v,
2615
+ slots: s
2616
+ }, t);
2617
+ return (a, o) => a.view === "vertical" ? (f(), w("div", oo, [
2618
+ u("div", ao, [
2619
+ e(d) > 0 ? (f(), w("button", {
2620
+ key: 0,
2621
+ onClick: o[0] || (o[0] = //@ts-ignore
2622
+ (...h) => e(x) && e(x)(...h)),
2623
+ "data-popover-trigger": "",
2624
+ "aria-haspopup": "dialog",
2625
+ "aria-expanded": "false",
2626
+ class: "w-full ring-offset-background focus-visible:outline-hidden focus-visible:ring-ring inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 hover:text-accent-foreground border h-10 px-4 py-2 gap-2 m-2 bg-white text-gray-800 hover:bg-gray-200 focus:bg-gray-200",
2627
+ type: "button"
2628
+ }, " Очистити ")) : V("", !0),
2629
+ a.schema ? (f(!0), w(R, { key: 1 }, W(Object.entries(a.schema), ([h, g]) => (f(), S(ae, P({
2630
+ name: h,
2631
+ layout: "vertical"
2632
+ }, { ref_for: !0 }, g, {
2633
+ onChange: o[1] || (o[1] = (k) => e(m)(k.name, k.value)),
2634
+ onClear: o[2] || (o[2] = (k) => {
2635
+ e(c)(k), e(m)(k, void 0);
2636
+ }),
2637
+ modelValue: e(r)[h],
2638
+ "onUpdate:modelValue": (k) => e(r)[h] = k,
2639
+ showClean: !0
2640
+ }), null, 16, ["name", "modelValue", "onUpdate:modelValue"]))), 256)) : V("", !0),
2641
+ (f(!0), w(R, null, W(e(p), (h, g) => (f(), S(ae, P({
2642
+ key: "slot-" + g,
2643
+ layout: "vertical"
2644
+ }, { ref_for: !0 }, h.props, {
2645
+ onChange: o[3] || (o[3] = (k) => e(m)(k.name, k.value)),
2646
+ onClear: o[4] || (o[4] = (k) => {
2647
+ e(c)(k), e(m)(k, void 0);
2648
+ }),
2649
+ modelValue: e(r)[h.props.name],
2650
+ "onUpdate:modelValue": (k) => e(r)[h.props.name] = k,
2651
+ showClean: !0
2652
+ }), null, 16, ["modelValue", "onUpdate:modelValue"]))), 128))
2653
+ ])
2654
+ ])) : V("", !0);
2655
+ }
2656
+ }), Ve = /* @__PURE__ */ O({
2657
+ __name: "filter",
2658
+ props: {
2659
+ schema: {},
2660
+ view: { default: "inline" },
2661
+ value: {},
2662
+ history: { type: Boolean },
2663
+ mode: {},
2664
+ limit: { default: 3 }
2665
+ },
2666
+ emits: ["change", "clear", "clearAll"],
2667
+ setup(i, { emit: n }) {
2668
+ const v = i, t = _(v.value ?? {}), s = n;
2669
+ function r(p, a) {
2670
+ t.value = {
2671
+ ...t.value,
2672
+ [p]: a
2673
+ }, s("change", {
2674
+ data: Z(t.value),
2675
+ name: p,
2676
+ value: a
2677
+ });
2678
+ }
2679
+ function d(p) {
2680
+ delete t.value[p], s("clear", {
2681
+ data: Z(t.value),
2682
+ name: p
2683
+ });
2684
+ }
2685
+ function m() {
2686
+ t.value = {}, s("clear", {
2687
+ data: Z(t.value),
2688
+ name: "ALL"
2689
+ }), s("change", {
2690
+ data: Z(t.value),
2691
+ name: "ALL",
2692
+ value: null
2693
+ });
2694
+ }
2695
+ const c = _({});
2696
+ function x() {
2697
+ switch (v.view) {
2698
+ case "inline":
2699
+ return Ce;
2700
+ case "vertical":
2701
+ return no;
2702
+ case "popover":
2703
+ return je;
2704
+ default:
2705
+ return Ce;
2706
+ }
2707
+ }
2708
+ return M(
2709
+ () => v.schema,
2710
+ (p) => {
2711
+ if (!p) {
2712
+ c.value = {};
2713
+ return;
2714
+ }
2715
+ if (Array.isArray(p) && !p.length) {
2716
+ c.value = {};
2717
+ return;
2718
+ }
2719
+ Array.isArray(p) ? c.value = p.filter((a) => a.type).reduce((a, o) => (Object.assign(o, { name: o.id || o.name, type: o.type.toLowerCase() }), a[o.name] = o, o.data && !o.api && !o.options && Object.assign(o, { api: `/api/suggest/${o.data}` }), a), {}) : (Object.entries(p).forEach(([a, o]) => {
2720
+ Object.assign(o, { name: a || o.name || o.id, type: o.type.toLowerCase() });
2721
+ }), c.value = { ...p });
2722
+ },
2723
+ { immediate: !0, deep: !0 }
2724
+ ), (p, a) => (f(), S(ee(x()), P(v, {
2725
+ schema: c.value,
2726
+ onChange: a[0] || (a[0] = (o) => r(o.name, o.value)),
2727
+ onClear: a[1] || (a[1] = (o) => d(o.name)),
2728
+ onClearAll: m
2729
+ }), {
2730
+ default: le(() => [
2731
+ ue(p.$slots, "default")
2732
+ ]),
2733
+ _: 3
2734
+ }, 16, ["schema"]));
2735
+ }
2736
+ });
2737
+ Ve.install = function(n) {
2738
+ n.component("VsFilter", Ve);
2739
+ };
2740
+ export {
2741
+ Ve as Filter,
2742
+ ae as FilterField,
2743
+ Ve as default
2744
+ };