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