@opengis/filter 0.1.6 → 0.1.8

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