@opengis/filter 0.1.5 → 0.1.7

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