@opengis/partsmap 0.0.104 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +3545 -0
- package/index.umd.cjs +1 -0
- package/package.json +4 -39
- package/style.css +1 -0
- package/dist/PartsMap.js +0 -25346
- package/dist/PartsMap.umd.cjs +0 -590
- package/dist/style.css +0 -1
package/index.js
ADDED
@@ -0,0 +1,3545 @@
|
|
1
|
+
import { defineComponent as W, ref as V, watch as R, createBlock as j, openBlock as c, resolveDynamicComponent as oe, mergeProps as Z, withCtx as re, renderSlot as ee, computed as E, useSlots as we, createElementBlock as w, createCommentVNode as S, Fragment as F, renderList as q, unref as e, createElementVNode as a, normalizeClass as z, toDisplayString as K, createVNode as P, createTextVNode as Y, toRaw as fe, cloneVNode as Ye, nextTick as ke, onMounted as ue, onBeforeUnmount as he, Teleport as Fe, withDirectives as H, normalizeStyle as _e, vShow as X, vModelText as te, withModifiers as Ke, isRef as qe, createStaticVNode as Ue } from "vue";
|
2
|
+
const Ne = { class: "flex items-center justify-between w-full text-sm" }, Ge = { class: "flex items-center cursor-pointer w-full" }, Qe = {
|
3
|
+
key: 0,
|
4
|
+
width: "16",
|
5
|
+
height: "auto",
|
6
|
+
src: "data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PScwIDAgMTYgMTYnIGZpbGw9J3doaXRlJyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnPjxwYXRoIGQ9J00xMi4yMDcgNC43OTNhMSAxIDAgMDEwIDEuNDE0bC01IDVhMSAxIDAgMDEtMS40MTQgMGwtMi0yYTEgMSAwIDAxMS40MTQtMS40MTRMNi41IDkuMDg2bDQuMjkzLTQuMjkzYTEgMSAwIDAxMS40MTQgMHonLz48L3N2Zz4="
|
7
|
+
}, Ze = ["value"], Je = { class: "w-[calc(100%-18px)] flex flex-row items-center justify-between pl-[10px]" }, Xe = { class: "flex flex-row items-center font-normal text-gray-800 gap-x-1" }, et = {
|
8
|
+
key: 0,
|
9
|
+
class: "text-xs text-gray-500 dark:text-neutral-500 pr-1"
|
10
|
+
}, Ce = /* @__PURE__ */ W({
|
11
|
+
__name: "list-item",
|
12
|
+
props: {
|
13
|
+
layout: {},
|
14
|
+
count: {},
|
15
|
+
type: {},
|
16
|
+
label: {},
|
17
|
+
value: {},
|
18
|
+
isSelected: { type: Boolean },
|
19
|
+
color: {},
|
20
|
+
highlighted: { type: Boolean }
|
21
|
+
},
|
22
|
+
emits: ["itemClick"],
|
23
|
+
setup(u, { expose: r, emit: v }) {
|
24
|
+
const l = u, o = v;
|
25
|
+
function n() {
|
26
|
+
o("itemClick", l.value);
|
27
|
+
}
|
28
|
+
const f = V(null);
|
29
|
+
return r({ el: f }), (g, m) => (c(), w("div", {
|
30
|
+
class: "flex items-center w-full rounded-lg group hover:bg-gray-100",
|
31
|
+
ref_key: "el",
|
32
|
+
ref: f
|
33
|
+
}, [
|
34
|
+
a("div", Ne, [
|
35
|
+
a("div", Ge, [
|
36
|
+
a("label", {
|
37
|
+
for: "radio-9740",
|
38
|
+
class: z([
|
39
|
+
["inline", "popover"].includes(g.layout) ? "text-sm text-gray-500 px-2 w-full py-2 cursor-pointer !flex flex-row items-center" : "flex flex-row items-center w-full px-2 py-2 text-sm text-gray-500 cursor-pointer",
|
40
|
+
{ "bg-blue-100": g.highlighted }
|
41
|
+
]),
|
42
|
+
onClick: Ke(n, ["stop", "prevent"])
|
43
|
+
}, [
|
44
|
+
a("div", {
|
45
|
+
class: z(["w-[18px] h-[18px] border flex items-center justify-center", [
|
46
|
+
g.type == "checkbox" ? "rounded-[4px]" : "rounded-full",
|
47
|
+
g.color ? `bg-[${g.color}] border-[#ffffff]` : g.isSelected ? "bg-[#2563eb] border-[#ffffff]" : "bg-[#ffffff] border-[#d9d9d9]"
|
48
|
+
]])
|
49
|
+
}, [
|
50
|
+
g.isSelected ? (c(), w("img", Qe)) : S("", !0)
|
51
|
+
], 2),
|
52
|
+
a("input", {
|
53
|
+
type: "checkbox",
|
54
|
+
class: "hidden",
|
55
|
+
id: "radio-9740",
|
56
|
+
value: g.value
|
57
|
+
}, null, 8, Ze),
|
58
|
+
a("div", Je, [
|
59
|
+
a("span", Xe, K(g.label ?? "Відсутні данні"), 1),
|
60
|
+
g.count ? (c(), w("div", et, " (" + K(g.count) + ") ", 1)) : S("", !0)
|
61
|
+
])
|
62
|
+
], 2)
|
63
|
+
])
|
64
|
+
])
|
65
|
+
], 512));
|
66
|
+
}
|
67
|
+
});
|
68
|
+
function Le(u, r) {
|
69
|
+
const {
|
70
|
+
options: v = [],
|
71
|
+
limit: l = 20
|
72
|
+
} = u;
|
73
|
+
function o(s) {
|
74
|
+
return Array.isArray(s) ? s[0] : s;
|
75
|
+
}
|
76
|
+
const n = V(o(u.modelValue)), f = V(""), g = V(!1), m = V([]), k = V("id"), h = V("text"), p = V(!1), x = V(u.layout !== "popover" && v.length > l);
|
77
|
+
function C(s) {
|
78
|
+
const _ = s.find(Boolean) ?? {}, M = ["id", "value", "code", "key"].find((U) => U in _) ?? "id", A = ["text", "label", "name", "title"].find((U) => U in _) ?? "text";
|
79
|
+
return { autoValueKey: M, autoLabelKey: A };
|
80
|
+
}
|
81
|
+
if (v.length > 0) {
|
82
|
+
const s = C(v);
|
83
|
+
k.value = s.autoValueKey, h.value = s.autoLabelKey;
|
84
|
+
}
|
85
|
+
const d = E(() => {
|
86
|
+
const s = m.value;
|
87
|
+
return u.layout === "popover" || p.value ? s : s.slice(0, l);
|
88
|
+
});
|
89
|
+
R(() => u.modelValue, (s) => {
|
90
|
+
n.value = o(s);
|
91
|
+
}, { immediate: !0 }), m.value = [...v].sort((s, _) => u.sort === "count" ? _.count && s.count ? _.count - s.count : 0 : u.sort === "name" ? String(s[h.value] ?? "").localeCompare(String(_[h.value] ?? "")) : 0);
|
92
|
+
function i(s) {
|
93
|
+
return n.value === s[k.value];
|
94
|
+
}
|
95
|
+
function t(s) {
|
96
|
+
n.value = s[k.value], r("update:modelValue", n.value), r("change", { name: u.name, value: n.value });
|
97
|
+
}
|
98
|
+
function y() {
|
99
|
+
n.value = void 0, r("update:modelValue", n.value), r("clear", u.name);
|
100
|
+
}
|
101
|
+
function b() {
|
102
|
+
p.value = !p.value;
|
103
|
+
}
|
104
|
+
return {
|
105
|
+
innerValue: n,
|
106
|
+
searchTerm: f,
|
107
|
+
filteredOptions: d,
|
108
|
+
isSelected: i,
|
109
|
+
selectItem: t,
|
110
|
+
clear: y,
|
111
|
+
toggleShowAll: b,
|
112
|
+
isReqProc: g,
|
113
|
+
showAll: p,
|
114
|
+
isEnableShowAll: x,
|
115
|
+
labelKey: h,
|
116
|
+
valueKey: k,
|
117
|
+
allOptions: m
|
118
|
+
};
|
119
|
+
}
|
120
|
+
const le = (u, r) => {
|
121
|
+
const v = u.__vccOpts || u;
|
122
|
+
for (const [l, o] of r)
|
123
|
+
v[l] = o;
|
124
|
+
return v;
|
125
|
+
}, tt = {}, lt = {
|
126
|
+
class: "w-48 mx-auto",
|
127
|
+
viewBox: "0 0 178 90",
|
128
|
+
fill: "none",
|
129
|
+
xmlns: "http://www.w3.org/2000/svg"
|
130
|
+
};
|
131
|
+
function at(u, r) {
|
132
|
+
return c(), w("svg", lt, r[0] || (r[0] = [
|
133
|
+
Ue('<rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs>', 12)
|
134
|
+
]));
|
135
|
+
}
|
136
|
+
const Ve = /* @__PURE__ */ le(tt, [["render", at]]), ot = {}, rt = {
|
137
|
+
xmlns: "http://www.w3.org/2000/svg",
|
138
|
+
width: "24",
|
139
|
+
height: "24",
|
140
|
+
viewBox: "0 0 24 24",
|
141
|
+
fill: "none",
|
142
|
+
stroke: "currentColor",
|
143
|
+
"stroke-width": "2",
|
144
|
+
"stroke-linecap": "round",
|
145
|
+
"stroke-linejoin": "round",
|
146
|
+
class: "icon icon-tabler icons-tabler-outline icon-tabler-chevron-down w-[14px] rotate"
|
147
|
+
};
|
148
|
+
function nt(u, r) {
|
149
|
+
return c(), w("svg", rt, r[0] || (r[0] = [
|
150
|
+
a("path", {
|
151
|
+
stroke: "none",
|
152
|
+
d: "M0 0h24v24H0z",
|
153
|
+
fill: "none"
|
154
|
+
}, null, -1),
|
155
|
+
a("path", { d: "M6 9l6 6l6 -6" }, null, -1)
|
156
|
+
]));
|
157
|
+
}
|
158
|
+
const be = /* @__PURE__ */ le(ot, [["render", nt]]), it = {}, st = {
|
159
|
+
xmlns: "http://www.w3.org/2000/svg",
|
160
|
+
width: "24",
|
161
|
+
height: "24",
|
162
|
+
viewBox: "0 0 24 24",
|
163
|
+
fill: "none",
|
164
|
+
stroke: "currentColor",
|
165
|
+
"stroke-width": "2",
|
166
|
+
"stroke-linecap": "round",
|
167
|
+
"stroke-linejoin": "round",
|
168
|
+
class: "icon icon-tabler icons-tabler-outline icon-tabler-chevron-down w-[14px] rotate-[180deg]"
|
169
|
+
};
|
170
|
+
function ut(u, r) {
|
171
|
+
return c(), w("svg", st, r[0] || (r[0] = [
|
172
|
+
a("path", {
|
173
|
+
stroke: "none",
|
174
|
+
d: "M0 0h24v24H0z",
|
175
|
+
fill: "none"
|
176
|
+
}, null, -1),
|
177
|
+
a("path", { d: "M6 9l6 6l6 -6" }, null, -1)
|
178
|
+
]));
|
179
|
+
}
|
180
|
+
const Se = /* @__PURE__ */ le(it, [["render", ut]]), dt = {
|
181
|
+
key: 0,
|
182
|
+
class: "w-full"
|
183
|
+
}, ct = { class: "flex flex-col items-center justify-center p-5 text-center" }, pt = {
|
184
|
+
key: 0,
|
185
|
+
class: "flex justify-between p-2 border-t bg-gray-50 text-xs text-gray-500"
|
186
|
+
}, ft = {
|
187
|
+
key: 1,
|
188
|
+
class: "flex justify-between items-center text-xs text-gray-500 p-1 border-t"
|
189
|
+
}, vt = /* @__PURE__ */ W({
|
190
|
+
__name: "radio",
|
191
|
+
props: {
|
192
|
+
id: {},
|
193
|
+
name: {},
|
194
|
+
type: {},
|
195
|
+
label: {},
|
196
|
+
width: {},
|
197
|
+
options: { default: () => [] },
|
198
|
+
placeHolder: {},
|
199
|
+
api: {},
|
200
|
+
data: {},
|
201
|
+
default: {},
|
202
|
+
modelValue: {},
|
203
|
+
disabled: { type: Boolean, default: !1 },
|
204
|
+
layout: { default: "inline" },
|
205
|
+
cleanable: { type: Boolean },
|
206
|
+
limit: { default: 10 },
|
207
|
+
multi: { type: Boolean },
|
208
|
+
dataKey: {},
|
209
|
+
valueKey: {},
|
210
|
+
mode: {},
|
211
|
+
labelKey: {},
|
212
|
+
sort: {}
|
213
|
+
},
|
214
|
+
emits: ["update:modelValue", "change", "clear"],
|
215
|
+
setup(u, { expose: r, emit: v }) {
|
216
|
+
const l = u, o = V(null), n = v, {
|
217
|
+
innerValue: f,
|
218
|
+
filteredOptions: g,
|
219
|
+
isSelected: m,
|
220
|
+
selectItem: k,
|
221
|
+
clear: h,
|
222
|
+
toggleShowAll: p,
|
223
|
+
isReqProc: x,
|
224
|
+
showAll: C,
|
225
|
+
isEnableShowAll: d,
|
226
|
+
labelKey: i,
|
227
|
+
valueKey: t,
|
228
|
+
allOptions: y
|
229
|
+
} = Le({
|
230
|
+
...l,
|
231
|
+
modelValue: l.modelValue ?? l.default ?? ""
|
232
|
+
}, n);
|
233
|
+
return r({
|
234
|
+
clear: h,
|
235
|
+
inputTextRef: o
|
236
|
+
}), R(
|
237
|
+
() => l.modelValue,
|
238
|
+
(b) => {
|
239
|
+
b === void 0 && (f.value = void 0);
|
240
|
+
}
|
241
|
+
), (b, s) => (c(), w("div", {
|
242
|
+
class: z([b.layout === "popover" ? "flex flex-col h-full" : "flex flex-col vs-filter-checkbox"])
|
243
|
+
}, [
|
244
|
+
a("div", {
|
245
|
+
class: z([
|
246
|
+
b.layout === "popover" ? "flex-1 overflow-y-auto max-h-64 p-2" : "",
|
247
|
+
b.layout === "inline" ? "flex-1 overflow-y-auto max-h-80" : ""
|
248
|
+
])
|
249
|
+
}, [
|
250
|
+
(c(!0), w(F, null, q(e(g), (_) => (c(), j(Ce, {
|
251
|
+
layout: b.layout,
|
252
|
+
key: _[e(t)],
|
253
|
+
count: _.count,
|
254
|
+
label: _[e(i)],
|
255
|
+
color: _.color,
|
256
|
+
type: "radio",
|
257
|
+
value: _[e(t)],
|
258
|
+
"is-selected": e(m)(_),
|
259
|
+
onItemClick: (M) => e(k)(_)
|
260
|
+
}, null, 8, ["layout", "count", "label", "color", "value", "is-selected", "onItemClick"]))), 128))
|
261
|
+
], 2),
|
262
|
+
b.type === "select" && e(g).length === 0 && !e(x) ? (c(), w("div", dt, [
|
263
|
+
a("div", ct, [
|
264
|
+
P(Ve),
|
265
|
+
s[4] || (s[4] = a("div", { class: "max-w-sm mx-auto mt-6" }, [
|
266
|
+
a("p", { class: "font-medium text-gray-800 dark:text-neutral-200" }, "За вашим запитом нічого не знайдено"),
|
267
|
+
a("p", { class: "mt-2 text-sm text-gray-500 dark:text-neutral-500" })
|
268
|
+
], -1))
|
269
|
+
])
|
270
|
+
])) : S("", !0),
|
271
|
+
b.layout !== "popover" && b.type !== "select" ? (c(), w(F, { key: 1 }, [
|
272
|
+
!e(C) && e(d) ? (c(), w("div", {
|
273
|
+
key: 0,
|
274
|
+
onClick: s[0] || (s[0] = //@ts-ignore
|
275
|
+
(..._) => e(p) && e(p)(..._)),
|
276
|
+
class: "inline-flex cursor-pointer items-center gap-x-1.5 text-[13px] text-gray-800 underline underline-offset-4 hover:text-blue-600 focus:outline-none focus:text-blue-600 mt-1 px-2"
|
277
|
+
}, [
|
278
|
+
s[5] || (s[5] = Y(" Показати більше ", -1)),
|
279
|
+
P(be)
|
280
|
+
])) : S("", !0),
|
281
|
+
e(C) ? (c(), w("div", {
|
282
|
+
key: 1,
|
283
|
+
onClick: s[1] || (s[1] = //@ts-ignore
|
284
|
+
(..._) => e(p) && e(p)(..._)),
|
285
|
+
class: "inline-flex cursor-pointer items-center gap-x-1.5 text-[13px] text-gray-800 underline underline-offset-4 hover:text-blue-600 focus:outline-none focus:text-blue-600 mt-1 px-2"
|
286
|
+
}, [
|
287
|
+
s[6] || (s[6] = Y(" Показати менше ", -1)),
|
288
|
+
P(Se)
|
289
|
+
])) : S("", !0)
|
290
|
+
], 64)) : S("", !0),
|
291
|
+
b.cleanable ? (c(), w(F, { key: 2 }, [
|
292
|
+
b.layout === "inline" ? (c(), w("div", pt, [
|
293
|
+
Y(K(e(f) || e(f) === null ? 1 : 0) + " з " + K(e(y).length) + " обрано ", 1),
|
294
|
+
H(a("button", {
|
295
|
+
class: "text-gray-600 hover:text-gray-800",
|
296
|
+
onClick: s[2] || (s[2] = //@ts-ignore
|
297
|
+
(..._) => e(h) && e(h)(..._))
|
298
|
+
}, " Очистити ", 512), [
|
299
|
+
[X, e(f) !== "" && e(f) !== void 0]
|
300
|
+
])
|
301
|
+
])) : S("", !0),
|
302
|
+
b.layout === "popover" ? (c(), w("div", ft, [
|
303
|
+
a("span", null, K(e(f) || e(f) === null ? 1 : 0) + " з " + K(e(y).length) + " обрано", 1),
|
304
|
+
H(a("button", {
|
305
|
+
class: "text-gray-600 hover:text-gray-800",
|
306
|
+
onClick: s[3] || (s[3] = //@ts-ignore
|
307
|
+
(..._) => e(h) && e(h)(..._))
|
308
|
+
}, " Очистити ", 512), [
|
309
|
+
[X, e(f) !== "" && e(f) !== void 0]
|
310
|
+
])
|
311
|
+
])) : S("", !0)
|
312
|
+
], 64)) : S("", !0)
|
313
|
+
], 2));
|
314
|
+
}
|
315
|
+
});
|
316
|
+
function Oe(u, r) {
|
317
|
+
const {
|
318
|
+
options: v = [],
|
319
|
+
limit: l = 20
|
320
|
+
} = u;
|
321
|
+
function o(s) {
|
322
|
+
return Array.isArray(s) ? s : s ? [s] : [];
|
323
|
+
}
|
324
|
+
const n = V(o(u.modelValue)), f = V(""), g = V(!1), m = V([]), k = V("id"), h = V("text"), p = V(!1), x = V(u.layout !== "popover" && v.length > l);
|
325
|
+
function C(s) {
|
326
|
+
const _ = s.find(Boolean) ?? {}, M = ["id", "value", "code", "key"].find((U) => U in _) ?? "id", A = ["text", "label", "name", "title"].find((U) => U in _) ?? "text";
|
327
|
+
return { autoValueKey: M, autoLabelKey: A };
|
328
|
+
}
|
329
|
+
if (v.length > 0) {
|
330
|
+
const s = C(v);
|
331
|
+
k.value = s.autoValueKey, h.value = s.autoLabelKey;
|
332
|
+
}
|
333
|
+
const d = E(() => {
|
334
|
+
const s = m.value;
|
335
|
+
return u.layout === "popover" || p.value ? s : s.slice(0, l);
|
336
|
+
});
|
337
|
+
R(() => u.modelValue, (s) => {
|
338
|
+
n.value = o(s);
|
339
|
+
}, { immediate: !0 }), m.value = [...v].sort((s, _) => u.sort === "count" ? _.count && s.count ? _.count - s.count : 0 : u.sort === "name" ? String(s[h.value]).localeCompare(String(_[h.value])) : 0);
|
340
|
+
function i(s) {
|
341
|
+
return n.value && n.value.includes(s[k.value]);
|
342
|
+
}
|
343
|
+
function t(s) {
|
344
|
+
const _ = n.value.includes(s[k.value]);
|
345
|
+
n.value = _ ? n.value.filter((M) => M !== s[k.value]) : [...n.value, s[k.value]], r("update:modelValue", n.value), r("change", { name: u.name, value: n.value });
|
346
|
+
}
|
347
|
+
function y() {
|
348
|
+
n.value = [], r("update:modelValue", n.value), r("clear", u.name);
|
349
|
+
}
|
350
|
+
function b() {
|
351
|
+
p.value = !p.value;
|
352
|
+
}
|
353
|
+
return {
|
354
|
+
innerValue: n,
|
355
|
+
searchTerm: f,
|
356
|
+
filteredOptions: d,
|
357
|
+
isSelected: i,
|
358
|
+
selectItem: t,
|
359
|
+
clear: y,
|
360
|
+
toggleShowAll: b,
|
361
|
+
isReqProc: g,
|
362
|
+
showAll: p,
|
363
|
+
isEnableShowAll: x,
|
364
|
+
labelKey: h,
|
365
|
+
valueKey: k,
|
366
|
+
allOptions: m
|
367
|
+
};
|
368
|
+
}
|
369
|
+
const mt = {
|
370
|
+
key: 0,
|
371
|
+
class: "w-full"
|
372
|
+
}, gt = { class: "flex flex-col items-center justify-center p-5 text-center" }, ht = {
|
373
|
+
key: 0,
|
374
|
+
class: "flex justify-between p-2 border-t bg-gray-50 text-xs text-gray-500"
|
375
|
+
}, bt = {
|
376
|
+
key: 1,
|
377
|
+
class: "flex justify-between items-center text-xs text-gray-500 p-1 border-t"
|
378
|
+
}, Re = /* @__PURE__ */ W({
|
379
|
+
__name: "checkbox",
|
380
|
+
props: {
|
381
|
+
id: {},
|
382
|
+
name: {},
|
383
|
+
type: {},
|
384
|
+
label: {},
|
385
|
+
width: {},
|
386
|
+
options: { default: () => [] },
|
387
|
+
placeHolder: {},
|
388
|
+
api: {},
|
389
|
+
data: {},
|
390
|
+
default: {},
|
391
|
+
modelValue: {},
|
392
|
+
disabled: { type: Boolean, default: !1 },
|
393
|
+
layout: { default: "inline" },
|
394
|
+
cleanable: { type: Boolean },
|
395
|
+
limit: { default: 10 },
|
396
|
+
multi: { type: Boolean },
|
397
|
+
dataKey: {},
|
398
|
+
valueKey: {},
|
399
|
+
mode: {},
|
400
|
+
labelKey: {},
|
401
|
+
sort: {}
|
402
|
+
},
|
403
|
+
emits: ["update:modelValue", "change", "clear"],
|
404
|
+
setup(u, { expose: r, emit: v }) {
|
405
|
+
const l = u, o = v, {
|
406
|
+
innerValue: n,
|
407
|
+
filteredOptions: f,
|
408
|
+
isSelected: g,
|
409
|
+
selectItem: m,
|
410
|
+
clear: k,
|
411
|
+
toggleShowAll: h,
|
412
|
+
isReqProc: p,
|
413
|
+
showAll: x,
|
414
|
+
isEnableShowAll: C,
|
415
|
+
labelKey: d,
|
416
|
+
valueKey: i,
|
417
|
+
allOptions: t
|
418
|
+
} = Oe({
|
419
|
+
...l,
|
420
|
+
modelValue: l.modelValue
|
421
|
+
}, o);
|
422
|
+
return R(
|
423
|
+
() => l.modelValue,
|
424
|
+
(y) => {
|
425
|
+
y === void 0 && (n.value = []);
|
426
|
+
}
|
427
|
+
), r({
|
428
|
+
clear: k
|
429
|
+
}), (y, b) => (c(), w("div", {
|
430
|
+
class: z([y.layout === "popover" ? "flex flex-col h-full" : "flex flex-col vs-filter-checkbox space-y-0.5"])
|
431
|
+
}, [
|
432
|
+
a("div", {
|
433
|
+
class: z([
|
434
|
+
y.layout === "popover" ? "flex-1 overflow-y-auto max-h-64 p-2" : "",
|
435
|
+
y.layout === "inline" ? "flex-1 overflow-y-auto max-h-80" : ""
|
436
|
+
])
|
437
|
+
}, [
|
438
|
+
(c(!0), w(F, null, q(e(f), (s) => (c(), j(Ce, {
|
439
|
+
layout: y.layout,
|
440
|
+
count: s.count,
|
441
|
+
label: s[e(d)],
|
442
|
+
color: s.color,
|
443
|
+
type: "checkbox",
|
444
|
+
value: s[e(i)],
|
445
|
+
"is-selected": e(g)(s),
|
446
|
+
onItemClick: (_) => e(m)(s)
|
447
|
+
}, null, 8, ["layout", "count", "label", "color", "value", "is-selected", "onItemClick"]))), 256))
|
448
|
+
], 2),
|
449
|
+
y.type === "select" && e(f).length === 0 && !e(p) ? (c(), w("div", mt, [
|
450
|
+
a("div", gt, [
|
451
|
+
P(Ve),
|
452
|
+
b[4] || (b[4] = a("div", { class: "max-w-sm mx-auto mt-6" }, [
|
453
|
+
a("p", { class: "font-medium text-gray-800 dark:text-neutral-200" }, "За вашим запитом нічого не знайдено"),
|
454
|
+
a("p", { class: "mt-2 text-sm text-gray-500 dark:text-neutral-500" })
|
455
|
+
], -1))
|
456
|
+
])
|
457
|
+
])) : S("", !0),
|
458
|
+
y.layout !== "popover" && y.type !== "select" ? (c(), w(F, { key: 1 }, [
|
459
|
+
!e(x) && e(C) ? (c(), w("div", {
|
460
|
+
key: 0,
|
461
|
+
onClick: b[0] || (b[0] = //@ts-ignore
|
462
|
+
(...s) => e(h) && e(h)(...s)),
|
463
|
+
class: "inline-flex cursor-pointer items-center gap-x-1.5 text-[13px] text-gray-800 underline underline-offset-4 hover:text-blue-600 focus:outline-none focus:text-blue-600 mt-1 px-2"
|
464
|
+
}, [
|
465
|
+
b[5] || (b[5] = Y(" Показати більше ", -1)),
|
466
|
+
P(be)
|
467
|
+
])) : S("", !0),
|
468
|
+
e(x) ? (c(), w("div", {
|
469
|
+
key: 1,
|
470
|
+
onClick: b[1] || (b[1] = //@ts-ignore
|
471
|
+
(...s) => e(h) && e(h)(...s)),
|
472
|
+
class: "inline-flex cursor-pointer items-center gap-x-1.5 text-[13px] text-gray-800 underline underline-offset-4 hover:text-blue-600 focus:outline-none focus:text-blue-600 mt-1 px-2"
|
473
|
+
}, [
|
474
|
+
b[6] || (b[6] = Y(" Показати менше ", -1)),
|
475
|
+
P(Se)
|
476
|
+
])) : S("", !0)
|
477
|
+
], 64)) : S("", !0),
|
478
|
+
y.cleanable ? (c(), w(F, { key: 2 }, [
|
479
|
+
y.layout === "inline" ? (c(), w("div", ht, [
|
480
|
+
Y(K(e(n).length) + " з " + K(e(t).length) + " обрано ", 1),
|
481
|
+
H(a("button", {
|
482
|
+
class: "text-gray-600 hover:text-gray-800",
|
483
|
+
onClick: b[2] || (b[2] = //@ts-ignore
|
484
|
+
(...s) => e(k) && e(k)(...s))
|
485
|
+
}, " Очистити ", 512), [
|
486
|
+
[X, e(n).length !== 0]
|
487
|
+
])
|
488
|
+
])) : S("", !0),
|
489
|
+
y.layout === "popover" ? (c(), w("div", bt, [
|
490
|
+
a("span", null, K(e(n).length) + " з " + K(e(t).length) + " обрано", 1),
|
491
|
+
H(a("button", {
|
492
|
+
class: "text-gray-600 hover:text-gray-800",
|
493
|
+
onClick: b[3] || (b[3] = //@ts-ignore
|
494
|
+
(...s) => e(k) && e(k)(...s))
|
495
|
+
}, " Очистити ", 512), [
|
496
|
+
[X, e(n).length !== 0]
|
497
|
+
])
|
498
|
+
])) : S("", !0)
|
499
|
+
], 64)) : S("", !0)
|
500
|
+
], 2));
|
501
|
+
}
|
502
|
+
}), yt = {}, xt = {
|
503
|
+
xmlns: "http://www.w3.org/2000/svg",
|
504
|
+
width: "15px",
|
505
|
+
height: "15px",
|
506
|
+
viewBox: "0 0 24 24",
|
507
|
+
fill: "none",
|
508
|
+
stroke: "currentColor",
|
509
|
+
"stroke-width": "2",
|
510
|
+
"stroke-linecap": "round",
|
511
|
+
"stroke-linejoin": "round",
|
512
|
+
class: "icon icon-tabler icons-tabler-outline icon-tabler-search stroke-gray-500 transition-all"
|
513
|
+
};
|
514
|
+
function wt(u, r) {
|
515
|
+
return c(), w("svg", xt, r[0] || (r[0] = [
|
516
|
+
a("path", {
|
517
|
+
stroke: "none",
|
518
|
+
d: "M0 0h24v24H0z",
|
519
|
+
fill: "none"
|
520
|
+
}, null, -1),
|
521
|
+
a("path", { d: "M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0" }, null, -1),
|
522
|
+
a("path", { d: "M21 21l-6 -6" }, null, -1)
|
523
|
+
]));
|
524
|
+
}
|
525
|
+
const Pe = /* @__PURE__ */ le(yt, [["render", wt]]), kt = {}, _t = {
|
526
|
+
xmlns: "http://www.w3.org/2000/svg",
|
527
|
+
viewBox: "0 0 24 24",
|
528
|
+
fill: "none",
|
529
|
+
stroke: "currentColor",
|
530
|
+
"stroke-width": "2",
|
531
|
+
"stroke-linecap": "round",
|
532
|
+
"stroke-linejoin": "round",
|
533
|
+
class: "icon icon-tabler icons-tabler-outline icon-tabler-x stroke-gray-500 hover:stroke-red-500 transition-all",
|
534
|
+
width: "15px",
|
535
|
+
height: "15px"
|
536
|
+
};
|
537
|
+
function Ct(u, r) {
|
538
|
+
return c(), w("svg", _t, r[0] || (r[0] = [
|
539
|
+
a("path", {
|
540
|
+
stroke: "none",
|
541
|
+
d: "M0 0h24v24H0z",
|
542
|
+
fill: "none"
|
543
|
+
}, null, -1),
|
544
|
+
a("path", { d: "M18 6l-12 12" }, null, -1),
|
545
|
+
a("path", { d: "M6 6l12 12" }, null, -1)
|
546
|
+
]));
|
547
|
+
}
|
548
|
+
const Ie = /* @__PURE__ */ le(kt, [["render", Ct]]);
|
549
|
+
class ye {
|
550
|
+
static getWidthClass(r) {
|
551
|
+
return typeof r == "number" ? `max-w-[${r}px]` : typeof r == "string" ? r.endsWith("%") || r.endsWith("px") ? `max-w-[${r}]` : `max-w-${r}` : "w-full";
|
552
|
+
}
|
553
|
+
}
|
554
|
+
const Vt = { class: "absolute bottom-2/4 translate-y-2/4 cursor-pointer left-3" }, St = ["placeholder"], Mt = /* @__PURE__ */ W({
|
555
|
+
__name: "text-input",
|
556
|
+
props: {
|
557
|
+
id: {},
|
558
|
+
name: {},
|
559
|
+
type: {},
|
560
|
+
label: {},
|
561
|
+
width: { default: 220 },
|
562
|
+
options: {},
|
563
|
+
placeHolder: {},
|
564
|
+
api: {},
|
565
|
+
data: {},
|
566
|
+
default: {},
|
567
|
+
modelValue: {},
|
568
|
+
disabled: { type: Boolean },
|
569
|
+
layout: { default: "inline" },
|
570
|
+
cleanable: { type: Boolean },
|
571
|
+
limit: {},
|
572
|
+
multi: { type: Boolean },
|
573
|
+
dataKey: {},
|
574
|
+
valueKey: {},
|
575
|
+
mode: {},
|
576
|
+
labelKey: {},
|
577
|
+
sort: {}
|
578
|
+
},
|
579
|
+
emits: ["update:modelValue", "change", "clear"],
|
580
|
+
setup(u, { emit: r }) {
|
581
|
+
const v = u, l = V((v.placeHolder || v.label || v.name || "search").toString()), o = r, n = V(v.modelValue ?? "");
|
582
|
+
R(
|
583
|
+
() => v.modelValue,
|
584
|
+
(m) => {
|
585
|
+
m !== n.value && (n.value = m ?? "");
|
586
|
+
}
|
587
|
+
);
|
588
|
+
function f() {
|
589
|
+
o("update:modelValue", n.value), o("change", { name: v.name, value: n.value });
|
590
|
+
}
|
591
|
+
function g() {
|
592
|
+
n.value = "", o("update:modelValue", ""), o("clear", v.name), o("change", { name: v.name, value: null });
|
593
|
+
}
|
594
|
+
return (m, k) => (c(), w("div", {
|
595
|
+
class: z([
|
596
|
+
"vs-form-text relative bg-white rounded-lg [&>input]:py-[7px] [&>input]:max-h-[38px] [&>input]:ps-10 [&>input]:pe-8 [&>input]:block [&>input]:w-full [&>input]:bg-gray-100 [&>input]:border-transparent [&>input]:rounded-lg [&>input]:text-sm [&>input]:focus:bg-white [&>input]:focus:border-blue-500 [&>input]:focus:ring-blue-500 [&>input]:disabled:opacity-50 [&>input]:disabled:pointer-events-none [&>input]:dark:bg-neutral-700 [&>input]:dark:border-transparent [&>input]:dark:text-neutral-400 [&>input]:dark:placeholder:text-neutral-400 dark:focus:bg-neutral-800 dark:focus:ring-neutral-600",
|
597
|
+
m.layout === "inline" ? e(ye).getWidthClass(m.width) : "mb-2" + (m.layout === "popover" ? " m-2" : "")
|
598
|
+
])
|
599
|
+
}, [
|
600
|
+
a("div", Vt, [
|
601
|
+
P(Pe)
|
602
|
+
]),
|
603
|
+
n.value !== "" ? (c(), w("div", {
|
604
|
+
key: 0,
|
605
|
+
onClick: g,
|
606
|
+
class: "absolute bottom-2/4 translate-y-2/4 right-3 cursor-pointer"
|
607
|
+
}, [
|
608
|
+
P(Ie)
|
609
|
+
])) : S("", !0),
|
610
|
+
H(a("input", {
|
611
|
+
type: "text",
|
612
|
+
"onUpdate:modelValue": k[0] || (k[0] = (h) => n.value = h),
|
613
|
+
onInput: f,
|
614
|
+
placeholder: l.value,
|
615
|
+
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"
|
616
|
+
}, null, 40, St), [
|
617
|
+
[te, n.value]
|
618
|
+
])
|
619
|
+
], 2));
|
620
|
+
}
|
621
|
+
});
|
622
|
+
function Te(u = { color: "blue" }) {
|
623
|
+
return E(() => {
|
624
|
+
const r = `w-full px-3 py-2 border-solid border border-gray-300 text-sm rounded focus:outline-none focus:ring-2 focus:ring-${u.color}-500 focus:border-transparent`;
|
625
|
+
return (u == null ? void 0 : u.size) === "sm" ? `${r}h-[32px]` : `${r}h-[38px]`;
|
626
|
+
});
|
627
|
+
}
|
628
|
+
function Bt() {
|
629
|
+
return "rounded-md font-medium border-gray-200 border-solid disabled:pointer-events-none disabled:opacity-50 px-4 py-2 w-full bg-transparent border text-black text-sm h-[38px]";
|
630
|
+
}
|
631
|
+
function At() {
|
632
|
+
return "font-medium border-gray-200 border-solid disabled:pointer-events-none disabled:opacity-50 border h-7 rounded-md text-xs px-2 py-1 hover:bg-gray-100";
|
633
|
+
}
|
634
|
+
function He(u) {
|
635
|
+
return u === "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" : u === "soft" ? "inline-flex relative py-2 px-4 items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 hover:bg-gray-200 focus:outline-hidden focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:text-blue-400 dark:hover:bg-blue-900 dark:focus:bg-blue-900" : "relative border-solid border-gray-200 focus-visible:outline-hidden focus-visible:ring-ring inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 border-input hover:bg-gray-100 border px-4 py-2 gap-2 bg-transparent h-[38px]";
|
636
|
+
}
|
637
|
+
const $t = {
|
638
|
+
key: 0,
|
639
|
+
class: "block text-xs font-medium text-gray-600 mb-1"
|
640
|
+
}, Rt = ["placeholder", "disabled"], Dt = {
|
641
|
+
key: 0,
|
642
|
+
class: "block text-xs font-medium text-gray-600 mb-1"
|
643
|
+
}, jt = {
|
644
|
+
key: 0,
|
645
|
+
class: "block text-xs font-medium text-gray-600 mb-1"
|
646
|
+
}, zt = ["placeholder", "disabled"], Ft = ["disabled"], Kt = /* @__PURE__ */ W({
|
647
|
+
__name: "range-input",
|
648
|
+
props: {
|
649
|
+
id: {},
|
650
|
+
name: {},
|
651
|
+
type: {},
|
652
|
+
label: {},
|
653
|
+
width: {},
|
654
|
+
options: {},
|
655
|
+
placeHolder: {},
|
656
|
+
api: {},
|
657
|
+
data: {},
|
658
|
+
default: {},
|
659
|
+
modelValue: {},
|
660
|
+
disabled: { type: Boolean, default: !1 },
|
661
|
+
layout: { default: "inline" },
|
662
|
+
cleanable: { type: Boolean },
|
663
|
+
limit: {},
|
664
|
+
multi: { type: Boolean },
|
665
|
+
dataKey: {},
|
666
|
+
valueKey: {},
|
667
|
+
mode: {},
|
668
|
+
labelKey: {},
|
669
|
+
sort: {}
|
670
|
+
},
|
671
|
+
emits: ["update:modelValue", "change", "clear"],
|
672
|
+
setup(u, { expose: r, emit: v }) {
|
673
|
+
const l = Te(), o = Bt(), n = u, f = V(
|
674
|
+
n.modelValue ?? n.default ?? []
|
675
|
+
), g = v, m = E({
|
676
|
+
get: () => n.modelValue ?? f.value,
|
677
|
+
set: (p) => {
|
678
|
+
n.modelValue !== void 0 ? g("update:modelValue", p) : f.value = p;
|
679
|
+
}
|
680
|
+
});
|
681
|
+
function k() {
|
682
|
+
g("change", { name: n.name, value: m.value || f.value });
|
683
|
+
}
|
684
|
+
function h() {
|
685
|
+
f.value = [], m.value = f.value, g("clear", n.name);
|
686
|
+
}
|
687
|
+
return R(() => n.modelValue, (p) => {
|
688
|
+
p !== void 0 && n.layout !== "popover" ? (f.value = p, g("update:modelValue", p)) : f.value = [];
|
689
|
+
}), r({
|
690
|
+
clear: h,
|
691
|
+
currentValue: m
|
692
|
+
}), (p, x) => {
|
693
|
+
var C, d;
|
694
|
+
return c(), w(F, null, [
|
695
|
+
a("div", null, [
|
696
|
+
a("div", {
|
697
|
+
class: z(p.layout === "vertical" ? "inline-flex items-center gap-2" : "space-y-3 p-2")
|
698
|
+
}, [
|
699
|
+
a("div", null, [
|
700
|
+
p.layout !== "vertical" ? (c(), w("label", $t, "Від")) : S("", !0),
|
701
|
+
H(a("input", {
|
702
|
+
type: "number",
|
703
|
+
class: z(e(l)),
|
704
|
+
placeholder: ((C = p.placeHolder) == null ? void 0 : C[0]) ?? "min",
|
705
|
+
step: "1",
|
706
|
+
style: { outline: "none" },
|
707
|
+
"onUpdate:modelValue": x[0] || (x[0] = (i) => m.value[0] = i),
|
708
|
+
disabled: p.disabled
|
709
|
+
}, null, 10, Rt), [
|
710
|
+
[te, m.value[0]]
|
711
|
+
])
|
712
|
+
]),
|
713
|
+
p.layout === "vertical" ? (c(), w("label", Dt, " - ")) : S("", !0),
|
714
|
+
a("div", null, [
|
715
|
+
p.layout !== "vertical" ? (c(), w("label", jt, "До")) : S("", !0),
|
716
|
+
H(a("input", {
|
717
|
+
type: "number",
|
718
|
+
class: z(e(l)),
|
719
|
+
placeholder: ((d = p.placeHolder) == null ? void 0 : d[1]) ?? "max",
|
720
|
+
min: "0",
|
721
|
+
max: "1000000000000000",
|
722
|
+
step: "1",
|
723
|
+
style: { outline: "none" },
|
724
|
+
"onUpdate:modelValue": x[1] || (x[1] = (i) => m.value[1] = i),
|
725
|
+
disabled: p.disabled
|
726
|
+
}, null, 10, zt), [
|
727
|
+
[te, m.value[1]]
|
728
|
+
])
|
729
|
+
]),
|
730
|
+
["popover", "inline", "vertical"].includes(p.layout) ? (c(), w("button", {
|
731
|
+
key: 1,
|
732
|
+
onClick: k,
|
733
|
+
class: z(e(o) + (p.layout === "vertical" ? " w-[50px]" : " bg-blue-100 hover:bg-blue-200"))
|
734
|
+
}, K(p.layout === "vertical" ? "Ok" : "Застосувати"), 3)) : S("", !0),
|
735
|
+
["popover", "inline"].includes(p.layout) ? (c(), w("button", {
|
736
|
+
key: 2,
|
737
|
+
disabled: !(m.value[0] || m.value[1]),
|
738
|
+
onClick: h,
|
739
|
+
class: z(e(o) + " hover:bg-gray-100")
|
740
|
+
}, "Очистити", 10, Ft)) : S("", !0)
|
741
|
+
], 2)
|
742
|
+
]),
|
743
|
+
(p.cleanable && f.value.length, S("", !0))
|
744
|
+
], 64);
|
745
|
+
};
|
746
|
+
}
|
747
|
+
}), Ut = ["disabled", "title"], Lt = {
|
748
|
+
key: 0,
|
749
|
+
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"
|
750
|
+
}, Ot = { 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" }, Pt = { 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" }, Me = /* @__PURE__ */ W({
|
751
|
+
__name: "popover-field",
|
752
|
+
props: {
|
753
|
+
disabled: { type: Boolean, default: !1 },
|
754
|
+
label: {},
|
755
|
+
currentValue: {},
|
756
|
+
fieldRef: {},
|
757
|
+
width: {},
|
758
|
+
mode: {},
|
759
|
+
layout: {}
|
760
|
+
},
|
761
|
+
setup(u, { expose: r }) {
|
762
|
+
const v = u, l = E(() => He(v.mode)), o = V(!1), n = V({ top: 0, left: 0 }), f = V(null), g = V(null), m = V(null);
|
763
|
+
function k() {
|
764
|
+
const t = g.value, y = m.value;
|
765
|
+
if (!t || !y) return;
|
766
|
+
const b = t.getBoundingClientRect(), s = y.offsetWidth, _ = window.innerWidth, M = b.bottom + 8;
|
767
|
+
let { left: A } = b;
|
768
|
+
A + s > _ && (A = Math.max(_ - s - 10, 10)), n.value = { top: M, left: A };
|
769
|
+
}
|
770
|
+
function h() {
|
771
|
+
o.value = !o.value, o.value && ke(() => {
|
772
|
+
var t, y;
|
773
|
+
k(), (t = v.fieldRef) != null && t.inputTextRef && ((y = v.fieldRef) == null || y.inputTextRef.focus());
|
774
|
+
});
|
775
|
+
}
|
776
|
+
function p(t) {
|
777
|
+
var y, b;
|
778
|
+
!((y = f.value) != null && y.contains(t.target)) && !((b = m.value) != null && b.contains(t.target)) && (o.value = !1);
|
779
|
+
}
|
780
|
+
function x(t) {
|
781
|
+
t.key === "Escape" && (o.value = !1);
|
782
|
+
}
|
783
|
+
const C = V(!1);
|
784
|
+
ue(() => {
|
785
|
+
C.value = !0;
|
786
|
+
}), ue(() => {
|
787
|
+
document.addEventListener("click", p, !0), document.addEventListener("keydown", x), window.addEventListener("scroll", k, !0);
|
788
|
+
}), he(() => {
|
789
|
+
document.removeEventListener("click", p, !0), document.removeEventListener("keydown", x), window.removeEventListener("scroll", k, !0);
|
790
|
+
});
|
791
|
+
function d() {
|
792
|
+
o.value = !1;
|
793
|
+
}
|
794
|
+
r({ close: d });
|
795
|
+
const i = E(() => {
|
796
|
+
var y;
|
797
|
+
const t = (y = v.fieldRef) == null ? void 0 : y.selectedLabels;
|
798
|
+
return t ? Array.isArray(t) ? t.length > 0 ? t.join(", ") : v.label ?? "" : String(t) : v.label ?? "";
|
799
|
+
});
|
800
|
+
return (t, y) => (c(), w("div", null, [
|
801
|
+
a("button", {
|
802
|
+
onClick: h,
|
803
|
+
disabled: t.disabled,
|
804
|
+
ref_key: "triggerRef",
|
805
|
+
ref: g,
|
806
|
+
title: t.label,
|
807
|
+
class: z(l.value + " " + (t.width ? e(ye).getWidthClass(t.width) : "w-full"))
|
808
|
+
}, [
|
809
|
+
a("span", {
|
810
|
+
class: z(["truncate text-ellipsis block", t.width ? e(ye).getWidthClass(t.width - 50) : "w-full"])
|
811
|
+
}, K(i.value), 3),
|
812
|
+
P(be, { class: "h-4 w-4" }),
|
813
|
+
(Array.isArray(t.currentValue) ? t.currentValue === null || t.currentValue.length > 0 : t.currentValue === null || t.currentValue) && t.layout === "inline" ? (c(), w("span", Lt)) : S("", !0)
|
814
|
+
], 10, Ut),
|
815
|
+
C.value ? (c(), j(Fe, {
|
816
|
+
key: 0,
|
817
|
+
to: "body"
|
818
|
+
}, [
|
819
|
+
H(a("div", {
|
820
|
+
ref_key: "popperRef",
|
821
|
+
ref: m,
|
822
|
+
class: "vsTailwind vs-popover__content bottom-right w-fit fixed z-[1000]",
|
823
|
+
style: _e({ top: `${n.value.top}px`, left: `${n.value.left}px` }),
|
824
|
+
"data-inside-popover": ""
|
825
|
+
}, [
|
826
|
+
a("div", Ot, [
|
827
|
+
a("div", Pt, [
|
828
|
+
ee(t.$slots, "default")
|
829
|
+
])
|
830
|
+
])
|
831
|
+
], 4), [
|
832
|
+
[X, o.value]
|
833
|
+
])
|
834
|
+
])) : S("", !0)
|
835
|
+
]));
|
836
|
+
}
|
837
|
+
});
|
838
|
+
function It(u) {
|
839
|
+
return String(u).charAt(0).toUpperCase() + String(u).slice(1);
|
840
|
+
}
|
841
|
+
class N {
|
842
|
+
static format(r) {
|
843
|
+
const v = r.getFullYear(), l = (r.getMonth() + 1).toString().padStart(2, "0"), o = r.getDate().toString().padStart(2, "0");
|
844
|
+
return `${v}-${l}-${o}`;
|
845
|
+
}
|
846
|
+
static getShiftedDay(r, v = 0) {
|
847
|
+
const l = r ? new Date(r) : /* @__PURE__ */ new Date();
|
848
|
+
return l.setDate(l.getDate() + v), this.format(l);
|
849
|
+
}
|
850
|
+
static getLastWeekRange(r, v, l = 0) {
|
851
|
+
if (r && v) {
|
852
|
+
const k = new Date(r), h = new Date(v);
|
853
|
+
return k.setDate(k.getDate() + l * 7), h.setDate(h.getDate() + l * 7), [this.format(k), this.format(h)];
|
854
|
+
}
|
855
|
+
const o = /* @__PURE__ */ new Date(), n = o.getDay(), f = n === 0 ? 13 : n - 1 + 7, g = new Date(o);
|
856
|
+
g.setDate(o.getDate() - f + l * 7);
|
857
|
+
const m = new Date(g);
|
858
|
+
return m.setDate(g.getDate() + 6), [this.format(g), this.format(m)];
|
859
|
+
}
|
860
|
+
static getMonthRange(r, v, l = 0) {
|
861
|
+
let o;
|
862
|
+
r ? o = new Date(r) : o = /* @__PURE__ */ new Date(), o = new Date(o.getFullYear(), o.getMonth() + l, 1);
|
863
|
+
const n = o, f = new Date(o.getFullYear(), o.getMonth() + 1, 0);
|
864
|
+
return [this.format(n), this.format(f)];
|
865
|
+
}
|
866
|
+
static getQuarterRange(r, v, l = 0) {
|
867
|
+
const o = r || v, n = o ? new Date(o) : /* @__PURE__ */ new Date();
|
868
|
+
let f = Math.floor(n.getMonth() / 3);
|
869
|
+
f += l;
|
870
|
+
const g = (f % 4 + 4) % 4 * 3, m = n.getFullYear() + Math.floor(f / 4), k = new Date(m, g, 1), h = new Date(m, g + 3, 0);
|
871
|
+
return [this.format(k), this.format(h)];
|
872
|
+
}
|
873
|
+
static getYear(r, v = 0) {
|
874
|
+
let l;
|
875
|
+
return r && /^\d{4}$/.test(r) ? l = parseInt(r, 10) : r ? l = new Date(r).getFullYear() : l = (/* @__PURE__ */ new Date()).getFullYear(), String(l + v);
|
876
|
+
}
|
877
|
+
static getYearRange(r, v = 0) {
|
878
|
+
let l;
|
879
|
+
return r && /^\d{4}$/.test(r) ? l = parseInt(r, 10) : r ? l = new Date(r).getFullYear() : l = (/* @__PURE__ */ new Date()).getFullYear(), [
|
880
|
+
this.format(new Date(l + v, 0, 1)),
|
881
|
+
this.format(new Date(l + v + 1, 0, 0))
|
882
|
+
];
|
883
|
+
}
|
884
|
+
static getRangeFromDaysBefore(r) {
|
885
|
+
const v = /* @__PURE__ */ new Date(), l = new Date(v.getTime());
|
886
|
+
return l.setDate(v.getDate() - r), [this.format(l), this.format(v)];
|
887
|
+
}
|
888
|
+
}
|
889
|
+
function Ee(u, r) {
|
890
|
+
const {
|
891
|
+
popoverRef: v
|
892
|
+
} = u, l = V(""), o = V(
|
893
|
+
u.modelValue ?? u.default ?? []
|
894
|
+
), n = V(0);
|
895
|
+
function f() {
|
896
|
+
const i = N.getRangeFromDaysBefore(n.value);
|
897
|
+
return o.value = [...i], r("change", { name: u.name, value: o.value }), r("update:modelValue", o.value), i;
|
898
|
+
}
|
899
|
+
function g(i) {
|
900
|
+
var y;
|
901
|
+
l.value = i, (y = v.value) == null || y.close();
|
902
|
+
const t = [];
|
903
|
+
switch (l.value) {
|
904
|
+
case "today":
|
905
|
+
t.push(N.getShiftedDay()), t.push(N.getShiftedDay());
|
906
|
+
break;
|
907
|
+
case "week":
|
908
|
+
t.push(...N.getLastWeekRange());
|
909
|
+
break;
|
910
|
+
case "month":
|
911
|
+
t.push(...N.getMonthRange());
|
912
|
+
break;
|
913
|
+
case "quarter":
|
914
|
+
t.push(...N.getQuarterRange());
|
915
|
+
break;
|
916
|
+
case "year":
|
917
|
+
t.push(...N.getYearRange());
|
918
|
+
break;
|
919
|
+
case "last_7_days":
|
920
|
+
n.value = 7, f();
|
921
|
+
break;
|
922
|
+
case "range":
|
923
|
+
n.value = 7, t.push(...f());
|
924
|
+
break;
|
925
|
+
}
|
926
|
+
o.value = [...t], r("change", { name: u.name, value: o.value }), r("update:modelValue", o.value);
|
927
|
+
}
|
928
|
+
function m() {
|
929
|
+
const i = [];
|
930
|
+
switch (l.value) {
|
931
|
+
case "today":
|
932
|
+
i.push(N.getShiftedDay(o.value[0], 1));
|
933
|
+
break;
|
934
|
+
case "week":
|
935
|
+
i.push(...N.getLastWeekRange(o.value[0], o.value[1], 1));
|
936
|
+
break;
|
937
|
+
case "month":
|
938
|
+
i.push(...N.getMonthRange(o.value[0], o.value[1], 1));
|
939
|
+
break;
|
940
|
+
case "quarter":
|
941
|
+
i.push(...N.getQuarterRange(o.value[0], o.value[1], 1));
|
942
|
+
break;
|
943
|
+
case "year":
|
944
|
+
i.push(...N.getYearRange(o.value[0], 1));
|
945
|
+
break;
|
946
|
+
}
|
947
|
+
o.value = [...i], r("change", { name: u.name, value: o.value }), r("update:modelValue", o.value);
|
948
|
+
}
|
949
|
+
function k() {
|
950
|
+
const i = [];
|
951
|
+
switch (l.value) {
|
952
|
+
case "today":
|
953
|
+
i.push(N.getShiftedDay(o.value[0], -1));
|
954
|
+
break;
|
955
|
+
case "week":
|
956
|
+
i.push(...N.getLastWeekRange(o.value[0], o.value[1], -1));
|
957
|
+
break;
|
958
|
+
case "month":
|
959
|
+
i.push(...N.getMonthRange(o.value[0], o.value[1], -1));
|
960
|
+
break;
|
961
|
+
case "quarter":
|
962
|
+
i.push(...N.getQuarterRange(o.value[0], o.value[1], -1));
|
963
|
+
break;
|
964
|
+
case "year":
|
965
|
+
i.push(...N.getYearRange(o.value[0], -1));
|
966
|
+
break;
|
967
|
+
}
|
968
|
+
o.value = [...i], r("change", { name: u.name, value: o.value }), r("update:modelValue", o.value);
|
969
|
+
}
|
970
|
+
const h = [
|
971
|
+
"Січень",
|
972
|
+
"Лютий",
|
973
|
+
"Березень",
|
974
|
+
"Квітень",
|
975
|
+
"Травень",
|
976
|
+
"Червень",
|
977
|
+
"Липень",
|
978
|
+
"Серпень",
|
979
|
+
"Вересень",
|
980
|
+
"Жовтень",
|
981
|
+
"Листопад",
|
982
|
+
"Грудень"
|
983
|
+
];
|
984
|
+
function p(i) {
|
985
|
+
const [t, y, b] = i.split("-");
|
986
|
+
return `${b}.${y}.${t}`;
|
987
|
+
}
|
988
|
+
function x(i) {
|
989
|
+
const { value: t } = o;
|
990
|
+
switch (i) {
|
991
|
+
case "today":
|
992
|
+
return p(t[0]);
|
993
|
+
case "range":
|
994
|
+
return "Період";
|
995
|
+
case "week":
|
996
|
+
return t[0] && t[1] ? `${p(t[0])} – ${p(t[1])}` : "";
|
997
|
+
case "quarter":
|
998
|
+
if (t[0]) {
|
999
|
+
const y = new Date(t[0]), b = y.getFullYear(), s = y.getMonth();
|
1000
|
+
return `${Math.floor(s / 3) + 1} квартал ${b}`;
|
1001
|
+
}
|
1002
|
+
return "";
|
1003
|
+
case "month":
|
1004
|
+
if (t[0]) {
|
1005
|
+
const [y, b] = t[0].split("-");
|
1006
|
+
return `${h[parseInt(b, 10) - 1]} ${y}`;
|
1007
|
+
}
|
1008
|
+
return "";
|
1009
|
+
case "year":
|
1010
|
+
return t[0] || "";
|
1011
|
+
case "last_7_days":
|
1012
|
+
return "За останні дні";
|
1013
|
+
default:
|
1014
|
+
return u.label ?? "";
|
1015
|
+
}
|
1016
|
+
}
|
1017
|
+
const C = E(() => l.value ? x(l.value) : u.label ?? "");
|
1018
|
+
function d() {
|
1019
|
+
l.value = "", o.value = [], r("update:modelValue", []), r("clear", u.name);
|
1020
|
+
}
|
1021
|
+
return {
|
1022
|
+
activeMode: l,
|
1023
|
+
innerValue: o,
|
1024
|
+
daysBefore: n,
|
1025
|
+
onDaysBeforeChange: f,
|
1026
|
+
onSelectChange: g,
|
1027
|
+
nextClick: m,
|
1028
|
+
prevClick: k,
|
1029
|
+
ukMonths: h,
|
1030
|
+
formatDisplayDate: p,
|
1031
|
+
getModeLabel: x,
|
1032
|
+
currentLabel: C,
|
1033
|
+
clear: d
|
1034
|
+
};
|
1035
|
+
}
|
1036
|
+
const Tt = {
|
1037
|
+
key: 0,
|
1038
|
+
class: "relative flex w-full h-auto gap-2 filter-date m-2 flex-wrap"
|
1039
|
+
}, Ht = {
|
1040
|
+
key: 0,
|
1041
|
+
class: "flex gap-1 !w-[75%] rounded-lg"
|
1042
|
+
}, Et = ["max", "disabled"], Wt = ["min", "disabled"], Yt = {
|
1043
|
+
key: 0,
|
1044
|
+
class: "block text-xs font-medium text-gray-600 mb-1"
|
1045
|
+
}, qt = ["max", "disabled"], Nt = {
|
1046
|
+
key: 0,
|
1047
|
+
class: "block text-xs font-medium text-gray-600 mb-1"
|
1048
|
+
}, Gt = {
|
1049
|
+
key: 0,
|
1050
|
+
class: "block text-xs font-medium text-gray-600 mb-1"
|
1051
|
+
}, Qt = ["min", "disabled"], Zt = { class: "flex gap-1 pt-2" }, Jt = ["onClick"], Xt = /* @__PURE__ */ W({
|
1052
|
+
__name: "date-input",
|
1053
|
+
props: {
|
1054
|
+
id: {},
|
1055
|
+
name: {},
|
1056
|
+
type: {},
|
1057
|
+
label: {},
|
1058
|
+
width: {},
|
1059
|
+
options: {},
|
1060
|
+
placeHolder: {},
|
1061
|
+
api: {},
|
1062
|
+
data: {},
|
1063
|
+
default: {},
|
1064
|
+
modelValue: {},
|
1065
|
+
disabled: { type: Boolean },
|
1066
|
+
layout: { default: "inline" },
|
1067
|
+
cleanable: { type: Boolean },
|
1068
|
+
limit: {},
|
1069
|
+
multi: { type: Boolean },
|
1070
|
+
dataKey: {},
|
1071
|
+
valueKey: {},
|
1072
|
+
mode: {},
|
1073
|
+
labelKey: {},
|
1074
|
+
sort: {}
|
1075
|
+
},
|
1076
|
+
emits: ["update:modelValue", "change", "clear"],
|
1077
|
+
setup(u, { expose: r, emit: v }) {
|
1078
|
+
const l = u, o = Te(), n = At(), f = v, g = V(null), {
|
1079
|
+
activeMode: m,
|
1080
|
+
innerValue: k,
|
1081
|
+
onSelectChange: h,
|
1082
|
+
nextClick: p,
|
1083
|
+
prevClick: x,
|
1084
|
+
clear: C
|
1085
|
+
} = Ee({
|
1086
|
+
...l,
|
1087
|
+
popoverRef: g
|
1088
|
+
}, f);
|
1089
|
+
return R(() => l.modelValue, (d) => {
|
1090
|
+
d !== void 0 ? (k.value = d, f("update:modelValue", d)) : (m.value = "", k.value = []);
|
1091
|
+
}), r({
|
1092
|
+
clear: C,
|
1093
|
+
popoverRef: g
|
1094
|
+
}), (d, i) => (c(), w(F, null, [
|
1095
|
+
d.layout === "inline" ? (c(), w("div", Tt, [
|
1096
|
+
e(m) !== "" && e(m) === "range" ? (c(), w("div", Ht, [
|
1097
|
+
H(a("input", {
|
1098
|
+
type: "date",
|
1099
|
+
max: e(k)[1],
|
1100
|
+
locale: "uk-UA",
|
1101
|
+
"onUpdate:modelValue": i[0] || (i[0] = (t) => e(k)[0] = t),
|
1102
|
+
class: "px-2 p-0 border text-[12px] max-w-[calc(50%-5px)] h-[38px] rounded-lg focus:outline-blue-600",
|
1103
|
+
disabled: d.disabled
|
1104
|
+
}, null, 8, Et), [
|
1105
|
+
[te, e(k)[0]]
|
1106
|
+
]),
|
1107
|
+
H(a("input", {
|
1108
|
+
type: "date",
|
1109
|
+
min: e(k)[0],
|
1110
|
+
locale: "uk-UA",
|
1111
|
+
"onUpdate:modelValue": i[1] || (i[1] = (t) => e(k)[1] = t),
|
1112
|
+
class: "px-2 p-0 border text-[12px] max-w-[calc(50%-5px)] h-[38px] rounded-lg focus:outline-blue-600 appearance-auto",
|
1113
|
+
disabled: d.disabled
|
1114
|
+
}, null, 8, Wt), [
|
1115
|
+
[te, e(k)[1]]
|
1116
|
+
])
|
1117
|
+
])) : S("", !0)
|
1118
|
+
])) : S("", !0),
|
1119
|
+
a("div", {
|
1120
|
+
class: z(d.layout === "popover" ? "space-y-3 p-2" : "flex items-center gap-2")
|
1121
|
+
}, [
|
1122
|
+
a("div", {
|
1123
|
+
class: z(d.layout !== "popover" ? "w-[48%]" : "")
|
1124
|
+
}, [
|
1125
|
+
d.layout === "popover" ? (c(), w("label", Yt, "Від")) : S("", !0),
|
1126
|
+
H(a("input", {
|
1127
|
+
type: "date",
|
1128
|
+
max: e(k)[1],
|
1129
|
+
locale: "uk-UA",
|
1130
|
+
"onUpdate:modelValue": i[2] || (i[2] = (t) => e(k)[0] = t),
|
1131
|
+
class: z(e(o)),
|
1132
|
+
disabled: d.disabled
|
1133
|
+
}, null, 10, qt), [
|
1134
|
+
[te, e(k)[0]]
|
1135
|
+
])
|
1136
|
+
], 2),
|
1137
|
+
d.layout !== "popover" ? (c(), w("label", Nt, " - ")) : S("", !0),
|
1138
|
+
a("div", {
|
1139
|
+
class: z(d.layout !== "popover" ? "w-[48%]" : "")
|
1140
|
+
}, [
|
1141
|
+
d.layout === "popover" ? (c(), w("label", Gt, "До")) : S("", !0),
|
1142
|
+
H(a("input", {
|
1143
|
+
type: "date",
|
1144
|
+
min: e(k)[0],
|
1145
|
+
locale: "uk-UA",
|
1146
|
+
"onUpdate:modelValue": i[3] || (i[3] = (t) => e(k)[1] = t),
|
1147
|
+
class: z(e(o)),
|
1148
|
+
disabled: d.disabled
|
1149
|
+
}, null, 10, Qt), [
|
1150
|
+
[te, e(k)[1]]
|
1151
|
+
])
|
1152
|
+
], 2)
|
1153
|
+
], 2),
|
1154
|
+
a("div", Zt, [
|
1155
|
+
(c(), w(F, null, q(["today", "week", "month", "quarter", "year"], (t) => a("button", {
|
1156
|
+
key: t,
|
1157
|
+
class: z(e(n) + (e(m) === t ? " bg-blue-100" : "")),
|
1158
|
+
onClick: (y) => e(h)(t)
|
1159
|
+
}, K(e(It)(t)), 11, Jt)), 64)),
|
1160
|
+
a("button", {
|
1161
|
+
class: z(e(n)),
|
1162
|
+
onClick: i[4] || (i[4] = //@ts-ignore
|
1163
|
+
(...t) => e(x) && e(x)(...t))
|
1164
|
+
}, " <", 2),
|
1165
|
+
a("button", {
|
1166
|
+
class: z(e(n)),
|
1167
|
+
onClick: i[5] || (i[5] = //@ts-ignore
|
1168
|
+
(...t) => e(p) && e(p)(...t))
|
1169
|
+
}, " >", 2)
|
1170
|
+
]),
|
1171
|
+
(d.cleanable, S("", !0))
|
1172
|
+
], 64));
|
1173
|
+
}
|
1174
|
+
});
|
1175
|
+
function el(u, r) {
|
1176
|
+
const {
|
1177
|
+
api: v,
|
1178
|
+
options: l = [],
|
1179
|
+
limit: o = 20,
|
1180
|
+
dataKey: n = "data"
|
1181
|
+
} = u, f = u.multi;
|
1182
|
+
function g(B) {
|
1183
|
+
return f ? Array.isArray(B) ? B : B ? [B] : [] : Array.isArray(B) ? B[0] : B;
|
1184
|
+
}
|
1185
|
+
const m = V(g(u.modelValue)), k = V(""), h = V(!1), p = V([]), x = V("id"), C = V("text"), d = V(!1), i = V(u.layout !== "popover" && l.length > o), t = V([]), y = V(0);
|
1186
|
+
function b(B) {
|
1187
|
+
const O = B.find(Boolean) ?? {}, G = ["id", "value", "code", "key"].find((ae) => ae in O) ?? "id", ie = ["text", "label", "name", "title"].find((ae) => ae in O) ?? "text";
|
1188
|
+
return { autoValueKey: G, autoLabelKey: ie };
|
1189
|
+
}
|
1190
|
+
if (l.length > 0) {
|
1191
|
+
const B = b(l);
|
1192
|
+
x.value = B.autoValueKey, C.value = B.autoLabelKey;
|
1193
|
+
}
|
1194
|
+
const s = E(() => {
|
1195
|
+
if (v) return p.value;
|
1196
|
+
const B = p.value;
|
1197
|
+
if (u.layout === "popover") return B;
|
1198
|
+
if (!k.value)
|
1199
|
+
return d.value ? B : B.slice(0, o);
|
1200
|
+
const O = k.value.toLowerCase();
|
1201
|
+
return B.filter((G) => G[C.value].toLowerCase().includes(O));
|
1202
|
+
});
|
1203
|
+
let _ = null;
|
1204
|
+
async function M(B) {
|
1205
|
+
if (v) {
|
1206
|
+
h.value = !0;
|
1207
|
+
try {
|
1208
|
+
const O = new URL(v, window.location.origin);
|
1209
|
+
O.searchParams.set("json", "1"), O.searchParams.set("key", B), O.searchParams.set("limit", o.toString());
|
1210
|
+
const G = await fetch(O.toString());
|
1211
|
+
if (!G.ok)
|
1212
|
+
throw new Error(`HTTP error! status: ${G.status}`);
|
1213
|
+
const ie = await G.json();
|
1214
|
+
if (p.value = ie[n], p.value.length > 0) {
|
1215
|
+
const ae = b(p.value);
|
1216
|
+
x.value = ae.autoValueKey, C.value = ae.autoLabelKey;
|
1217
|
+
}
|
1218
|
+
y.value = ie.total;
|
1219
|
+
} catch (O) {
|
1220
|
+
console.error("Failed to fetch remote options:", O);
|
1221
|
+
} finally {
|
1222
|
+
h.value = !1;
|
1223
|
+
}
|
1224
|
+
}
|
1225
|
+
}
|
1226
|
+
R(k, (B) => {
|
1227
|
+
v && (_ && clearTimeout(_), _ = setTimeout(() => {
|
1228
|
+
M(B);
|
1229
|
+
}, 200));
|
1230
|
+
}), R(() => u.modelValue, (B) => {
|
1231
|
+
m.value = g(B);
|
1232
|
+
}, { immediate: !0 }), v ? M("") : p.value = l;
|
1233
|
+
function A(B) {
|
1234
|
+
return f && Array.isArray(m.value) ? m.value.includes(B[x.value]) : m.value && m.value === B[x.value];
|
1235
|
+
}
|
1236
|
+
function U(B) {
|
1237
|
+
if (f && !Array.isArray(m.value) && (m.value = []), f && Array.isArray(m.value)) {
|
1238
|
+
const O = m.value.includes(B[x.value]);
|
1239
|
+
m.value = O ? m.value.filter((G) => G !== B[x.value]) : [...m.value, B[x.value]], t.value = O ? t.value.filter((G) => G !== B[C.value]) : [...t.value, B[C.value]];
|
1240
|
+
} else
|
1241
|
+
m.value = B[x.value], t.value = B[C.value];
|
1242
|
+
r("update:modelValue", m.value), r("change", { name: u.name, value: m.value });
|
1243
|
+
}
|
1244
|
+
function I() {
|
1245
|
+
f ? (m.value = [], t.value = []) : (m.value = void 0, t.value = []), r("update:modelValue", m.value), r("clear", u.name);
|
1246
|
+
}
|
1247
|
+
function L() {
|
1248
|
+
_ && clearTimeout(_), k.value = "", d.value = !1;
|
1249
|
+
}
|
1250
|
+
function de() {
|
1251
|
+
d.value = !d.value;
|
1252
|
+
}
|
1253
|
+
he(() => {
|
1254
|
+
_ && clearTimeout(_);
|
1255
|
+
});
|
1256
|
+
const J = V(-1);
|
1257
|
+
R(s, () => {
|
1258
|
+
J.value = s.value.length > 0 ? 0 : -1;
|
1259
|
+
});
|
1260
|
+
function T(B) {
|
1261
|
+
const O = s.value.length;
|
1262
|
+
if (B.key === "ArrowDown")
|
1263
|
+
B.preventDefault(), J.value = (J.value + 1) % O;
|
1264
|
+
else if (B.key === "ArrowUp")
|
1265
|
+
B.preventDefault(), J.value = (J.value - 1 + O) % O;
|
1266
|
+
else if (B.key === "Enter" && (B.preventDefault(), J.value >= 0 && J.value < s.value.length)) {
|
1267
|
+
const G = s.value[J.value];
|
1268
|
+
U(G);
|
1269
|
+
}
|
1270
|
+
}
|
1271
|
+
return {
|
1272
|
+
innerValue: m,
|
1273
|
+
searchTerm: k,
|
1274
|
+
filteredOptions: s,
|
1275
|
+
isSelected: A,
|
1276
|
+
selectItem: U,
|
1277
|
+
clear: I,
|
1278
|
+
resetSearch: L,
|
1279
|
+
toggleShowAll: de,
|
1280
|
+
isReqProc: h,
|
1281
|
+
showAll: d,
|
1282
|
+
isEnableShowAll: i,
|
1283
|
+
labelKey: C,
|
1284
|
+
valueKey: x,
|
1285
|
+
allOptions: p,
|
1286
|
+
highlightedIndex: J,
|
1287
|
+
onKeyDown: T,
|
1288
|
+
selectedLabels: t,
|
1289
|
+
totalCount: y
|
1290
|
+
};
|
1291
|
+
}
|
1292
|
+
const tl = { class: "h-[45px] shrink-0 px-[6px] py-[4px] flex items-center relative justify-center" }, ll = {
|
1293
|
+
key: 0,
|
1294
|
+
class: "w-full"
|
1295
|
+
}, al = { class: "flex flex-col items-center justify-center p-5 text-center" }, ol = {
|
1296
|
+
key: 0,
|
1297
|
+
class: "flex justify-between p-2 border-t bg-gray-50 text-xs text-gray-500"
|
1298
|
+
}, rl = {
|
1299
|
+
key: 1,
|
1300
|
+
class: "flex justify-between items-center text-xs text-gray-500 p-1 border-t"
|
1301
|
+
}, nl = /* @__PURE__ */ W({
|
1302
|
+
__name: "select",
|
1303
|
+
props: {
|
1304
|
+
id: {},
|
1305
|
+
name: {},
|
1306
|
+
type: {},
|
1307
|
+
label: {},
|
1308
|
+
width: {},
|
1309
|
+
options: { default: () => [] },
|
1310
|
+
placeHolder: {},
|
1311
|
+
api: {},
|
1312
|
+
data: {},
|
1313
|
+
default: {},
|
1314
|
+
modelValue: {},
|
1315
|
+
disabled: { type: Boolean, default: !1 },
|
1316
|
+
layout: { default: "inline" },
|
1317
|
+
cleanable: { type: Boolean },
|
1318
|
+
limit: { default: 10 },
|
1319
|
+
multi: { type: Boolean },
|
1320
|
+
dataKey: {},
|
1321
|
+
valueKey: {},
|
1322
|
+
mode: {},
|
1323
|
+
labelKey: {},
|
1324
|
+
sort: {}
|
1325
|
+
},
|
1326
|
+
emits: ["update:modelValue", "change", "clear"],
|
1327
|
+
setup(u, { expose: r, emit: v }) {
|
1328
|
+
const l = u, o = v, n = V(null), {
|
1329
|
+
innerValue: f,
|
1330
|
+
filteredOptions: g,
|
1331
|
+
isSelected: m,
|
1332
|
+
selectItem: k,
|
1333
|
+
clear: h,
|
1334
|
+
resetSearch: p,
|
1335
|
+
toggleShowAll: x,
|
1336
|
+
isReqProc: C,
|
1337
|
+
showAll: d,
|
1338
|
+
isEnableShowAll: i,
|
1339
|
+
searchTerm: t,
|
1340
|
+
labelKey: y,
|
1341
|
+
valueKey: b,
|
1342
|
+
highlightedIndex: s,
|
1343
|
+
onKeyDown: _,
|
1344
|
+
selectedLabels: M,
|
1345
|
+
totalCount: A
|
1346
|
+
} = el({
|
1347
|
+
...l,
|
1348
|
+
modelValue: l.modelValue
|
1349
|
+
}, o);
|
1350
|
+
ue(() => {
|
1351
|
+
p();
|
1352
|
+
}), R(
|
1353
|
+
() => l.modelValue,
|
1354
|
+
(I) => {
|
1355
|
+
I === void 0 && (l.multi ? f.value = [] : f.value = void 0);
|
1356
|
+
}
|
1357
|
+
);
|
1358
|
+
const U = V([]);
|
1359
|
+
return R(s, (I) => {
|
1360
|
+
var L;
|
1361
|
+
I >= 0 && U.value[I] && ((L = U.value[I]) == null || L.scrollIntoView({
|
1362
|
+
block: "nearest",
|
1363
|
+
behavior: "smooth"
|
1364
|
+
}));
|
1365
|
+
}), R(g, () => {
|
1366
|
+
U.value = [];
|
1367
|
+
}), r({
|
1368
|
+
clear: h,
|
1369
|
+
inputTextRef: n,
|
1370
|
+
selectedLabels: M
|
1371
|
+
}), (I, L) => {
|
1372
|
+
var de, J;
|
1373
|
+
return c(), w("div", {
|
1374
|
+
class: z([I.layout === "popover" ? "flex flex-col h-full" : "flex flex-col vs-filter-checkbox space-y-0.5"])
|
1375
|
+
}, [
|
1376
|
+
a("div", tl, [
|
1377
|
+
H(a("input", {
|
1378
|
+
"onUpdate:modelValue": L[0] || (L[0] = (T) => qe(t) ? t.value = T : null),
|
1379
|
+
onKeydown: L[1] || (L[1] = //@ts-ignore
|
1380
|
+
(...T) => e(_) && e(_)(...T)),
|
1381
|
+
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",
|
1382
|
+
placeholder: "Пошук",
|
1383
|
+
type: "text",
|
1384
|
+
ref_key: "inputTextRef",
|
1385
|
+
ref: n
|
1386
|
+
}, null, 544), [
|
1387
|
+
[te, e(t)]
|
1388
|
+
]),
|
1389
|
+
P(Pe, { class: "absolute text-gray-400 -translate-y-1/2 left-4 top-1/2" }),
|
1390
|
+
P(Ie, {
|
1391
|
+
onClick: L[2] || (L[2] = (T) => t.value = ""),
|
1392
|
+
class: "absolute text-gray-400 -translate-y-1/2 cursor-pointer hover:text-red-500 right-4 top-1/2"
|
1393
|
+
})
|
1394
|
+
]),
|
1395
|
+
a("div", {
|
1396
|
+
class: z([
|
1397
|
+
I.layout === "popover" ? "flex-1 overflow-y-auto max-h-64 p-2" : "",
|
1398
|
+
I.layout === "inline" ? "flex-1 overflow-y-auto max-h-80" : ""
|
1399
|
+
])
|
1400
|
+
}, [
|
1401
|
+
(c(!0), w(F, null, q(e(g), (T, B) => (c(), j(Ce, {
|
1402
|
+
layout: I.layout,
|
1403
|
+
count: T.count,
|
1404
|
+
label: T[e(y)],
|
1405
|
+
color: T.color,
|
1406
|
+
type: I.multi ? "checkbox" : "radio",
|
1407
|
+
value: T[e(b)],
|
1408
|
+
"is-selected": e(m)(T),
|
1409
|
+
highlighted: B === e(s),
|
1410
|
+
onItemClick: (O) => e(k)(T),
|
1411
|
+
ref_for: !0,
|
1412
|
+
ref: (O) => U.value[B] = O == null ? void 0 : O.el
|
1413
|
+
}, null, 8, ["layout", "count", "label", "color", "type", "value", "is-selected", "highlighted", "onItemClick"]))), 256))
|
1414
|
+
], 2),
|
1415
|
+
I.type === "select" && e(g).length === 0 && !e(C) ? (c(), w("div", ll, [
|
1416
|
+
a("div", al, [
|
1417
|
+
P(Ve),
|
1418
|
+
L[7] || (L[7] = a("div", { class: "max-w-sm mx-auto mt-6" }, [
|
1419
|
+
a("p", { class: "font-medium text-gray-800 dark:text-neutral-200" }, "За вашим запитом нічого не знайдено"),
|
1420
|
+
a("p", { class: "mt-2 text-sm text-gray-500 dark:text-neutral-500" })
|
1421
|
+
], -1))
|
1422
|
+
])
|
1423
|
+
])) : S("", !0),
|
1424
|
+
I.layout !== "popover" && I.type !== "select" ? (c(), w(F, { key: 1 }, [
|
1425
|
+
!e(d) && e(i) ? (c(), w("div", {
|
1426
|
+
key: 0,
|
1427
|
+
onClick: L[3] || (L[3] = //@ts-ignore
|
1428
|
+
(...T) => e(x) && e(x)(...T)),
|
1429
|
+
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"
|
1430
|
+
}, [
|
1431
|
+
L[8] || (L[8] = Y(" Показати більше ", -1)),
|
1432
|
+
P(be)
|
1433
|
+
])) : S("", !0),
|
1434
|
+
e(d) ? (c(), w("div", {
|
1435
|
+
key: 1,
|
1436
|
+
onClick: L[4] || (L[4] = //@ts-ignore
|
1437
|
+
(...T) => e(x) && e(x)(...T)),
|
1438
|
+
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"
|
1439
|
+
}, [
|
1440
|
+
L[9] || (L[9] = Y(" Показати менше ", -1)),
|
1441
|
+
P(Se)
|
1442
|
+
])) : S("", !0)
|
1443
|
+
], 64)) : S("", !0),
|
1444
|
+
I.cleanable ? (c(), w(F, { key: 2 }, [
|
1445
|
+
I.layout === "inline" ? (c(), w("div", ol, [
|
1446
|
+
Y(K(I.multi && Array.isArray(e(f)) ? (de = e(f)) == null ? void 0 : de.length : e(f) !== void 0 && (e(f) || e(f) === null) ? 1 : 0) + " з " + K(e(A)) + " обрано ", 1),
|
1447
|
+
H(a("button", {
|
1448
|
+
class: "text-gray-600 hover:text-gray-800",
|
1449
|
+
onClick: L[5] || (L[5] = //@ts-ignore
|
1450
|
+
(...T) => e(h) && e(h)(...T))
|
1451
|
+
}, " Очистити ", 512), [
|
1452
|
+
[X, e(f) !== "" && e(f) !== void 0 || e(f)]
|
1453
|
+
])
|
1454
|
+
])) : S("", !0),
|
1455
|
+
I.layout === "popover" ? (c(), w("div", rl, [
|
1456
|
+
a("span", null, K(I.multi && Array.isArray(e(f)) ? (J = e(f)) == null ? void 0 : J.length : e(f) !== void 0 && (e(f) || e(f) === null) ? 1 : 0) + " з " + K(e(A)) + " обрано", 1),
|
1457
|
+
H(a("button", {
|
1458
|
+
class: "text-gray-600 hover:text-gray-800",
|
1459
|
+
onClick: L[6] || (L[6] = //@ts-ignore
|
1460
|
+
(...T) => e(h) && e(h)(...T))
|
1461
|
+
}, " Очистити ", 512), [
|
1462
|
+
[X, e(f) !== "" && e(f) !== void 0 || e(f)]
|
1463
|
+
])
|
1464
|
+
])) : S("", !0)
|
1465
|
+
], 64)) : S("", !0)
|
1466
|
+
], 2);
|
1467
|
+
};
|
1468
|
+
}
|
1469
|
+
}), il = ["for", "onClick"], sl = ["id", "name", "value"], ul = { class: "block" }, dl = {
|
1470
|
+
key: 0,
|
1471
|
+
class: "flex justify-between p-2 border-t bg-gray-50 text-xs text-gray-500"
|
1472
|
+
}, cl = {
|
1473
|
+
key: 1,
|
1474
|
+
class: "flex justify-between items-center text-xs text-gray-500 p-1 border-t"
|
1475
|
+
}, pl = /* @__PURE__ */ W({
|
1476
|
+
__name: "tag-field",
|
1477
|
+
props: {
|
1478
|
+
id: {},
|
1479
|
+
name: {},
|
1480
|
+
type: {},
|
1481
|
+
label: {},
|
1482
|
+
width: {},
|
1483
|
+
options: { default: () => [] },
|
1484
|
+
placeHolder: {},
|
1485
|
+
api: {},
|
1486
|
+
data: {},
|
1487
|
+
default: {},
|
1488
|
+
modelValue: {},
|
1489
|
+
disabled: { type: Boolean, default: !1 },
|
1490
|
+
layout: { default: "inline" },
|
1491
|
+
cleanable: { type: Boolean },
|
1492
|
+
limit: {},
|
1493
|
+
multi: { type: Boolean },
|
1494
|
+
dataKey: {},
|
1495
|
+
valueKey: {},
|
1496
|
+
mode: {},
|
1497
|
+
labelKey: {},
|
1498
|
+
sort: {}
|
1499
|
+
},
|
1500
|
+
emits: ["update:modelValue", "change", "clear"],
|
1501
|
+
setup(u, { expose: r, emit: v }) {
|
1502
|
+
const l = u, o = v, {
|
1503
|
+
innerValue: n,
|
1504
|
+
isSelected: f,
|
1505
|
+
selectItem: g,
|
1506
|
+
clear: m,
|
1507
|
+
labelKey: k,
|
1508
|
+
valueKey: h,
|
1509
|
+
allOptions: p
|
1510
|
+
} = l.multi ? Oe({
|
1511
|
+
...l,
|
1512
|
+
modelValue: l.modelValue ?? l.default ?? []
|
1513
|
+
}, o) : Le({
|
1514
|
+
...l,
|
1515
|
+
modelValue: l.modelValue !== void 0 ? l.modelValue : l.default ?? ""
|
1516
|
+
}, o);
|
1517
|
+
return r({
|
1518
|
+
clear: m
|
1519
|
+
}), R(
|
1520
|
+
() => l.modelValue,
|
1521
|
+
(x) => {
|
1522
|
+
x === void 0 && (l.multi ? n.value = [] : n.value = void 0);
|
1523
|
+
}
|
1524
|
+
), (x, C) => {
|
1525
|
+
var d, i;
|
1526
|
+
return c(), w(F, null, [
|
1527
|
+
a("div", {
|
1528
|
+
class: z(["grid grid-cols-3 gap-2 mx-[1px]", x.layout === "popover" ? "m-1" : "mb-1"])
|
1529
|
+
}, [
|
1530
|
+
(c(!0), w(F, null, q(e(p), (t) => (c(), w("label", {
|
1531
|
+
key: `item-${t[e(h)]}`,
|
1532
|
+
for: `item-${t[e(h)]}`,
|
1533
|
+
onClick: Ke((y) => e(g)(t), ["stop", "prevent"]),
|
1534
|
+
class: z([e(f)(t) ? "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%)]"])
|
1535
|
+
}, [
|
1536
|
+
a("input", {
|
1537
|
+
type: "checkbox",
|
1538
|
+
id: `item-${t[e(h)]}`,
|
1539
|
+
class: "hidden w4poy border-gray-200 g41z1 g22e3 axcnw dark:text-indigo-500 dark:border-neutral-700 dark:focus:ring-neutral-900",
|
1540
|
+
name: `item-${t[e(h)]}`,
|
1541
|
+
value: t[e(h)]
|
1542
|
+
}, null, 8, sl),
|
1543
|
+
a("span", ul, K(t[e(k)]), 1)
|
1544
|
+
], 10, il))), 128))
|
1545
|
+
], 2),
|
1546
|
+
x.cleanable ? (c(), w(F, { key: 0 }, [
|
1547
|
+
x.layout === "inline" ? (c(), w("div", dl, [
|
1548
|
+
Y(K(x.multi && Array.isArray(e(n)) ? (d = e(n)) == null ? void 0 : d.length : e(n) !== void 0 && (e(n) || e(n) === null) ? 1 : 0) + " з " + K(e(p).length) + " обрано ", 1),
|
1549
|
+
H(a("button", {
|
1550
|
+
class: "text-gray-600 hover:text-gray-800",
|
1551
|
+
onClick: C[0] || (C[0] = //@ts-ignore
|
1552
|
+
(...t) => e(m) && e(m)(...t))
|
1553
|
+
}, " Очистити ", 512), [
|
1554
|
+
[X, e(n) !== "" && e(n) !== void 0 || e(n)]
|
1555
|
+
])
|
1556
|
+
])) : S("", !0),
|
1557
|
+
x.layout === "popover" ? (c(), w("div", cl, [
|
1558
|
+
a("span", null, K(x.multi && Array.isArray(e(n)) ? (i = e(n)) == null ? void 0 : i.length : e(n) !== void 0 && (e(n) || e(n) === null) ? 1 : 0) + " з " + K(e(p).length) + " обрано", 1),
|
1559
|
+
H(a("button", {
|
1560
|
+
class: "text-gray-600 hover:text-gray-800",
|
1561
|
+
onClick: C[1] || (C[1] = //@ts-ignore
|
1562
|
+
(...t) => e(m) && e(m)(...t))
|
1563
|
+
}, " Очистити ", 512), [
|
1564
|
+
[X, e(n) !== void 0 && e(n) !== "" || e(n)]
|
1565
|
+
])
|
1566
|
+
])) : S("", !0)
|
1567
|
+
], 64)) : S("", !0)
|
1568
|
+
], 64);
|
1569
|
+
};
|
1570
|
+
}
|
1571
|
+
}), fl = {}, vl = {
|
1572
|
+
xmlns: "http://www.w3.org/2000/svg",
|
1573
|
+
width: "24",
|
1574
|
+
height: "24",
|
1575
|
+
viewBox: "0 0 24 24",
|
1576
|
+
fill: "none",
|
1577
|
+
stroke: "currentColor",
|
1578
|
+
"stroke-width": "2",
|
1579
|
+
"stroke-linecap": "round",
|
1580
|
+
"stroke-linejoin": "round",
|
1581
|
+
class: "text-blue-600 w-[16px] h-[16px]"
|
1582
|
+
};
|
1583
|
+
function ml(u, r) {
|
1584
|
+
return c(), w("svg", vl, r[0] || (r[0] = [
|
1585
|
+
a("path", { d: "M20 6 9 17l-5-5" }, null, -1)
|
1586
|
+
]));
|
1587
|
+
}
|
1588
|
+
const se = /* @__PURE__ */ le(fl, [["render", ml]]), gl = {}, hl = {
|
1589
|
+
xmlns: "http://www.w3.org/2000/svg",
|
1590
|
+
width: "15px",
|
1591
|
+
height: "24",
|
1592
|
+
viewBox: "0 0 24 24",
|
1593
|
+
fill: "none",
|
1594
|
+
stroke: "currentColor",
|
1595
|
+
"stroke-width": "2",
|
1596
|
+
"stroke-linecap": "round",
|
1597
|
+
"stroke-linejoin": "round",
|
1598
|
+
class: "icon icon-tabler icons-tabler-outline icon-tabler-chevron-down text-gray-800 rotate-[90deg]"
|
1599
|
+
};
|
1600
|
+
function bl(u, r) {
|
1601
|
+
return c(), w("svg", hl, r[0] || (r[0] = [
|
1602
|
+
a("path", {
|
1603
|
+
stroke: "none",
|
1604
|
+
d: "M0 0h24v24H0z",
|
1605
|
+
fill: "none"
|
1606
|
+
}, null, -1),
|
1607
|
+
a("path", { d: "M6 9l6 6l6 -6" }, null, -1)
|
1608
|
+
]));
|
1609
|
+
}
|
1610
|
+
const yl = /* @__PURE__ */ le(gl, [["render", bl]]), xl = {}, wl = {
|
1611
|
+
xmlns: "http://www.w3.org/2000/svg",
|
1612
|
+
width: "15px",
|
1613
|
+
height: "24",
|
1614
|
+
viewBox: "0 0 24 24",
|
1615
|
+
fill: "none",
|
1616
|
+
stroke: "currentColor",
|
1617
|
+
"stroke-width": "2",
|
1618
|
+
"stroke-linecap": "round",
|
1619
|
+
"stroke-linejoin": "round",
|
1620
|
+
class: "icon icon-tabler icons-tabler-outline icon-tabler-chevron-down text-gray-800 rotate-[270deg]"
|
1621
|
+
};
|
1622
|
+
function kl(u, r) {
|
1623
|
+
return c(), w("svg", wl, r[0] || (r[0] = [
|
1624
|
+
a("path", {
|
1625
|
+
stroke: "none",
|
1626
|
+
d: "M0 0h24v24H0z",
|
1627
|
+
fill: "none"
|
1628
|
+
}, null, -1),
|
1629
|
+
a("path", { d: "M6 9l6 6l6 -6" }, null, -1)
|
1630
|
+
]));
|
1631
|
+
}
|
1632
|
+
const _l = /* @__PURE__ */ le(xl, [["render", kl]]), Cl = { class: "flex" }, Vl = { class: "mb-1" }, Sl = { class: "mb-1" }, Ml = { class: "inline-flex rounded-lg shrink-0 pl-1" }, Bl = { class: "inline-flex rounded-lg shrink-0 pl-1" }, Al = {
|
1633
|
+
key: 1,
|
1634
|
+
class: "flex gap-1 !w-[75%] rounded-lg"
|
1635
|
+
}, $l = ["max", "disabled"], Rl = ["min", "disabled"], Dl = /* @__PURE__ */ W({
|
1636
|
+
__name: "date-input-inline",
|
1637
|
+
props: {
|
1638
|
+
id: {},
|
1639
|
+
name: {},
|
1640
|
+
type: {},
|
1641
|
+
label: {},
|
1642
|
+
width: {},
|
1643
|
+
options: {},
|
1644
|
+
placeHolder: {},
|
1645
|
+
api: {},
|
1646
|
+
data: {},
|
1647
|
+
default: {},
|
1648
|
+
modelValue: {},
|
1649
|
+
disabled: { type: Boolean },
|
1650
|
+
layout: { default: "inline" },
|
1651
|
+
cleanable: { type: Boolean },
|
1652
|
+
limit: {},
|
1653
|
+
multi: { type: Boolean },
|
1654
|
+
dataKey: {},
|
1655
|
+
valueKey: {},
|
1656
|
+
mode: {},
|
1657
|
+
labelKey: {},
|
1658
|
+
sort: {}
|
1659
|
+
},
|
1660
|
+
emits: ["update:modelValue", "change", "clear"],
|
1661
|
+
setup(u, { expose: r, emit: v }) {
|
1662
|
+
const l = u, o = v, n = V(null), {
|
1663
|
+
activeMode: f,
|
1664
|
+
innerValue: g,
|
1665
|
+
onSelectChange: m,
|
1666
|
+
nextClick: k,
|
1667
|
+
prevClick: h,
|
1668
|
+
currentLabel: p,
|
1669
|
+
clear: x
|
1670
|
+
} = Ee({
|
1671
|
+
...l,
|
1672
|
+
popoverRef: n
|
1673
|
+
}, o);
|
1674
|
+
return R(() => l.modelValue, (C) => {
|
1675
|
+
C !== void 0 ? (g.value = C, o("update:modelValue", C)) : (f.value = "", g.value = []);
|
1676
|
+
}), r({
|
1677
|
+
clear: x,
|
1678
|
+
popoverRef: n
|
1679
|
+
}), (C, d) => (c(), w(F, null, [
|
1680
|
+
a("div", Cl, [
|
1681
|
+
P(Me, {
|
1682
|
+
ref_key: "popoverRef",
|
1683
|
+
ref: n,
|
1684
|
+
label: e(p),
|
1685
|
+
"current-value": e(g),
|
1686
|
+
mode: C.mode,
|
1687
|
+
onClear: e(x),
|
1688
|
+
layout: C.layout
|
1689
|
+
}, {
|
1690
|
+
default: re(() => [
|
1691
|
+
a("div", null, [
|
1692
|
+
a("button", {
|
1693
|
+
type: "button",
|
1694
|
+
onClick: d[0] || (d[0] = (i) => e(m)("range")),
|
1695
|
+
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"
|
1696
|
+
}, [
|
1697
|
+
d[12] || (d[12] = Y(" Період ", -1)),
|
1698
|
+
e(f) === "range" ? (c(), j(se, { key: 0 })) : S("", !0)
|
1699
|
+
])
|
1700
|
+
]),
|
1701
|
+
d[19] || (d[19] = a("div", null, [
|
1702
|
+
a("div", { class: "pt-1 mt-1 border-t" })
|
1703
|
+
], -1)),
|
1704
|
+
a("div", null, [
|
1705
|
+
a("button", {
|
1706
|
+
type: "button",
|
1707
|
+
onClick: d[1] || (d[1] = (i) => e(m)("today")),
|
1708
|
+
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"
|
1709
|
+
}, [
|
1710
|
+
d[13] || (d[13] = Y(" Сьогодні ", -1)),
|
1711
|
+
e(f) === "today" ? (c(), j(se, { key: 0 })) : S("", !0)
|
1712
|
+
])
|
1713
|
+
]),
|
1714
|
+
a("div", null, [
|
1715
|
+
a("button", {
|
1716
|
+
type: "button",
|
1717
|
+
onClick: d[2] || (d[2] = (i) => e(m)("week")),
|
1718
|
+
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"
|
1719
|
+
}, [
|
1720
|
+
d[14] || (d[14] = Y(" Тиждень ", -1)),
|
1721
|
+
e(f) === "week" ? (c(), j(se, { key: 0 })) : S("", !0)
|
1722
|
+
])
|
1723
|
+
]),
|
1724
|
+
a("div", null, [
|
1725
|
+
a("button", {
|
1726
|
+
type: "button",
|
1727
|
+
onClick: d[3] || (d[3] = (i) => e(m)("month")),
|
1728
|
+
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"
|
1729
|
+
}, [
|
1730
|
+
d[15] || (d[15] = Y(" Місяць ", -1)),
|
1731
|
+
e(f) === "month" ? (c(), j(se, { key: 0 })) : S("", !0)
|
1732
|
+
])
|
1733
|
+
]),
|
1734
|
+
a("div", null, [
|
1735
|
+
a("button", {
|
1736
|
+
type: "button",
|
1737
|
+
onClick: d[4] || (d[4] = (i) => e(m)("quarter")),
|
1738
|
+
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"
|
1739
|
+
}, [
|
1740
|
+
d[16] || (d[16] = Y(" Квартал ", -1)),
|
1741
|
+
e(f) === "quarter" ? (c(), j(se, { key: 0 })) : S("", !0)
|
1742
|
+
])
|
1743
|
+
]),
|
1744
|
+
a("div", Vl, [
|
1745
|
+
a("button", {
|
1746
|
+
type: "button",
|
1747
|
+
onClick: d[5] || (d[5] = (i) => e(m)("year")),
|
1748
|
+
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"
|
1749
|
+
}, [
|
1750
|
+
d[17] || (d[17] = Y(" Рік ", -1)),
|
1751
|
+
e(f) === "year" ? (c(), j(se, { key: 0 })) : S("", !0)
|
1752
|
+
])
|
1753
|
+
]),
|
1754
|
+
a("div", Sl, [
|
1755
|
+
a("button", {
|
1756
|
+
type: "button",
|
1757
|
+
onClick: d[6] || (d[6] = (i) => e(x)()),
|
1758
|
+
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"
|
1759
|
+
}, [
|
1760
|
+
d[18] || (d[18] = Y(" Весь час ", -1)),
|
1761
|
+
e(g)[0] ? S("", !0) : (c(), j(se, { key: 0 }))
|
1762
|
+
])
|
1763
|
+
])
|
1764
|
+
]),
|
1765
|
+
_: 1,
|
1766
|
+
__: [19]
|
1767
|
+
}, 8, ["label", "current-value", "mode", "onClear", "layout"]),
|
1768
|
+
e(f) !== "" && e(f) !== "range" && e(f) !== "last_7_days" ? (c(), w(F, { key: 0 }, [
|
1769
|
+
a("div", Ml, [
|
1770
|
+
a("button", {
|
1771
|
+
type: "button",
|
1772
|
+
title: "Попередній період",
|
1773
|
+
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",
|
1774
|
+
onClick: d[7] || (d[7] = //@ts-ignore
|
1775
|
+
(...i) => e(h) && e(h)(...i))
|
1776
|
+
}, [
|
1777
|
+
P(yl)
|
1778
|
+
])
|
1779
|
+
]),
|
1780
|
+
a("div", Bl, [
|
1781
|
+
a("button", {
|
1782
|
+
type: "button",
|
1783
|
+
title: "Наступний період",
|
1784
|
+
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",
|
1785
|
+
onClick: d[8] || (d[8] = //@ts-ignore
|
1786
|
+
(...i) => e(k) && e(k)(...i))
|
1787
|
+
}, [
|
1788
|
+
P(_l)
|
1789
|
+
])
|
1790
|
+
])
|
1791
|
+
], 64)) : S("", !0),
|
1792
|
+
e(f) !== "" && e(f) === "range" ? (c(), w("div", Al, [
|
1793
|
+
H(a("input", {
|
1794
|
+
type: "date",
|
1795
|
+
max: e(g)[1],
|
1796
|
+
locale: "uk-UA",
|
1797
|
+
"onUpdate:modelValue": d[9] || (d[9] = (i) => e(g)[0] = i),
|
1798
|
+
class: "px-2 p-0 border text-[12px] max-w-[calc(50%-5px)] h-[38px] rounded-lg focus:outline-blue-600",
|
1799
|
+
disabled: C.disabled
|
1800
|
+
}, null, 8, $l), [
|
1801
|
+
[te, e(g)[0]]
|
1802
|
+
]),
|
1803
|
+
H(a("input", {
|
1804
|
+
type: "date",
|
1805
|
+
min: e(g)[0],
|
1806
|
+
locale: "uk-UA",
|
1807
|
+
"onUpdate:modelValue": d[10] || (d[10] = (i) => e(g)[1] = i),
|
1808
|
+
class: "px-2 p-0 border text-[12px] max-w-[calc(50%-5px)] h-[38px] rounded-lg focus:outline-blue-600 appearance-auto",
|
1809
|
+
disabled: C.disabled
|
1810
|
+
}, null, 8, Rl), [
|
1811
|
+
[te, e(g)[1]]
|
1812
|
+
])
|
1813
|
+
])) : S("", !0)
|
1814
|
+
]),
|
1815
|
+
(C.cleanable, S("", !0))
|
1816
|
+
], 64));
|
1817
|
+
}
|
1818
|
+
}), De = {
|
1819
|
+
radio: vt,
|
1820
|
+
checkbox: Re,
|
1821
|
+
check: Re,
|
1822
|
+
text: Mt,
|
1823
|
+
range: Kt,
|
1824
|
+
date: Xt,
|
1825
|
+
select: nl,
|
1826
|
+
tag: pl,
|
1827
|
+
"date:inline": Dl
|
1828
|
+
};
|
1829
|
+
function Be(u, r) {
|
1830
|
+
let v;
|
1831
|
+
switch (u.toLowerCase()) {
|
1832
|
+
case "autocomplete":
|
1833
|
+
v = "select";
|
1834
|
+
break;
|
1835
|
+
case "check":
|
1836
|
+
v = "checkbox";
|
1837
|
+
break;
|
1838
|
+
default:
|
1839
|
+
v = u == null ? void 0 : u.toString().toLowerCase();
|
1840
|
+
}
|
1841
|
+
return v === "date" && r && r === "inline" && (v = "date:inline"), {
|
1842
|
+
component: De[v] || De.text,
|
1843
|
+
type: v
|
1844
|
+
};
|
1845
|
+
}
|
1846
|
+
const jl = {}, zl = {
|
1847
|
+
xmlns: "http://www.w3.org/2000/svg",
|
1848
|
+
width: "15px",
|
1849
|
+
height: "24",
|
1850
|
+
viewBox: "0 0 24 24",
|
1851
|
+
fill: "none",
|
1852
|
+
stroke: "currentColor",
|
1853
|
+
"stroke-width": "2",
|
1854
|
+
"stroke-linecap": "round",
|
1855
|
+
"stroke-linejoin": "round",
|
1856
|
+
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"
|
1857
|
+
};
|
1858
|
+
function Fl(u, r) {
|
1859
|
+
return c(), w("svg", zl, r[0] || (r[0] = [
|
1860
|
+
a("path", {
|
1861
|
+
stroke: "none",
|
1862
|
+
d: "M0 0h24v24H0z",
|
1863
|
+
fill: "none"
|
1864
|
+
}, null, -1),
|
1865
|
+
a("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),
|
1866
|
+
a("path", { d: "M20 4v5h-5" }, null, -1)
|
1867
|
+
]));
|
1868
|
+
}
|
1869
|
+
const Kl = /* @__PURE__ */ le(jl, [["render", Fl]]), Ul = { style: { display: "inline-flex", margin: "0px", width: "100%" } }, Ll = { 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" }, Pl = { class: "flex items-center" }, Il = { class: "text-sm font-medium max-w-[80%] text-gray-800 flex items-center gap-x-1" }, Tl = { class: "filter-layout__body" }, Hl = /* @__PURE__ */ W({
|
1870
|
+
__name: "vertical-layout",
|
1871
|
+
props: {
|
1872
|
+
id: {},
|
1873
|
+
name: {},
|
1874
|
+
type: {},
|
1875
|
+
label: {},
|
1876
|
+
width: {},
|
1877
|
+
options: {},
|
1878
|
+
placeHolder: {},
|
1879
|
+
api: {},
|
1880
|
+
data: {},
|
1881
|
+
default: {},
|
1882
|
+
modelValue: {},
|
1883
|
+
disabled: { type: Boolean },
|
1884
|
+
layout: {},
|
1885
|
+
cleanable: { type: Boolean },
|
1886
|
+
limit: {},
|
1887
|
+
multi: { type: Boolean },
|
1888
|
+
dataKey: {},
|
1889
|
+
valueKey: {},
|
1890
|
+
mode: {},
|
1891
|
+
labelKey: {},
|
1892
|
+
sort: {}
|
1893
|
+
},
|
1894
|
+
emits: ["update:modelValue", "change", "clear"],
|
1895
|
+
setup(u, { expose: r, emit: v }) {
|
1896
|
+
const l = u, o = v, n = V(), f = Be(l.type, l.layout), g = E({
|
1897
|
+
get: () => l.modelValue,
|
1898
|
+
set: (p) => o("update:modelValue", p)
|
1899
|
+
});
|
1900
|
+
function m(p) {
|
1901
|
+
o("clear", p);
|
1902
|
+
}
|
1903
|
+
function k(p, x) {
|
1904
|
+
o("change", { name: p, value: x }), l.modelValue !== void 0 && o("update:modelValue", x);
|
1905
|
+
}
|
1906
|
+
function h() {
|
1907
|
+
n.value && n.value.clear(), o("clear", l.name);
|
1908
|
+
}
|
1909
|
+
return R(
|
1910
|
+
() => l.default,
|
1911
|
+
(p) => {
|
1912
|
+
g.value = p;
|
1913
|
+
}
|
1914
|
+
), R(
|
1915
|
+
() => l.modelValue,
|
1916
|
+
(p) => {
|
1917
|
+
g.value = p;
|
1918
|
+
}
|
1919
|
+
), r({
|
1920
|
+
filterRef: n
|
1921
|
+
}), (p, x) => {
|
1922
|
+
var C, d, i;
|
1923
|
+
return c(), w("div", Ul, [
|
1924
|
+
a("div", Ll, [
|
1925
|
+
a("div", Ol, [
|
1926
|
+
a("div", Pl, [
|
1927
|
+
a("span", Il, K(p.label), 1)
|
1928
|
+
]),
|
1929
|
+
typeof g.value == "string" && g.value.trim() !== "" || Array.isArray(g.value) && g.value.length > 0 && g.value.some((t) => t !== void 0) || g.value === null ? (c(), j(Kl, {
|
1930
|
+
key: 0,
|
1931
|
+
onClick: h
|
1932
|
+
})) : S("", !0)
|
1933
|
+
]),
|
1934
|
+
a("div", Tl, [
|
1935
|
+
((C = e(f)) == null ? void 0 : C.type) !== "select" ? (c(), j(oe((d = e(f)) == null ? void 0 : d.component), Z({ key: 0 }, l, {
|
1936
|
+
type: (i = e(f)) == null ? void 0 : i.type,
|
1937
|
+
onChange: x[0] || (x[0] = (t) => k(t.name, t.value)),
|
1938
|
+
onClear: x[1] || (x[1] = (t) => m(t)),
|
1939
|
+
ref_key: "filterRef",
|
1940
|
+
ref: n
|
1941
|
+
}), null, 16, ["type"])) : (c(), j(Me, {
|
1942
|
+
key: 1,
|
1943
|
+
"current-value": g.value,
|
1944
|
+
label: p.label,
|
1945
|
+
mode: p.mode,
|
1946
|
+
onClear: h,
|
1947
|
+
fieldRef: n.value,
|
1948
|
+
width: void 0,
|
1949
|
+
disabled: p.disabled,
|
1950
|
+
layout: "vertical"
|
1951
|
+
}, {
|
1952
|
+
default: re(() => {
|
1953
|
+
var t, y;
|
1954
|
+
return [
|
1955
|
+
(c(), j(oe((t = e(f)) == null ? void 0 : t.component), Z({
|
1956
|
+
ref_key: "filterRef",
|
1957
|
+
ref: n
|
1958
|
+
}, l, {
|
1959
|
+
type: (y = e(f)) == null ? void 0 : y.type,
|
1960
|
+
onChange: x[2] || (x[2] = (b) => k(b.name, b.value)),
|
1961
|
+
onClear: x[3] || (x[3] = (b) => m(b))
|
1962
|
+
}), null, 16, ["type"]))
|
1963
|
+
];
|
1964
|
+
}),
|
1965
|
+
_: 1
|
1966
|
+
}, 8, ["current-value", "label", "mode", "fieldRef", "disabled"]))
|
1967
|
+
])
|
1968
|
+
])
|
1969
|
+
]);
|
1970
|
+
};
|
1971
|
+
}
|
1972
|
+
}), je = /* @__PURE__ */ W({
|
1973
|
+
__name: "inline-layout",
|
1974
|
+
props: {
|
1975
|
+
id: {},
|
1976
|
+
name: {},
|
1977
|
+
type: {},
|
1978
|
+
label: {},
|
1979
|
+
width: {},
|
1980
|
+
options: {},
|
1981
|
+
placeHolder: {},
|
1982
|
+
api: {},
|
1983
|
+
data: {},
|
1984
|
+
default: {},
|
1985
|
+
modelValue: {},
|
1986
|
+
disabled: { type: Boolean },
|
1987
|
+
layout: {},
|
1988
|
+
cleanable: { type: Boolean },
|
1989
|
+
limit: {},
|
1990
|
+
multi: { type: Boolean },
|
1991
|
+
dataKey: {},
|
1992
|
+
valueKey: {},
|
1993
|
+
mode: {},
|
1994
|
+
labelKey: {},
|
1995
|
+
sort: {}
|
1996
|
+
},
|
1997
|
+
emits: ["update:modelValue", "change", "clear"],
|
1998
|
+
setup(u, { expose: r, emit: v }) {
|
1999
|
+
const l = u, o = v, n = V(), f = Be(l.type, l.layout), g = E({
|
2000
|
+
get: () => l.modelValue,
|
2001
|
+
set: (h) => o("update:modelValue", h)
|
2002
|
+
});
|
2003
|
+
function m(h = l.name) {
|
2004
|
+
o("clear", h);
|
2005
|
+
}
|
2006
|
+
function k(h, p) {
|
2007
|
+
o("change", { name: h, value: p }), l.modelValue !== void 0 && o("update:modelValue", p);
|
2008
|
+
}
|
2009
|
+
return R(
|
2010
|
+
() => l.default,
|
2011
|
+
(h) => {
|
2012
|
+
g.value = h;
|
2013
|
+
}
|
2014
|
+
), R(
|
2015
|
+
() => l.modelValue,
|
2016
|
+
(h) => {
|
2017
|
+
g.value = h;
|
2018
|
+
}
|
2019
|
+
), r({
|
2020
|
+
filterRef: n
|
2021
|
+
}), (h, p) => {
|
2022
|
+
var x, C;
|
2023
|
+
return ["text", "date"].includes(h.type.toLocaleLowerCase()) ? (c(), j(oe((x = e(f)) == null ? void 0 : x.component), Z({ key: 0 }, l, {
|
2024
|
+
type: (C = e(f)) == null ? void 0 : C.type,
|
2025
|
+
onChange: p[0] || (p[0] = (d) => k(d.name, d.value)),
|
2026
|
+
onClear: p[1] || (p[1] = (d) => m(d)),
|
2027
|
+
disabled: h.disabled,
|
2028
|
+
modelValue: g.value,
|
2029
|
+
"onUpdate:modelValue": p[2] || (p[2] = (d) => g.value = d)
|
2030
|
+
}), null, 16, ["type", "disabled", "modelValue"])) : (c(), j(Me, {
|
2031
|
+
key: 1,
|
2032
|
+
"current-value": g.value,
|
2033
|
+
label: h.label,
|
2034
|
+
mode: h.mode,
|
2035
|
+
onClear: m,
|
2036
|
+
fieldRef: n.value,
|
2037
|
+
width: l.width,
|
2038
|
+
disabled: h.disabled,
|
2039
|
+
layout: "inline"
|
2040
|
+
}, {
|
2041
|
+
default: re(() => {
|
2042
|
+
var d, i;
|
2043
|
+
return [
|
2044
|
+
(c(), j(oe((d = e(f)) == null ? void 0 : d.component), Z({
|
2045
|
+
ref_key: "filterRef",
|
2046
|
+
ref: n
|
2047
|
+
}, l, {
|
2048
|
+
modelValue: g.value,
|
2049
|
+
"onUpdate:modelValue": p[3] || (p[3] = (t) => g.value = t),
|
2050
|
+
type: (i = e(f)) == null ? void 0 : i.type,
|
2051
|
+
onChange: p[4] || (p[4] = (t) => k(t.name, t.value)),
|
2052
|
+
onClear: p[5] || (p[5] = (t) => m(t))
|
2053
|
+
}), null, 16, ["modelValue", "type"]))
|
2054
|
+
];
|
2055
|
+
}),
|
2056
|
+
_: 1
|
2057
|
+
}, 8, ["current-value", "label", "mode", "fieldRef", "width", "disabled"]));
|
2058
|
+
};
|
2059
|
+
}
|
2060
|
+
}), El = /* @__PURE__ */ W({
|
2061
|
+
__name: "popover-layout",
|
2062
|
+
props: {
|
2063
|
+
id: {},
|
2064
|
+
name: {},
|
2065
|
+
type: {},
|
2066
|
+
label: {},
|
2067
|
+
width: {},
|
2068
|
+
options: {},
|
2069
|
+
placeHolder: {},
|
2070
|
+
api: {},
|
2071
|
+
data: {},
|
2072
|
+
default: {},
|
2073
|
+
modelValue: {},
|
2074
|
+
disabled: { type: Boolean },
|
2075
|
+
layout: {},
|
2076
|
+
cleanable: { type: Boolean },
|
2077
|
+
limit: {},
|
2078
|
+
multi: { type: Boolean },
|
2079
|
+
dataKey: {},
|
2080
|
+
valueKey: {},
|
2081
|
+
mode: {},
|
2082
|
+
labelKey: {},
|
2083
|
+
sort: {}
|
2084
|
+
},
|
2085
|
+
emits: ["update:modelValue", "change", "clear"],
|
2086
|
+
setup(u, { expose: r, emit: v }) {
|
2087
|
+
const l = u, o = v, n = V(), f = V(Be(l.type, l.layout)), g = E({
|
2088
|
+
get: () => l.modelValue,
|
2089
|
+
set: (h) => o("update:modelValue", h)
|
2090
|
+
});
|
2091
|
+
function m(h) {
|
2092
|
+
o("clear", h);
|
2093
|
+
}
|
2094
|
+
function k(h, p) {
|
2095
|
+
o("change", { name: h, value: p }), l.modelValue !== void 0 && o("update:modelValue", p);
|
2096
|
+
}
|
2097
|
+
return R(
|
2098
|
+
() => l.default,
|
2099
|
+
(h) => {
|
2100
|
+
g.value = h;
|
2101
|
+
}
|
2102
|
+
), R(
|
2103
|
+
() => l.modelValue,
|
2104
|
+
(h) => {
|
2105
|
+
g.value = h;
|
2106
|
+
}
|
2107
|
+
), R(
|
2108
|
+
() => l,
|
2109
|
+
(h) => {
|
2110
|
+
g.value = h;
|
2111
|
+
}
|
2112
|
+
), r({
|
2113
|
+
filterRef: n
|
2114
|
+
}), (h, p) => {
|
2115
|
+
var x, C;
|
2116
|
+
return c(), j(oe((x = f.value) == null ? void 0 : x.component), Z(l, {
|
2117
|
+
type: (C = f.value) == null ? void 0 : C.type,
|
2118
|
+
modelValue: g.value,
|
2119
|
+
"onUpdate:modelValue": p[0] || (p[0] = (d) => g.value = d),
|
2120
|
+
onChange: p[1] || (p[1] = (d) => k(d.name, d.value)),
|
2121
|
+
onClear: p[2] || (p[2] = (d) => m(d)),
|
2122
|
+
ref_key: "filterRef",
|
2123
|
+
ref: n
|
2124
|
+
}), null, 16, ["type", "modelValue"]);
|
2125
|
+
};
|
2126
|
+
}
|
2127
|
+
}), ne = /* @__PURE__ */ W({
|
2128
|
+
__name: "filter-field",
|
2129
|
+
props: {
|
2130
|
+
id: {},
|
2131
|
+
name: {},
|
2132
|
+
type: {},
|
2133
|
+
label: {},
|
2134
|
+
width: {},
|
2135
|
+
options: { default: () => [] },
|
2136
|
+
placeHolder: {},
|
2137
|
+
api: {},
|
2138
|
+
data: {},
|
2139
|
+
default: {},
|
2140
|
+
modelValue: {},
|
2141
|
+
disabled: { type: Boolean, default: !1 },
|
2142
|
+
layout: { default: "inline" },
|
2143
|
+
cleanable: { type: Boolean },
|
2144
|
+
limit: { default: 10 },
|
2145
|
+
multi: { type: Boolean, default: !0 },
|
2146
|
+
dataKey: {},
|
2147
|
+
valueKey: {},
|
2148
|
+
mode: {},
|
2149
|
+
labelKey: {},
|
2150
|
+
sort: { default: "name" }
|
2151
|
+
},
|
2152
|
+
emits: ["update:modelValue", "change", "clear"],
|
2153
|
+
setup(u, { expose: r, emit: v }) {
|
2154
|
+
const l = u, o = v, n = V(), f = E({
|
2155
|
+
get: () => l.modelValue,
|
2156
|
+
set: (h) => o("update:modelValue", h)
|
2157
|
+
});
|
2158
|
+
function g(h) {
|
2159
|
+
o("clear", h);
|
2160
|
+
}
|
2161
|
+
function m(h, p) {
|
2162
|
+
o("change", { name: h, value: p }), l.modelValue !== void 0 && o("update:modelValue", p);
|
2163
|
+
}
|
2164
|
+
R(
|
2165
|
+
() => l.default,
|
2166
|
+
(h) => {
|
2167
|
+
f.value = h;
|
2168
|
+
}
|
2169
|
+
), R(
|
2170
|
+
() => l.modelValue,
|
2171
|
+
(h) => {
|
2172
|
+
f.value = h;
|
2173
|
+
}
|
2174
|
+
), r({
|
2175
|
+
filterRef: n
|
2176
|
+
});
|
2177
|
+
function k() {
|
2178
|
+
switch (l.layout) {
|
2179
|
+
case "inline":
|
2180
|
+
return je;
|
2181
|
+
case "vertical":
|
2182
|
+
return Hl;
|
2183
|
+
case "popover":
|
2184
|
+
return El;
|
2185
|
+
default:
|
2186
|
+
return je;
|
2187
|
+
}
|
2188
|
+
}
|
2189
|
+
return (h, p) => (c(), j(oe(k()), Z(l, {
|
2190
|
+
onChange: p[0] || (p[0] = (x) => m(x.name, x.value)),
|
2191
|
+
onClear: p[1] || (p[1] = (x) => g(x)),
|
2192
|
+
modelValue: f.value,
|
2193
|
+
"onUpdate:modelValue": p[2] || (p[2] = (x) => f.value = x)
|
2194
|
+
}), null, 16, ["modelValue"]));
|
2195
|
+
}
|
2196
|
+
});
|
2197
|
+
function Ae(u, r) {
|
2198
|
+
const {
|
2199
|
+
slots: v
|
2200
|
+
} = u, l = V(u.value ?? {}), o = E(() => {
|
2201
|
+
var b;
|
2202
|
+
return (fe((b = v == null ? void 0 : v.default) == null ? void 0 : b.call(v)) ?? []).flatMap((s) => Array.isArray(s.children) ? s.children : [s]);
|
2203
|
+
});
|
2204
|
+
function n(b) {
|
2205
|
+
delete l.value[b], r("clear", {
|
2206
|
+
data: fe(l.value),
|
2207
|
+
name: b
|
2208
|
+
});
|
2209
|
+
}
|
2210
|
+
function f(b, s) {
|
2211
|
+
s === void 0 ? n(b) : l.value = {
|
2212
|
+
...l.value,
|
2213
|
+
[b]: s
|
2214
|
+
}, r("change", {
|
2215
|
+
data: fe(l.value),
|
2216
|
+
name: b,
|
2217
|
+
value: s
|
2218
|
+
});
|
2219
|
+
}
|
2220
|
+
const g = E(() => o.value.map((b) => {
|
2221
|
+
var _;
|
2222
|
+
const s = (_ = b.props) == null ? void 0 : _.name;
|
2223
|
+
return Ye(b, {
|
2224
|
+
...b.props,
|
2225
|
+
layout: u.view,
|
2226
|
+
showClean: !0,
|
2227
|
+
modelValue: l[s],
|
2228
|
+
"onUpdate:modelValue": (M) => {
|
2229
|
+
f(s, M);
|
2230
|
+
},
|
2231
|
+
onClear: () => n(s)
|
2232
|
+
});
|
2233
|
+
})), m = E(
|
2234
|
+
() => new Map(
|
2235
|
+
g.value.map((b) => {
|
2236
|
+
var _;
|
2237
|
+
const s = (_ = b.props) == null ? void 0 : _.name;
|
2238
|
+
return s ? [s, b] : null;
|
2239
|
+
}).filter((b) => b !== null)
|
2240
|
+
)
|
2241
|
+
);
|
2242
|
+
function k(b = !1) {
|
2243
|
+
l.value = {}, b || r("clearAll", {
|
2244
|
+
data: fe(l.value),
|
2245
|
+
name: "ALL"
|
2246
|
+
});
|
2247
|
+
}
|
2248
|
+
const h = V(""), p = E(() => {
|
2249
|
+
var b;
|
2250
|
+
return (b = u.schema) != null && b.value ? Object.entries(l.value).filter(([s, _]) => u.schema && !(s in u.schema.value) ? !1 : Array.isArray(_) ? _.some((M) => M !== "" && M !== void 0) : _ !== "" && _ !== void 0).length : 0;
|
2251
|
+
}), x = V();
|
2252
|
+
R(h, async () => {
|
2253
|
+
var b, s;
|
2254
|
+
await ke(), (s = (b = x == null ? void 0 : x.value) == null ? void 0 : b.filterRef) != null && s.inputTextRef && x.value.filterRef.inputTextRef.focus();
|
2255
|
+
});
|
2256
|
+
const C = E(() => {
|
2257
|
+
var b, s;
|
2258
|
+
return (b = u.schema) != null && b.value ? Object.fromEntries(Object.entries((s = u.schema) == null ? void 0 : s.value).slice(0, u.limit)) : {};
|
2259
|
+
}), d = E(() => {
|
2260
|
+
var b, s, _;
|
2261
|
+
return (b = u.schema) != null && b.value ? u.view !== "inline" ? (s = u.schema) == null ? void 0 : s.value : Object.fromEntries(Object.entries((_ = u.schema) == null ? void 0 : _.value).slice(u.limit)) : {};
|
2262
|
+
}), i = E(() => {
|
2263
|
+
var s;
|
2264
|
+
if (g.value.length === 0) return [];
|
2265
|
+
let b = 0;
|
2266
|
+
if ((s = u.schema) != null && s.value) {
|
2267
|
+
const _ = Object.entries(u.schema.value).length;
|
2268
|
+
_ < u.limit ? b = u.limit - _ : b = 0;
|
2269
|
+
}
|
2270
|
+
return g.value.slice(0, b);
|
2271
|
+
}), t = E(() => g.value.length === 0 ? [] : u.view !== "inline" ? g.value : g.value.slice(i.value.length));
|
2272
|
+
function y() {
|
2273
|
+
if (d.value) {
|
2274
|
+
const [b] = Object.keys(d.value);
|
2275
|
+
h.value = b;
|
2276
|
+
} else t.value.length > 0 ? h.value = t.value[0].props.name : h.value = "";
|
2277
|
+
}
|
2278
|
+
return {
|
2279
|
+
activeFilter: l,
|
2280
|
+
activeFilterCount: p,
|
2281
|
+
onFilterChange: f,
|
2282
|
+
clearFilter: n,
|
2283
|
+
clearAllFilters: k,
|
2284
|
+
limitedSchema: C,
|
2285
|
+
popoverSchema: d,
|
2286
|
+
filtersSlot: g,
|
2287
|
+
limitedFiltersSlot: i,
|
2288
|
+
popoverFiltersSlot: t,
|
2289
|
+
vnodeMap: m,
|
2290
|
+
onPopoverOpen: y,
|
2291
|
+
selectedFilter: h,
|
2292
|
+
filterRef: x
|
2293
|
+
};
|
2294
|
+
}
|
2295
|
+
const Wl = /* @__PURE__ */ W({
|
2296
|
+
__name: "popover",
|
2297
|
+
emits: ["open", "close"],
|
2298
|
+
setup(u, { emit: r }) {
|
2299
|
+
const v = V(!1), l = V(null), o = V(null), n = V(null), f = V({ top: "0px", left: "0px", position: "absolute" });
|
2300
|
+
function g() {
|
2301
|
+
v.value = !v.value;
|
2302
|
+
}
|
2303
|
+
function m() {
|
2304
|
+
const x = n.value, C = l.value;
|
2305
|
+
if (!x || !C) return;
|
2306
|
+
const d = x.getBoundingClientRect(), i = C.offsetWidth, t = window.innerWidth - d.left;
|
2307
|
+
let y = d.left + window.scrollX;
|
2308
|
+
i > t && (y = window.innerWidth - i - 8, y < 8 && (y = 8)), f.value = {
|
2309
|
+
position: "absolute",
|
2310
|
+
top: `${d.bottom + window.scrollY + 8}px`,
|
2311
|
+
left: `${y}px`
|
2312
|
+
};
|
2313
|
+
}
|
2314
|
+
function k(x) {
|
2315
|
+
var d, i;
|
2316
|
+
const C = x.target;
|
2317
|
+
!((d = n.value) != null && d.contains(x.target)) && !((i = l.value) != null && i.contains(x.target)) && !C.closest("[data-inside-popover]") && (v.value = !1);
|
2318
|
+
}
|
2319
|
+
const h = V(!1);
|
2320
|
+
ue(() => {
|
2321
|
+
h.value = !0;
|
2322
|
+
}), ue(() => {
|
2323
|
+
var x, C;
|
2324
|
+
n.value = ((x = o.value) == null ? void 0 : x.querySelector("[data-popover-trigger]")) || null, (C = n.value) == null || C.addEventListener("click", g), document.addEventListener("click", k), window.addEventListener("resize", m), window.addEventListener("scroll", m, !0);
|
2325
|
+
}), he(() => {
|
2326
|
+
var x;
|
2327
|
+
(x = n.value) == null || x.removeEventListener("click", g), document.removeEventListener("click", k), window.removeEventListener("resize", m), window.removeEventListener("scroll", m, !0);
|
2328
|
+
});
|
2329
|
+
const p = r;
|
2330
|
+
return R(v, async (x) => {
|
2331
|
+
x ? (p("open"), await ke(), m()) : p("close");
|
2332
|
+
}), (x, C) => (c(), w("div", {
|
2333
|
+
ref_key: "wrapperRef",
|
2334
|
+
ref: o
|
2335
|
+
}, [
|
2336
|
+
ee(x.$slots, "trigger"),
|
2337
|
+
h.value ? (c(), j(Fe, {
|
2338
|
+
key: 0,
|
2339
|
+
to: "body"
|
2340
|
+
}, [
|
2341
|
+
H(a("div", {
|
2342
|
+
ref_key: "popoverRef",
|
2343
|
+
ref: l,
|
2344
|
+
class: "absolute z-[50] w-[600px] rounded-md border bg-white shadow-md",
|
2345
|
+
style: _e(f.value)
|
2346
|
+
}, [
|
2347
|
+
ee(x.$slots, "default")
|
2348
|
+
], 4), [
|
2349
|
+
[X, v.value]
|
2350
|
+
])
|
2351
|
+
])) : S("", !0)
|
2352
|
+
], 512));
|
2353
|
+
}
|
2354
|
+
}), Yl = {}, ql = {
|
2355
|
+
xmlns: "http://www.w3.org/2000/svg",
|
2356
|
+
width: "24",
|
2357
|
+
height: "24",
|
2358
|
+
viewBox: "0 0 24 24",
|
2359
|
+
fill: "none",
|
2360
|
+
stroke: "currentColor",
|
2361
|
+
"stroke-width": "2",
|
2362
|
+
"stroke-linecap": "round",
|
2363
|
+
"stroke-linejoin": "round",
|
2364
|
+
class: "lucide lucide-filter h-4 w-4"
|
2365
|
+
};
|
2366
|
+
function Nl(u, r) {
|
2367
|
+
return c(), w("svg", ql, r[0] || (r[0] = [
|
2368
|
+
a("polygon", { points: "22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3" }, null, -1)
|
2369
|
+
]));
|
2370
|
+
}
|
2371
|
+
const Gl = /* @__PURE__ */ le(Yl, [["render", Nl]]), Ql = {
|
2372
|
+
key: 0,
|
2373
|
+
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"
|
2374
|
+
}, Zl = { class: "flex" }, Jl = { class: "w-64 border-r border-gray-200" }, Xl = { class: "p-2" }, ea = ["onClick"], ta = { class: "flex items-center gap-2" }, la = { class: "text-sm font-medium" }, aa = {
|
2375
|
+
key: 0,
|
2376
|
+
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"
|
2377
|
+
}, oa = ["onClick"], ra = { class: "flex items-center gap-2" }, na = { class: "text-sm font-medium" }, ia = {
|
2378
|
+
key: 0,
|
2379
|
+
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"
|
2380
|
+
}, sa = {
|
2381
|
+
key: 0,
|
2382
|
+
class: "p-2 border-t"
|
2383
|
+
}, ua = { class: "flex-1 min-h-[300px] overflow-y-auto" }, da = {
|
2384
|
+
key: 0,
|
2385
|
+
class: "flex items-center justify-center h-full text-gray-500"
|
2386
|
+
}, We = /* @__PURE__ */ W({
|
2387
|
+
__name: "popover-filter-layout",
|
2388
|
+
props: {
|
2389
|
+
schema: {},
|
2390
|
+
view: {},
|
2391
|
+
value: {},
|
2392
|
+
history: { type: Boolean },
|
2393
|
+
mode: {},
|
2394
|
+
limit: { default: 3 }
|
2395
|
+
},
|
2396
|
+
emits: ["change", "clear", "clearAll"],
|
2397
|
+
setup(u, { expose: r, emit: v }) {
|
2398
|
+
const l = u, o = He(l.mode), n = we(), f = v, g = V({}), {
|
2399
|
+
activeFilter: m,
|
2400
|
+
activeFilterCount: k,
|
2401
|
+
onFilterChange: h,
|
2402
|
+
clearFilter: p,
|
2403
|
+
clearAllFilters: x,
|
2404
|
+
popoverSchema: C,
|
2405
|
+
popoverFiltersSlot: d,
|
2406
|
+
onPopoverOpen: i,
|
2407
|
+
selectedFilter: t,
|
2408
|
+
filterRef: y
|
2409
|
+
} = Ae({
|
2410
|
+
...l,
|
2411
|
+
schema: g,
|
2412
|
+
slots: n
|
2413
|
+
}, f);
|
2414
|
+
return R(
|
2415
|
+
() => l.schema,
|
2416
|
+
(b) => {
|
2417
|
+
g.value = b;
|
2418
|
+
},
|
2419
|
+
{ deep: !0, immediate: !0 }
|
2420
|
+
), r({
|
2421
|
+
clearFilter: p,
|
2422
|
+
clearAllFilters: x
|
2423
|
+
}), (b, s) => (c(), j(Wl, {
|
2424
|
+
onOpen: e(i),
|
2425
|
+
onClose: s[5] || (s[5] = (_) => t.value = "")
|
2426
|
+
}, {
|
2427
|
+
trigger: re(() => [
|
2428
|
+
a("button", {
|
2429
|
+
"data-popover-trigger": "",
|
2430
|
+
"aria-haspopup": "dialog",
|
2431
|
+
"aria-expanded": "false",
|
2432
|
+
class: z(
|
2433
|
+
e(o) + (e(k) > 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")
|
2434
|
+
),
|
2435
|
+
type: "button"
|
2436
|
+
}, [
|
2437
|
+
P(Gl),
|
2438
|
+
s[6] || (s[6] = Y(" Фільтр ", -1)),
|
2439
|
+
e(k) > 0 ? (c(), w("div", Ql, K(e(k)), 1)) : S("", !0)
|
2440
|
+
], 2)
|
2441
|
+
]),
|
2442
|
+
default: re(() => [
|
2443
|
+
a("div", Zl, [
|
2444
|
+
a("div", Jl, [
|
2445
|
+
s[7] || (s[7] = a("div", { class: "p-4 border-b" }, [
|
2446
|
+
a("p", { class: "text-sm text-gray-600" }, "Select a field to start creating a filter.")
|
2447
|
+
], -1)),
|
2448
|
+
a("div", Xl, [
|
2449
|
+
b.schema ? (c(!0), w(F, { key: 0 }, q(Object.entries(e(C)), ([_, M]) => {
|
2450
|
+
var A;
|
2451
|
+
return c(), w("button", {
|
2452
|
+
key: _,
|
2453
|
+
onClick: () => {
|
2454
|
+
t.value = _;
|
2455
|
+
},
|
2456
|
+
class: z([
|
2457
|
+
"w-full flex items-center justify-between px-3 py-2 text-left hover:bg-gray-50 transition-colors",
|
2458
|
+
e(t) === _ ? "bg-blue-50 text-blue-700 border-l-2 border-blue-500" : ""
|
2459
|
+
])
|
2460
|
+
}, [
|
2461
|
+
a("div", ta, [
|
2462
|
+
a("span", la, K(M.label), 1)
|
2463
|
+
]),
|
2464
|
+
(Array.isArray(e(m)[_]) ? ((A = e(m)[_]) == null ? void 0 : A.length) > 0 : e(m)[_] || e(m)[_] === null) ? (c(), w("div", aa)) : S("", !0)
|
2465
|
+
], 10, ea);
|
2466
|
+
}), 128)) : S("", !0),
|
2467
|
+
(c(!0), w(F, null, q(e(d), (_, M) => {
|
2468
|
+
var A;
|
2469
|
+
return c(), w("button", {
|
2470
|
+
key: "slot-" + M,
|
2471
|
+
onClick: (U) => t.value = _.props.name,
|
2472
|
+
class: z([
|
2473
|
+
"w-full flex items-center justify-between px-3 py-2 text-left hover:bg-gray-50 transition-colors",
|
2474
|
+
e(t) === _.props.name ? "bg-blue-50 text-blue-700 border-l-2 border-blue-500" : ""
|
2475
|
+
])
|
2476
|
+
}, [
|
2477
|
+
a("div", ra, [
|
2478
|
+
a("span", na, K(_.props.label), 1)
|
2479
|
+
]),
|
2480
|
+
((A = e(m)[_.props.name]) == null ? void 0 : A.length) > 0 ? (c(), w("div", ia)) : S("", !0)
|
2481
|
+
], 10, oa);
|
2482
|
+
}), 128))
|
2483
|
+
]),
|
2484
|
+
e(k) > 0 ? (c(), w("div", sa, [
|
2485
|
+
a("button", {
|
2486
|
+
class: "w-full px-3 py-2 text-left text-sm text-gray-600 hover:bg-gray-50 transition-colors",
|
2487
|
+
onClick: s[0] || (s[0] = (_) => e(x)()),
|
2488
|
+
"data-inside-popover": ""
|
2489
|
+
}, " Очистити всі ")
|
2490
|
+
])) : S("", !0)
|
2491
|
+
]),
|
2492
|
+
a("div", ua, [
|
2493
|
+
e(t) === "" ? (c(), w("div", da, s[8] || (s[8] = [
|
2494
|
+
a("p", { class: "text-sm" }, "Select a field to start creating a filter.", -1)
|
2495
|
+
]))) : S("", !0),
|
2496
|
+
e(t) ? (c(), w(F, { key: 1 }, [
|
2497
|
+
e(C) ? (c(!0), w(F, { key: 0 }, q(Object.entries(e(C)), ([_, M]) => (c(), w(F, null, [
|
2498
|
+
e(t) === _ ? (c(), j(ne, Z({
|
2499
|
+
name: _,
|
2500
|
+
key: _,
|
2501
|
+
layout: "popover",
|
2502
|
+
ref_for: !0,
|
2503
|
+
ref_key: "filterRef",
|
2504
|
+
ref: y
|
2505
|
+
}, { ref_for: !0 }, M, {
|
2506
|
+
onChange: s[1] || (s[1] = (A) => e(h)(A.name, A.value)),
|
2507
|
+
onClear: s[2] || (s[2] = (A) => {
|
2508
|
+
e(p)(A), e(h)(A, void 0);
|
2509
|
+
}),
|
2510
|
+
modelValue: e(m)[_],
|
2511
|
+
"onUpdate:modelValue": (A) => e(m)[_] = A,
|
2512
|
+
cleanable: !0
|
2513
|
+
}), null, 16, ["name", "modelValue", "onUpdate:modelValue"])) : S("", !0)
|
2514
|
+
], 64))), 256)) : S("", !0),
|
2515
|
+
(c(!0), w(F, null, q(e(d), (_, M) => (c(), w(F, {
|
2516
|
+
key: "slot-" + M
|
2517
|
+
}, [
|
2518
|
+
e(t) === _.props.name ? (c(), j(ne, Z({
|
2519
|
+
key: 0,
|
2520
|
+
layout: "popover"
|
2521
|
+
}, { ref_for: !0 }, _.props, {
|
2522
|
+
ref_for: !0,
|
2523
|
+
ref_key: "filterRef",
|
2524
|
+
ref: y,
|
2525
|
+
onChange: s[3] || (s[3] = (A) => e(h)(A.name, A.value)),
|
2526
|
+
onClear: s[4] || (s[4] = (A) => {
|
2527
|
+
e(p)(A), e(h)(A, void 0);
|
2528
|
+
}),
|
2529
|
+
modelValue: e(m)[_.props.name],
|
2530
|
+
"onUpdate:modelValue": (A) => e(m)[_.props.name] = A,
|
2531
|
+
cleanable: !0
|
2532
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue"])) : S("", !0)
|
2533
|
+
], 64))), 128))
|
2534
|
+
], 64)) : S("", !0)
|
2535
|
+
])
|
2536
|
+
])
|
2537
|
+
]),
|
2538
|
+
_: 1
|
2539
|
+
}, 8, ["onOpen"]));
|
2540
|
+
}
|
2541
|
+
}), ca = { class: "flex gap-1 items-center flex-wrap" }, ze = /* @__PURE__ */ W({
|
2542
|
+
__name: "inline-filter-layout",
|
2543
|
+
props: {
|
2544
|
+
schema: {},
|
2545
|
+
view: {},
|
2546
|
+
value: {},
|
2547
|
+
history: { type: Boolean },
|
2548
|
+
mode: {},
|
2549
|
+
limit: { default: 3 }
|
2550
|
+
},
|
2551
|
+
emits: ["change", "clear", "clearAll"],
|
2552
|
+
setup(u, { expose: r, emit: v }) {
|
2553
|
+
const l = u, o = v, n = we(), f = V({}), {
|
2554
|
+
activeFilter: g,
|
2555
|
+
activeFilterCount: m,
|
2556
|
+
onFilterChange: k,
|
2557
|
+
clearFilter: h,
|
2558
|
+
clearAllFilters: p,
|
2559
|
+
limitedSchema: x,
|
2560
|
+
popoverSchema: C,
|
2561
|
+
filtersSlot: d,
|
2562
|
+
limitedFiltersSlot: i,
|
2563
|
+
popoverFiltersSlot: t
|
2564
|
+
} = Ae(
|
2565
|
+
{
|
2566
|
+
...l,
|
2567
|
+
schema: f,
|
2568
|
+
slots: n
|
2569
|
+
},
|
2570
|
+
o
|
2571
|
+
), y = V();
|
2572
|
+
function b() {
|
2573
|
+
y.value && y.value.clearAllFilters(!0), p();
|
2574
|
+
}
|
2575
|
+
return R(
|
2576
|
+
() => l.schema,
|
2577
|
+
(s) => {
|
2578
|
+
f.value = s;
|
2579
|
+
},
|
2580
|
+
{ deep: !0, immediate: !0 }
|
2581
|
+
), r({
|
2582
|
+
clearFilter: h,
|
2583
|
+
clearAllFilters: p
|
2584
|
+
}), (s, _) => (c(), w("div", ca, [
|
2585
|
+
s.schema ? (c(!0), w(F, { key: 0 }, q(Object.entries(e(x)), ([M, A]) => (c(), j(ne, Z({
|
2586
|
+
key: M,
|
2587
|
+
name: M,
|
2588
|
+
mode: s.mode
|
2589
|
+
}, { ref_for: !0 }, A, {
|
2590
|
+
onChange: _[0] || (_[0] = (U) => e(k)(U.name, U.value)),
|
2591
|
+
onClear: e(h),
|
2592
|
+
layout: "inline",
|
2593
|
+
cleanable: !0,
|
2594
|
+
modelValue: e(g)[M],
|
2595
|
+
"onUpdate:modelValue": (U) => e(g)[M] = U
|
2596
|
+
}), null, 16, ["name", "mode", "onClear", "modelValue", "onUpdate:modelValue"]))), 128)) : S("", !0),
|
2597
|
+
(c(!0), w(F, null, q(e(i), (M, A) => (c(), j(ne, Z({
|
2598
|
+
key: "slot-" + A,
|
2599
|
+
layout: "inline"
|
2600
|
+
}, { ref_for: !0 }, M.props, {
|
2601
|
+
onChange: _[1] || (_[1] = (U) => e(k)(U.name, U.value)),
|
2602
|
+
onClear: _[2] || (_[2] = (U) => {
|
2603
|
+
e(h)(U), e(k)(U, void 0);
|
2604
|
+
}),
|
2605
|
+
cleanable: !0,
|
2606
|
+
modelValue: e(g)[M.props.name],
|
2607
|
+
"onUpdate:modelValue": (U) => e(g)[M.props.name] = U
|
2608
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue"]))), 128)),
|
2609
|
+
Object.entries(e(C)).length > 0 || e(t).length > 0 ? (c(), j(We, Z({ key: 1 }, l, {
|
2610
|
+
schema: e(C),
|
2611
|
+
limit: 0,
|
2612
|
+
onChange: _[3] || (_[3] = (M) => e(k)(M.name, M.value)),
|
2613
|
+
onClearAll: _[4] || (_[4] = (M) => e(p)()),
|
2614
|
+
onClear: _[5] || (_[5] = (M) => e(h)(M.name)),
|
2615
|
+
mode: s.mode,
|
2616
|
+
ref_key: "popoverRef",
|
2617
|
+
ref: y,
|
2618
|
+
cleanable: !0
|
2619
|
+
}), {
|
2620
|
+
default: re(() => [
|
2621
|
+
(c(!0), w(F, null, q(e(d), (M, A) => (c(), j(oe(M), Z({
|
2622
|
+
key: "slot-" + A,
|
2623
|
+
layout: "popover"
|
2624
|
+
}, { ref_for: !0 }, M.props, { cleanable: !0 }), null, 16))), 128))
|
2625
|
+
]),
|
2626
|
+
_: 1
|
2627
|
+
}, 16, ["schema", "mode"])) : S("", !0),
|
2628
|
+
e(m) > 0 ? (c(), w("button", {
|
2629
|
+
key: 2,
|
2630
|
+
onClick: b,
|
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
|
+
}, " Очистити ")) : S("", !0)
|
2633
|
+
]));
|
2634
|
+
}
|
2635
|
+
}), pa = {
|
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
|
+
}, fa = { class: "flex items-center vst-filters vsTailwind flex-col w-full" }, va = /* @__PURE__ */ W({
|
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(u, { expose: r, emit: v }) {
|
2650
|
+
const l = u, o = v, n = we(), {
|
2651
|
+
activeFilter: f,
|
2652
|
+
activeFilterCount: g,
|
2653
|
+
onFilterChange: m,
|
2654
|
+
clearFilter: k,
|
2655
|
+
clearAllFilters: h,
|
2656
|
+
filtersSlot: p
|
2657
|
+
} = Ae({
|
2658
|
+
...l,
|
2659
|
+
slots: n
|
2660
|
+
}, o);
|
2661
|
+
return r({
|
2662
|
+
clearFilter: k,
|
2663
|
+
clearAllFilters: h
|
2664
|
+
}), (x, C) => x.view === "vertical" ? (c(), w("div", pa, [
|
2665
|
+
a("div", fa, [
|
2666
|
+
e(g) > 0 ? (c(), w("button", {
|
2667
|
+
key: 0,
|
2668
|
+
onClick: C[0] || (C[0] = (d) => e(h)()),
|
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
|
+
}, " Очистити ")) : S("", !0),
|
2675
|
+
x.schema ? (c(!0), w(F, { key: 1 }, q(Object.entries(x.schema), ([d, i]) => (c(), j(ne, Z({
|
2676
|
+
name: d,
|
2677
|
+
layout: "vertical"
|
2678
|
+
}, { ref_for: !0 }, i, {
|
2679
|
+
onChange: C[1] || (C[1] = (t) => e(m)(t.name, t.value)),
|
2680
|
+
onClear: C[2] || (C[2] = (t) => {
|
2681
|
+
e(k)(t), e(m)(t, void 0);
|
2682
|
+
}),
|
2683
|
+
modelValue: e(f)[d],
|
2684
|
+
"onUpdate:modelValue": (t) => e(f)[d] = t,
|
2685
|
+
showClean: !0
|
2686
|
+
}), null, 16, ["name", "modelValue", "onUpdate:modelValue"]))), 256)) : S("", !0),
|
2687
|
+
(c(!0), w(F, null, q(e(p), (d, i) => (c(), j(ne, Z({
|
2688
|
+
key: "slot-" + i,
|
2689
|
+
layout: "vertical"
|
2690
|
+
}, { ref_for: !0 }, d.props, {
|
2691
|
+
onChange: C[3] || (C[3] = (t) => e(m)(t.name, t.value)),
|
2692
|
+
onClear: C[4] || (C[4] = (t) => {
|
2693
|
+
e(k)(t), e(m)(t, void 0);
|
2694
|
+
}),
|
2695
|
+
modelValue: e(f)[d.props.name],
|
2696
|
+
"onUpdate:modelValue": (t) => e(f)[d.props.name] = t,
|
2697
|
+
showClean: !0
|
2698
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue"]))), 128))
|
2699
|
+
])
|
2700
|
+
])) : S("", !0);
|
2701
|
+
}
|
2702
|
+
}), xe = /* @__PURE__ */ W({
|
2703
|
+
__name: "filter",
|
2704
|
+
props: {
|
2705
|
+
schema: {},
|
2706
|
+
view: { default: "inline" },
|
2707
|
+
value: {},
|
2708
|
+
history: { type: Boolean },
|
2709
|
+
mode: {},
|
2710
|
+
limit: { default: 3 }
|
2711
|
+
},
|
2712
|
+
emits: ["change", "clear", "clearAll"],
|
2713
|
+
setup(u, { expose: r, emit: v }) {
|
2714
|
+
const l = u, o = V(l.value ?? {}), n = v, f = V();
|
2715
|
+
function g(i) {
|
2716
|
+
if (Array.isArray(i))
|
2717
|
+
return i.map((t) => g(t));
|
2718
|
+
if (i !== null && typeof i == "object") {
|
2719
|
+
const t = fe(i), y = {};
|
2720
|
+
for (const b in t)
|
2721
|
+
y[b] = g(t[b]);
|
2722
|
+
return y;
|
2723
|
+
}
|
2724
|
+
return i;
|
2725
|
+
}
|
2726
|
+
function m(i, t) {
|
2727
|
+
t !== void 0 ? o.value = {
|
2728
|
+
...o.value,
|
2729
|
+
[i]: t
|
2730
|
+
} : delete o.value[i], n("change", {
|
2731
|
+
data: g(o.value),
|
2732
|
+
name: i,
|
2733
|
+
value: g(t)
|
2734
|
+
});
|
2735
|
+
}
|
2736
|
+
function k(i) {
|
2737
|
+
delete o.value[i], n("clear", {
|
2738
|
+
data: g(o.value),
|
2739
|
+
name: i
|
2740
|
+
}), n("change", {
|
2741
|
+
data: g(o.value),
|
2742
|
+
name: i,
|
2743
|
+
value: null
|
2744
|
+
});
|
2745
|
+
}
|
2746
|
+
function h() {
|
2747
|
+
o.value = {}, n("clear", {
|
2748
|
+
data: g(o.value),
|
2749
|
+
name: "ALL"
|
2750
|
+
}), n("change", {
|
2751
|
+
data: g(o.value),
|
2752
|
+
name: "ALL",
|
2753
|
+
value: null
|
2754
|
+
});
|
2755
|
+
}
|
2756
|
+
const p = V({});
|
2757
|
+
function x() {
|
2758
|
+
switch (l.view) {
|
2759
|
+
case "inline":
|
2760
|
+
return ze;
|
2761
|
+
case "vertical":
|
2762
|
+
return va;
|
2763
|
+
case "popover":
|
2764
|
+
return We;
|
2765
|
+
default:
|
2766
|
+
return ze;
|
2767
|
+
}
|
2768
|
+
}
|
2769
|
+
R(
|
2770
|
+
() => l.schema,
|
2771
|
+
(i) => {
|
2772
|
+
if (!i) {
|
2773
|
+
p.value = {};
|
2774
|
+
return;
|
2775
|
+
}
|
2776
|
+
if (Array.isArray(i) && !i.length) {
|
2777
|
+
p.value = {};
|
2778
|
+
return;
|
2779
|
+
}
|
2780
|
+
Array.isArray(i) ? p.value = i.filter((t) => t.type).reduce((t, y) => (Object.assign(y, { name: y.id || y.name, type: y.type.toLowerCase() }), t[y.name] = y, y.data && !y.api && !y.options && Object.assign(y, { api: `/api/suggest/${y.data}` }), t), {}) : (Object.entries(i).forEach(([t, y]) => {
|
2781
|
+
Object.assign(y, { name: t || y.name || y.id, type: y.type.toLowerCase() });
|
2782
|
+
}), p.value = { ...i });
|
2783
|
+
},
|
2784
|
+
{ immediate: !0, deep: !0 }
|
2785
|
+
);
|
2786
|
+
function C(i) {
|
2787
|
+
f.value.clearFilter(i), k(i);
|
2788
|
+
}
|
2789
|
+
function d() {
|
2790
|
+
f.value.clearAllFilters(), h();
|
2791
|
+
}
|
2792
|
+
return r({
|
2793
|
+
clearAllFilters: d,
|
2794
|
+
clearFilter: C
|
2795
|
+
}), (i, t) => (c(), j(oe(x()), Z(l, {
|
2796
|
+
schema: p.value,
|
2797
|
+
onChange: t[0] || (t[0] = (y) => m(y.name, y.value)),
|
2798
|
+
onClear: t[1] || (t[1] = (y) => k(y.name)),
|
2799
|
+
onClearAll: h,
|
2800
|
+
ref_key: "filterRef",
|
2801
|
+
ref: f
|
2802
|
+
}), {
|
2803
|
+
default: re(() => [
|
2804
|
+
ee(i.$slots, "default")
|
2805
|
+
]),
|
2806
|
+
_: 3
|
2807
|
+
}, 16, ["schema"]));
|
2808
|
+
}
|
2809
|
+
});
|
2810
|
+
xe.install = function(u) {
|
2811
|
+
u.component("Filter", xe), u.component("FilterField", ne);
|
2812
|
+
};
|
2813
|
+
function ma(u) {
|
2814
|
+
const { page: r, id: v, filter: l } = u, o = new URL(window.location.href), n = new URLSearchParams(window.location.search);
|
2815
|
+
r ? n.set("page", r.toString()) : n.delete("page"), v ? n.set("id", v.toString()) : n.delete("id"), l ? n.set("filter", l) : n.delete("filter"), o.search = decodeURI(n.toString()), window.history.pushState({}, "", o);
|
2816
|
+
}
|
2817
|
+
const ga = { class: "flex items-center justify-between w-full gap-x-1" }, ha = { class: "flex items-center" }, ba = ["disabled"], ya = { class: "flex items-center gap-x-1" }, xa = ["onClick"], wa = ["disabled"], ka = { class: "flex justify-center items-center gap-x-5 ml-3" }, _a = { class: "relative" }, Ca = {
|
2818
|
+
class: "hs-dropdown-menu z-50 bg-white shadow-md rounded-lg p-1 space-y-0.5 dark:bg-neutral-800 dark:border dark:border-neutral-700 right-0 dark:divide-neutral-700 absolute bottom-[100%]",
|
2819
|
+
role: "menu",
|
2820
|
+
"aria-orientation": "vertical",
|
2821
|
+
"aria-labelledby": "dropdown-button"
|
2822
|
+
}, Va = ["onClick"], Sa = {
|
2823
|
+
key: 0,
|
2824
|
+
xmlns: "http://www.w3.org/2000/svg",
|
2825
|
+
viewBox: "0 0 24 24",
|
2826
|
+
fill: "none",
|
2827
|
+
stroke: "currentColor",
|
2828
|
+
"stroke-width": "4",
|
2829
|
+
"stroke-linecap": "round",
|
2830
|
+
"stroke-linejoin": "round",
|
2831
|
+
class: "icon icon-tabler icons-tabler-outline icon-tabler-check text-blue-600",
|
2832
|
+
width: "14",
|
2833
|
+
height: "14"
|
2834
|
+
}, Ma = /* @__PURE__ */ W({
|
2835
|
+
__name: "pagination",
|
2836
|
+
props: {
|
2837
|
+
total: {},
|
2838
|
+
currentPage: {},
|
2839
|
+
pageSize: {}
|
2840
|
+
},
|
2841
|
+
emits: ["update:currentPage", "update:pageSize", "pageChange", "pageSizeChange"],
|
2842
|
+
setup(u, { emit: r }) {
|
2843
|
+
const v = u, l = r, o = V(v.currentPage), n = V(v.pageSize), f = V(!1);
|
2844
|
+
R(() => v.pageSize, (C) => {
|
2845
|
+
n.value = C;
|
2846
|
+
});
|
2847
|
+
const g = E(() => Math.ceil(v.total / v.pageSize)), m = E(() => {
|
2848
|
+
const d = Math.floor(3.5);
|
2849
|
+
let i = o.value - d, t = o.value + d;
|
2850
|
+
i < 1 && (t += 1 - i, i = 1), t > g.value && (i -= t - g.value, t = g.value), i = Math.max(1, i);
|
2851
|
+
const y = [];
|
2852
|
+
for (let b = i; b <= t; b += 1)
|
2853
|
+
y.push(b);
|
2854
|
+
return y;
|
2855
|
+
}), k = () => {
|
2856
|
+
o.value > 1 && (o.value -= 1, l("update:currentPage", o.value));
|
2857
|
+
}, h = () => {
|
2858
|
+
o.value < g.value && (o.value += 1, l("update:currentPage", o.value));
|
2859
|
+
}, p = (C) => {
|
2860
|
+
o.value = C, l("update:currentPage", C), l("pageChange", C);
|
2861
|
+
}, x = (C = n.value) => {
|
2862
|
+
n.value = C, f.value = !1, l("update:pageSize", n.value), l("update:currentPage", 1), l("pageSizeChange", n.value);
|
2863
|
+
};
|
2864
|
+
return (C, d) => (c(), w("nav", ga, [
|
2865
|
+
a("div", ha, [
|
2866
|
+
a("button", {
|
2867
|
+
type: "button",
|
2868
|
+
"aria-label": "Previous",
|
2869
|
+
onClick: k,
|
2870
|
+
disabled: o.value === 1,
|
2871
|
+
class: "border-white last:rounded-e-lg text-base h-[38px] min-w-[38px] py-2 px-2.5 inline-flex justify-center items-center gap-x-2 border text-sm rounded-lg bg-white text-gray-800 hover:shadow-sm hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-50 dark:bg-neutral-700 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-800 py-2"
|
2872
|
+
}, d[1] || (d[1] = [
|
2873
|
+
a("svg", {
|
2874
|
+
xmlns: "http://www.w3.org/2000/svg",
|
2875
|
+
viewBox: "0 0 24 24",
|
2876
|
+
fill: "none",
|
2877
|
+
stroke: "currentColor",
|
2878
|
+
"stroke-width": "2",
|
2879
|
+
"stroke-linecap": "round",
|
2880
|
+
"stroke-linejoin": "round",
|
2881
|
+
class: "icon icon-tabler icons-tabler-outline icon-tabler-chevron-down rotate-90",
|
2882
|
+
height: "16",
|
2883
|
+
width: "16"
|
2884
|
+
}, [
|
2885
|
+
a("path", {
|
2886
|
+
stroke: "none",
|
2887
|
+
d: "M0 0h24v24H0z",
|
2888
|
+
fill: "none"
|
2889
|
+
}),
|
2890
|
+
a("path", { d: "M6 9l6 6l6 -6" })
|
2891
|
+
], -1),
|
2892
|
+
a("span", {
|
2893
|
+
"aria-hidden": "true",
|
2894
|
+
class: "sr-only"
|
2895
|
+
}, "Previous", -1)
|
2896
|
+
]), 8, ba),
|
2897
|
+
a("div", ya, [
|
2898
|
+
(c(!0), w(F, null, q(m.value, (i) => (c(), w("button", {
|
2899
|
+
type: "button",
|
2900
|
+
key: i,
|
2901
|
+
onClick: (t) => p(i),
|
2902
|
+
class: z(o.value === i ? "flex justify-center items-center rounded-lg text-sm dark:text-neutral-300 py-2 px-3 focus:outline-none disabled:opacity-50 disabled:pointer-events-none bg-[#e5e7eb] dark:bg-[#242424] border border-gray-200 text-base h-[38px] min-w-[38px]" : "flex justify-center items-center rounded-lg text-sm dark:text-neutral-400 hover:bg-gray-100 py-2 px-3 focus:outline-none focus:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:hover:bg-neutral-800 dark:focus:bg-neutral-800 text-base h-[38px] min-w-[38px]")
|
2903
|
+
}, K(i), 11, xa))), 128))
|
2904
|
+
]),
|
2905
|
+
a("button", {
|
2906
|
+
type: "button",
|
2907
|
+
"aria-label": "Next",
|
2908
|
+
onClick: h,
|
2909
|
+
disabled: o.value === g.value,
|
2910
|
+
class: "border-white last:rounded-e-lg text-base h-[38px] min-w-[38px] py-2 px-2.5 inline-flex justify-center items-center gap-x-2 border text-sm rounded-lg bg-white text-gray-800 hover:shadow-sm hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-50 dark:bg-neutral-700 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-800 py-2"
|
2911
|
+
}, d[2] || (d[2] = [
|
2912
|
+
a("span", {
|
2913
|
+
"aria-hidden": "true",
|
2914
|
+
class: "sr-only"
|
2915
|
+
}, "Next", -1),
|
2916
|
+
a("svg", {
|
2917
|
+
xmlns: "http://www.w3.org/2000/svg",
|
2918
|
+
viewBox: "0 0 24 24",
|
2919
|
+
fill: "none",
|
2920
|
+
stroke: "currentColor",
|
2921
|
+
"stroke-width": "2",
|
2922
|
+
"stroke-linecap": "round",
|
2923
|
+
"stroke-linejoin": "round",
|
2924
|
+
class: "icon icon-tabler icons-tabler-outline icon-tabler-chevron-down -rotate-90",
|
2925
|
+
height: "16",
|
2926
|
+
width: "16"
|
2927
|
+
}, [
|
2928
|
+
a("path", {
|
2929
|
+
stroke: "none",
|
2930
|
+
d: "M0 0h24v24H0z",
|
2931
|
+
fill: "none"
|
2932
|
+
}),
|
2933
|
+
a("path", { d: "M6 9l6 6l6 -6" })
|
2934
|
+
], -1)
|
2935
|
+
]), 8, wa)
|
2936
|
+
]),
|
2937
|
+
a("div", ka, [
|
2938
|
+
a("div", _a, [
|
2939
|
+
H(a("div", Ca, [
|
2940
|
+
(c(), w(F, null, q([10, 20, 30], (i) => a("button", {
|
2941
|
+
type: "button",
|
2942
|
+
key: i,
|
2943
|
+
onClick: (t) => x(i),
|
2944
|
+
class: "w-full flex items-center gap-x-3.5 py-2 px-3 rounded-lg text-sm text-gray-800 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 dark:text-neutral-400 dark:hover:bg-neutral-700 dark:hover:text-neutral-300 dark:focus:bg-neutral-700"
|
2945
|
+
}, [
|
2946
|
+
Y(K(i) + " ", 1),
|
2947
|
+
n.value === i ? (c(), w("svg", Sa, d[3] || (d[3] = [
|
2948
|
+
a("path", {
|
2949
|
+
stroke: "none",
|
2950
|
+
d: "M0 0h24v24H0z",
|
2951
|
+
fill: "none"
|
2952
|
+
}, null, -1),
|
2953
|
+
a("path", { d: "M5 12l5 5l10 -10" }, null, -1)
|
2954
|
+
]))) : S("", !0)
|
2955
|
+
], 8, Va)), 64))
|
2956
|
+
], 512), [
|
2957
|
+
[X, f.value]
|
2958
|
+
]),
|
2959
|
+
a("button", {
|
2960
|
+
type: "button",
|
2961
|
+
class: "py-3 px-3.5 inline-flex items-center gap-x-1 text-sm rounded-lg border border-gray-200 text-gray-800 shadow-sm hover:bg-gray-50 focus:outline-none focus:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700 dark:focus:bg-neutral-700 text-base h-[38px] min-w-[38px]",
|
2962
|
+
"aria-haspopup": "menu",
|
2963
|
+
"aria-expanded": "false",
|
2964
|
+
"aria-label": "Dropdown",
|
2965
|
+
onClick: d[0] || (d[0] = (i) => f.value = !f.value)
|
2966
|
+
}, [
|
2967
|
+
Y(K(n.value) + " ", 1),
|
2968
|
+
d[4] || (d[4] = a("svg", {
|
2969
|
+
xmlns: "http://www.w3.org/2000/svg",
|
2970
|
+
viewBox: "0 0 24 24",
|
2971
|
+
fill: "none",
|
2972
|
+
stroke: "currentColor",
|
2973
|
+
"stroke-width": "2",
|
2974
|
+
"stroke-linecap": "round",
|
2975
|
+
"stroke-linejoin": "round",
|
2976
|
+
class: "icon icon-tabler icons-tabler-outline icon-tabler-chevron-down",
|
2977
|
+
height: "16",
|
2978
|
+
width: "16"
|
2979
|
+
}, [
|
2980
|
+
a("path", {
|
2981
|
+
stroke: "none",
|
2982
|
+
d: "M0 0h24v24H0z",
|
2983
|
+
fill: "none"
|
2984
|
+
}),
|
2985
|
+
a("path", { d: "M6 9l6 6l6 -6" })
|
2986
|
+
], -1))
|
2987
|
+
])
|
2988
|
+
])
|
2989
|
+
])
|
2990
|
+
]));
|
2991
|
+
}
|
2992
|
+
}), ve = (u, r) => {
|
2993
|
+
const v = u.__vccOpts || u;
|
2994
|
+
for (const [l, o] of r)
|
2995
|
+
v[l] = o;
|
2996
|
+
return v;
|
2997
|
+
}, Ba = {}, Aa = {
|
2998
|
+
class: "w-48 mx-auto mb-4",
|
2999
|
+
width: "178",
|
3000
|
+
height: "90",
|
3001
|
+
viewBox: "0 0 178 90",
|
3002
|
+
fill: "none",
|
3003
|
+
xmlns: "http://www.w3.org/2000/svg"
|
3004
|
+
};
|
3005
|
+
function $a(u, r) {
|
3006
|
+
return c(), w("svg", Aa, r[0] || (r[0] = [
|
3007
|
+
Ue('<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-stone-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-stone-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-stone-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-stone-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-stone-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-stone-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-stone-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-stone-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter2)"><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-stone-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-stone-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-stone-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-stone-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter2" 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)
|
3008
|
+
]));
|
3009
|
+
}
|
3010
|
+
const Ra = /* @__PURE__ */ ve(Ba, [["render", $a]]), Da = {}, ja = {
|
3011
|
+
xmlns: "http://www.w3.org/2000/svg",
|
3012
|
+
width: "21",
|
3013
|
+
height: "20",
|
3014
|
+
viewBox: "0 0 24 24",
|
3015
|
+
fill: "none",
|
3016
|
+
stroke: "currentColor",
|
3017
|
+
"stroke-width": "2",
|
3018
|
+
"stroke-linecap": "round",
|
3019
|
+
"stroke-linejoin": "round",
|
3020
|
+
class: "icon icon-tabler icons-tabler-outline icon-tabler-layout-sidebar-right-collapse"
|
3021
|
+
};
|
3022
|
+
function za(u, r) {
|
3023
|
+
return c(), w("svg", ja, r[0] || (r[0] = [
|
3024
|
+
a("path", {
|
3025
|
+
stroke: "none",
|
3026
|
+
d: "M0 0h24v24H0z",
|
3027
|
+
fill: "none"
|
3028
|
+
}, null, -1),
|
3029
|
+
a("path", { d: "M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z" }, null, -1),
|
3030
|
+
a("path", { d: "M15 4v16" }, null, -1),
|
3031
|
+
a("path", { d: "M9 10l2 2l-2 2" }, null, -1)
|
3032
|
+
]));
|
3033
|
+
}
|
3034
|
+
const Fa = /* @__PURE__ */ ve(Da, [["render", za]]), Ka = {}, Ua = {
|
3035
|
+
xmlns: "http://www.w3.org/2000/svg",
|
3036
|
+
width: "21",
|
3037
|
+
height: "20",
|
3038
|
+
viewBox: "0 0 24 24",
|
3039
|
+
fill: "none",
|
3040
|
+
stroke: "currentColor",
|
3041
|
+
"stroke-width": "2",
|
3042
|
+
"stroke-linecap": "round",
|
3043
|
+
"stroke-linejoin": "round",
|
3044
|
+
class: "icon icon-tabler icons-tabler-outline icon-tabler-layout-sidebar-right-expand"
|
3045
|
+
};
|
3046
|
+
function La(u, r) {
|
3047
|
+
return c(), w("svg", Ua, r[0] || (r[0] = [
|
3048
|
+
a("path", {
|
3049
|
+
stroke: "none",
|
3050
|
+
d: "M0 0h24v24H0z",
|
3051
|
+
fill: "none"
|
3052
|
+
}, null, -1),
|
3053
|
+
a("path", { d: "M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z" }, null, -1),
|
3054
|
+
a("path", { d: "M15 4v16" }, null, -1),
|
3055
|
+
a("path", { d: "M10 10l-2 2l2 2" }, null, -1)
|
3056
|
+
]));
|
3057
|
+
}
|
3058
|
+
const Oa = /* @__PURE__ */ ve(Ka, [["render", La]]), Pa = {}, Ia = {
|
3059
|
+
xmlns: "http://www.w3.org/2000/svg",
|
3060
|
+
width: "24",
|
3061
|
+
height: "24",
|
3062
|
+
viewBox: "0 0 24 24",
|
3063
|
+
fill: "none",
|
3064
|
+
stroke: "currentColor",
|
3065
|
+
"stroke-width": "2",
|
3066
|
+
"stroke-linecap": "round",
|
3067
|
+
"stroke-linejoin": "round",
|
3068
|
+
class: "icon icon-tabler icons-tabler-outline icon-tabler-map"
|
3069
|
+
};
|
3070
|
+
function Ta(u, r) {
|
3071
|
+
return c(), w("svg", Ia, r[0] || (r[0] = [
|
3072
|
+
a("path", {
|
3073
|
+
stroke: "none",
|
3074
|
+
d: "M0 0h24v24H0z",
|
3075
|
+
fill: "none"
|
3076
|
+
}, null, -1),
|
3077
|
+
a("path", { d: "M3 7l6 -3l6 3l6 -3v13l-6 3l-6 -3l-6 3v-13" }, null, -1),
|
3078
|
+
a("path", { d: "M9 4v13" }, null, -1),
|
3079
|
+
a("path", { d: "M15 7v13" }, null, -1)
|
3080
|
+
]));
|
3081
|
+
}
|
3082
|
+
const Ha = /* @__PURE__ */ ve(Pa, [["render", Ta]]), Ea = {}, Wa = {
|
3083
|
+
xmlns: "http://www.w3.org/2000/svg",
|
3084
|
+
width: "24",
|
3085
|
+
height: "24",
|
3086
|
+
viewBox: "0 0 24 24",
|
3087
|
+
fill: "none",
|
3088
|
+
stroke: "currentColor",
|
3089
|
+
"stroke-width": "2",
|
3090
|
+
"stroke-linecap": "round",
|
3091
|
+
"stroke-linejoin": "round",
|
3092
|
+
class: "icon icon-tabler icons-tabler-outline icon-tabler-table"
|
3093
|
+
};
|
3094
|
+
function Ya(u, r) {
|
3095
|
+
return c(), w("svg", Wa, r[0] || (r[0] = [
|
3096
|
+
a("path", {
|
3097
|
+
stroke: "none",
|
3098
|
+
d: "M0 0h24v24H0z",
|
3099
|
+
fill: "none"
|
3100
|
+
}, null, -1),
|
3101
|
+
a("path", { d: "M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z" }, null, -1),
|
3102
|
+
a("path", { d: "M3 10h18" }, null, -1),
|
3103
|
+
a("path", { d: "M10 3v18" }, null, -1)
|
3104
|
+
]));
|
3105
|
+
}
|
3106
|
+
const qa = /* @__PURE__ */ ve(Ea, [["render", Ya]]);
|
3107
|
+
function Na(u, r) {
|
3108
|
+
let v;
|
3109
|
+
return function(...l) {
|
3110
|
+
clearTimeout(v), v = setTimeout(() => u(...l), r);
|
3111
|
+
};
|
3112
|
+
}
|
3113
|
+
function Ga(u, r, v) {
|
3114
|
+
r && (r.addSource("vector", {
|
3115
|
+
type: "vector",
|
3116
|
+
tiles: [
|
3117
|
+
`http://${window.location.host}/api/vtile/${u}/ua/{z}/{x}/{y}.vmt?pointZoom=12`
|
3118
|
+
],
|
3119
|
+
minzoom: 0,
|
3120
|
+
maxzoom: 12
|
3121
|
+
}), r.addLayer({
|
3122
|
+
id: "vector-circle",
|
3123
|
+
type: "circle",
|
3124
|
+
maxzoom: 12,
|
3125
|
+
source: "vector",
|
3126
|
+
"source-layer": u,
|
3127
|
+
// must match the layer name in the vector tile source
|
3128
|
+
paint: {
|
3129
|
+
"circle-color": v,
|
3130
|
+
"circle-stroke-color": "#eee",
|
3131
|
+
"circle-stroke-width": 1,
|
3132
|
+
"circle-radius": ["interpolate", ["linear"], ["zoom"], 10, 5, 15, 12]
|
3133
|
+
}
|
3134
|
+
}), r.addLayer({
|
3135
|
+
id: "vector-fill",
|
3136
|
+
type: "fill",
|
3137
|
+
minzoom: 12,
|
3138
|
+
source: "vector",
|
3139
|
+
"source-layer": u,
|
3140
|
+
// must match the layer name in the vector tile source
|
3141
|
+
paint: {
|
3142
|
+
"fill-color": v,
|
3143
|
+
"fill-opacity": 0.6
|
3144
|
+
}
|
3145
|
+
}));
|
3146
|
+
}
|
3147
|
+
const ge = [
|
3148
|
+
{
|
3149
|
+
name: "voyager",
|
3150
|
+
label: "Базова карта (voyager)",
|
3151
|
+
url: "https://data.gki.com.ua/api-user/rtile/voyager/ua/{z}/{x}/{y}.png",
|
3152
|
+
preview: "https://data.gki.com.ua/api-user/rtile/voyager/ua/12/2422/1400.png"
|
3153
|
+
},
|
3154
|
+
{
|
3155
|
+
name: "orto",
|
3156
|
+
label: "Ортофото 10К",
|
3157
|
+
url: "https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png",
|
3158
|
+
preview: "https://data.gki.com.ua/api-user/rtile/orto10/ua/12/2422/1400.png"
|
3159
|
+
},
|
3160
|
+
{
|
3161
|
+
name: "esri",
|
3162
|
+
label: "Esri ",
|
3163
|
+
url: "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",
|
3164
|
+
preview: "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/12/2422/1400.png"
|
3165
|
+
},
|
3166
|
+
{
|
3167
|
+
name: "google",
|
3168
|
+
label: "Google ",
|
3169
|
+
url: "https://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}",
|
3170
|
+
preview: "https://mt1.google.com/vt/lyrs=s&x=2422&y=1400&z=12"
|
3171
|
+
}
|
3172
|
+
], Qa = { class: "relative w-auto h-full" }, Za = { class: "absolute left-[20px] bottom-[74px] bg-white max-w-[250px] p-[10px] rounded-lg z-10 border" }, Ja = { class: "flex justify-start items-center gap-2" }, Xa = { class: "ml-1 text-[0.875rem]" }, eo = { class: "vs-map-slot-layers z-10 select-none" }, to = ["onClick"], lo = ["src"], ao = { class: "absolute py-2 px-4 text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg top-[-46px] hidden whitespace-nowrap left-1/2 -translate-x-1/2" }, oo = /* @__PURE__ */ W({
|
3173
|
+
__name: "map",
|
3174
|
+
props: {
|
3175
|
+
table: {},
|
3176
|
+
center: {},
|
3177
|
+
colorAttr: {},
|
3178
|
+
filter: {},
|
3179
|
+
modelValue: {},
|
3180
|
+
zoom: {},
|
3181
|
+
map: {}
|
3182
|
+
},
|
3183
|
+
emits: ["update:modelValue", "update:map"],
|
3184
|
+
setup(u, { emit: r }) {
|
3185
|
+
const v = u, l = r;
|
3186
|
+
let o, n;
|
3187
|
+
const f = V(null), g = V(!1), m = V(ge[0].name), k = ge[0], h = V(null), p = V(null), x = [
|
3188
|
+
"#2563EB",
|
3189
|
+
// Primary Blue
|
3190
|
+
"#60A5FA",
|
3191
|
+
// Sky Blue
|
3192
|
+
"#10B981",
|
3193
|
+
// Soft Green
|
3194
|
+
"#34D399",
|
3195
|
+
// Mint Green
|
3196
|
+
"#F59E0B",
|
3197
|
+
// Warm Yellow
|
3198
|
+
"#F97316",
|
3199
|
+
// Soft Orange
|
3200
|
+
"#EF4444",
|
3201
|
+
// Light Red
|
3202
|
+
"#F43F5E",
|
3203
|
+
// Rose Pink
|
3204
|
+
"#374151",
|
3205
|
+
// Dark Gray
|
3206
|
+
"#D1D5DB"
|
3207
|
+
// Light Gray
|
3208
|
+
];
|
3209
|
+
let C;
|
3210
|
+
const d = [30, 48];
|
3211
|
+
return ue(async () => {
|
3212
|
+
C = (await fetch(`/api/data/${v.table}/${v.colorAttr}`).then((t) => t.json())).rows, C.forEach((t, y) => {
|
3213
|
+
t.color || Object.assign(t, { color: x[y % 10] });
|
3214
|
+
}), n = new maplibregl.Popup({
|
3215
|
+
closeButton: !1,
|
3216
|
+
closeOnClick: !1
|
3217
|
+
}), o = new maplibregl.Map({
|
3218
|
+
container: f.value,
|
3219
|
+
style: {
|
3220
|
+
version: 8,
|
3221
|
+
sources: {
|
3222
|
+
[k.name]: { type: "raster", tiles: [k.url], tileSize: 256 }
|
3223
|
+
},
|
3224
|
+
layers: [{
|
3225
|
+
id: k.name,
|
3226
|
+
type: "raster",
|
3227
|
+
source: k.name,
|
3228
|
+
minzoom: 0,
|
3229
|
+
maxzoom: 19
|
3230
|
+
}]
|
3231
|
+
},
|
3232
|
+
center: v.center || d,
|
3233
|
+
// [lng, lat] → Paris
|
3234
|
+
zoom: v.center ? 14 : 5,
|
3235
|
+
minZoom: 3,
|
3236
|
+
maxZoom: 18,
|
3237
|
+
attributionControl: !1
|
3238
|
+
}), l("update:map", o), o.addControl(new maplibregl.NavigationControl(), "top-right"), o.on("load", () => {
|
3239
|
+
o == null || o.resize(), g.value = !0;
|
3240
|
+
const t = C.filter((b) => b.id).reduce((b, s) => [s.id, s.color].concat(b), []), y = ["match", ["get", v.colorAttr], ...t, "#808080"];
|
3241
|
+
Ga(v.table, o, y);
|
3242
|
+
}), o.on("click", (t) => {
|
3243
|
+
const y = o.queryRenderedFeatures(t.point);
|
3244
|
+
y.length && l("update:modelValue", y[0].properties.id);
|
3245
|
+
}), o.on("mousemove", (t) => {
|
3246
|
+
var M;
|
3247
|
+
const y = o.queryRenderedFeatures(t.point);
|
3248
|
+
if (!y || !y.length) {
|
3249
|
+
n.remove(), o.getCanvas().style.cursor = "";
|
3250
|
+
return;
|
3251
|
+
}
|
3252
|
+
o.getCanvas().style.cursor = "pointer";
|
3253
|
+
const b = y[0], { coordinates: s } = b.geometry, _ = b.geometry.type === "Point" ? s : s[0][0];
|
3254
|
+
p.value = b.properties, n.setLngLat(_).setHTML((M = h.value) == null ? void 0 : M.innerHTML).addTo(o);
|
3255
|
+
});
|
3256
|
+
}), R(() => v.center, (i) => {
|
3257
|
+
o && (o.setCenter(i || d), o.setZoom(i ? 14 : 5));
|
3258
|
+
}), R(() => v.filter, (i) => {
|
3259
|
+
const t = `http://${window.location.host}/api/vtile/${v.table}/ua/{z}/{x}/{y}.vmt?pointZoom=12&filter=${i}`;
|
3260
|
+
o.getSource("vector").setTiles([t]);
|
3261
|
+
}), R(m, (i, t) => {
|
3262
|
+
const y = ge.find((b) => b.name === i);
|
3263
|
+
y && (o.removeLayer(t), o.removeSource(t), o.addSource(i, { type: "raster", tiles: [y.url], tileSize: 256 }), o.addLayer({
|
3264
|
+
id: y.name,
|
3265
|
+
type: "raster",
|
3266
|
+
source: y.name,
|
3267
|
+
minzoom: 0,
|
3268
|
+
maxzoom: 19
|
3269
|
+
}, "vector-circle"));
|
3270
|
+
}), he(() => {
|
3271
|
+
o && o.remove();
|
3272
|
+
}), (i, t) => H((c(), w("div", Qa, [
|
3273
|
+
a("div", {
|
3274
|
+
ref_key: "mapContainer",
|
3275
|
+
ref: f,
|
3276
|
+
class: "map-container w-auto relative"
|
3277
|
+
}, null, 512),
|
3278
|
+
a("div", Za, [
|
3279
|
+
(c(!0), w(F, null, q(e(C), (y) => (c(), w("div", {
|
3280
|
+
class: "legend-item",
|
3281
|
+
key: y.id
|
3282
|
+
}, [
|
3283
|
+
a("div", Ja, [
|
3284
|
+
a("div", {
|
3285
|
+
class: "w-[15px] h-[15px] rounded-[50%] min-w-[15px]",
|
3286
|
+
style: _e("background-color:" + y.color)
|
3287
|
+
}, null, 4),
|
3288
|
+
a("div", Xa, K(y.text), 1)
|
3289
|
+
])
|
3290
|
+
]))), 128))
|
3291
|
+
]),
|
3292
|
+
a("div", {
|
3293
|
+
ref_key: "popupDiv",
|
3294
|
+
ref: h,
|
3295
|
+
style: { display: "none" }
|
3296
|
+
}, [
|
3297
|
+
ee(i.$slots, "default", { hoverData: p.value })
|
3298
|
+
], 512),
|
3299
|
+
a("div", eo, [
|
3300
|
+
(c(!0), w(F, null, q(e(ge), (y) => (c(), w("div", {
|
3301
|
+
key: y.name,
|
3302
|
+
class: z(["vs-map-slot-layers__layer relative", { focused: m.value === y.name }]),
|
3303
|
+
onClick: (b) => m.value = y.name
|
3304
|
+
}, [
|
3305
|
+
a("img", {
|
3306
|
+
src: y.preview,
|
3307
|
+
class: "vs-map-slot-layers__image"
|
3308
|
+
}, null, 8, lo),
|
3309
|
+
a("div", ao, K(y.label), 1)
|
3310
|
+
], 10, to))), 128))
|
3311
|
+
])
|
3312
|
+
], 512)), [
|
3313
|
+
[X, g.value]
|
3314
|
+
]);
|
3315
|
+
}
|
3316
|
+
}), ro = { class: "pt-[20px]" }, no = { class: "w-full gap-5 inline-flex mb-[6px] pr-3" }, io = { class: "flex items-center" }, so = ["title"], uo = { class: "max-[1000px]:flex gap-2 min-[1001px]:hidden" }, co = { class: "flex" }, po = {
|
3317
|
+
key: 0,
|
3318
|
+
class: "py-[15px] pb-[24px] pl-2"
|
3319
|
+
}, fo = { class: "font-bold text-2xl mr-[10px]" }, vo = { class: "text-sm text-stone-500 font-medium" }, mo = {
|
3320
|
+
class: "wrapperTable flex flex-col",
|
3321
|
+
style: { height: "calc(100vh - 302px)" }
|
3322
|
+
}, go = {
|
3323
|
+
key: 1,
|
3324
|
+
class: "text-center py-28"
|
3325
|
+
}, ho = { key: 1 }, bo = {
|
3326
|
+
key: 2,
|
3327
|
+
class: "my-5 pr-2"
|
3328
|
+
}, yo = { class: "flex justify-between" }, xo = { class: "w-full lg:w-1/2 relative" }, ko = /* @__PURE__ */ W({
|
3329
|
+
__name: "vs-parts-map",
|
3330
|
+
props: {
|
3331
|
+
title: {},
|
3332
|
+
table: {},
|
3333
|
+
map: {},
|
3334
|
+
rows: {},
|
3335
|
+
initTotal: {},
|
3336
|
+
colorAttr: {},
|
3337
|
+
id: {},
|
3338
|
+
filters: {},
|
3339
|
+
history: { type: Boolean }
|
3340
|
+
},
|
3341
|
+
emits: ["change:filter", "update:map"],
|
3342
|
+
setup(u, { emit: r }) {
|
3343
|
+
var O, G, ie, ae, $e;
|
3344
|
+
function v($) {
|
3345
|
+
return ($.type === "Point" ? $.coordinates : null) || ($.type.includes("Multi") ? $.coordinates[0][0][0] : $.coordinates[0][0]);
|
3346
|
+
}
|
3347
|
+
const l = u, o = r, n = V(0);
|
3348
|
+
n.value = l.initTotal ?? ((O = l.rows) == null ? void 0 : O.length) ?? 0;
|
3349
|
+
const f = V(""), g = V(null), m = V(!0), k = V(((G = l.rows) == null ? void 0 : G.length) === 1), h = V(0), p = V(l.rows), x = V(1), C = V(20), d = V(l.filters || []), i = V(""), t = V({}), y = V(((ie = l.rows) == null ? void 0 : ie.length) === 1 ? l.rows[0] : {}), b = V(((ae = l.rows) == null ? void 0 : ae.length) === 1 ? l.rows[0].id : ""), s = V((($e = l.rows) == null ? void 0 : $e.length) === 1 ? v(l.rows[0].geom) : null);
|
3350
|
+
function _($) {
|
3351
|
+
return Object.entries($).filter(([, D]) => D).map(([D, ce]) => `${D}=${ce}`).join("|");
|
3352
|
+
}
|
3353
|
+
async function M() {
|
3354
|
+
const $ = _(t.value);
|
3355
|
+
i.value = $;
|
3356
|
+
try {
|
3357
|
+
const D = {
|
3358
|
+
search: f.value,
|
3359
|
+
limit: C.value.toString(),
|
3360
|
+
page: x.value.toString(),
|
3361
|
+
filter: $
|
3362
|
+
}, ce = new URL(`/api/data/${l.table}`, window.location.origin) + (b.value ? `/${b.value}` : ""), Q = new URLSearchParams(D).toString(), pe = await fetch(`${ce.toString()}?${Q}`).then((me) => me.json());
|
3363
|
+
if (b.value) {
|
3364
|
+
const [me] = pe.rows;
|
3365
|
+
y.value = me, s.value = v(me.geom), k.value = !0;
|
3366
|
+
} else
|
3367
|
+
s.value = null, p.value = pe == null ? void 0 : pe.rows;
|
3368
|
+
n.value = pe.filtered, ma({ page: x.value, filter: $, id: b.value });
|
3369
|
+
} catch (D) {
|
3370
|
+
console.error(D.message);
|
3371
|
+
}
|
3372
|
+
}
|
3373
|
+
const A = Na(M, 300);
|
3374
|
+
function U($) {
|
3375
|
+
C.value = $, x.value = 1, M();
|
3376
|
+
}
|
3377
|
+
function I($) {
|
3378
|
+
x.value = $, M();
|
3379
|
+
}
|
3380
|
+
function L($) {
|
3381
|
+
t.value = $.data, x.value = 1, M(), o("change:filter", $);
|
3382
|
+
}
|
3383
|
+
async function de() {
|
3384
|
+
if (l.filters) return;
|
3385
|
+
const D = await (await fetch(`/api/filter/${l.table}`)).json();
|
3386
|
+
d.value = D.list;
|
3387
|
+
}
|
3388
|
+
function J() {
|
3389
|
+
t.value = {}, f.value = "", M();
|
3390
|
+
}
|
3391
|
+
ue(async () => {
|
3392
|
+
h.value = window.innerWidth, h.value < 1e3 && (m.value = !1);
|
3393
|
+
const $ = new URLSearchParams(window.location.search);
|
3394
|
+
x.value = Number($.get("page")) || 1, C.value = Number($.get("limit")) || C.value, b.value = $.get("id") || "", k.value = !!b.value, de(), !p.value && !b.value && M();
|
3395
|
+
});
|
3396
|
+
function T() {
|
3397
|
+
k.value = !1, y.value = null, b.value = "", M();
|
3398
|
+
}
|
3399
|
+
function B($) {
|
3400
|
+
b.value = $.id;
|
3401
|
+
}
|
3402
|
+
return R(g, ($) => {
|
3403
|
+
o("update:map", $);
|
3404
|
+
}), R(f, ($) => {
|
3405
|
+
$ || M();
|
3406
|
+
}), R(b, () => {
|
3407
|
+
M();
|
3408
|
+
}), ($, D) => {
|
3409
|
+
var ce;
|
3410
|
+
return c(), w("section", ro, [
|
3411
|
+
ee($.$slots, "header", {
|
3412
|
+
title: l.title,
|
3413
|
+
total: n.value
|
3414
|
+
}),
|
3415
|
+
a("div", no, [
|
3416
|
+
P(e(ne), {
|
3417
|
+
type: "text",
|
3418
|
+
modelValue: f.value,
|
3419
|
+
"onUpdate:modelValue": D[0] || (D[0] = (Q) => f.value = Q),
|
3420
|
+
name: "search",
|
3421
|
+
label: "Пошук",
|
3422
|
+
onChange: e(A)
|
3423
|
+
}, null, 8, ["modelValue", "onChange"]),
|
3424
|
+
d.value.length ? (c(), j(e(xe), {
|
3425
|
+
key: 0,
|
3426
|
+
schema: d.value,
|
3427
|
+
view: "inline",
|
3428
|
+
onChange: L,
|
3429
|
+
limit: 5,
|
3430
|
+
value: t.value,
|
3431
|
+
ref: "filterRef"
|
3432
|
+
}, null, 8, ["schema", "value"])) : S("", !0),
|
3433
|
+
a("div", io, [
|
3434
|
+
a("button", {
|
3435
|
+
type: "button",
|
3436
|
+
class: "map-visible-button py-2 px-2 hidden min-[1001px]:inline-flex items-center gap-x-1.5 text-sm rounded-lg border border-gray-200 bg-white text-gray-600 shadow-sm hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100",
|
3437
|
+
title: m.value ? "Приховати карту" : "Показати карту",
|
3438
|
+
onClick: D[1] || (D[1] = (Q) => m.value = !m.value)
|
3439
|
+
}, [
|
3440
|
+
m.value ? (c(), j(Fa, { key: 0 })) : (c(), j(Oa, { key: 1 })),
|
3441
|
+
D[8] || (D[8] = a("span", { class: "sr-only" }, "Відкрити мапу", -1))
|
3442
|
+
], 8, so),
|
3443
|
+
a("div", uo, [
|
3444
|
+
a("button", {
|
3445
|
+
onClick: D[2] || (D[2] = (Q) => m.value = !1),
|
3446
|
+
class: "py-2 px-2 h-[38px] inline-flex items-center gap-x-1.5 text-sm rounded-lg border border-gray-200 bg-white text-gray-600 shadow-sm hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100"
|
3447
|
+
}, [
|
3448
|
+
P(qa)
|
3449
|
+
]),
|
3450
|
+
a("button", {
|
3451
|
+
onClick: D[3] || (D[3] = (Q) => m.value = !0),
|
3452
|
+
class: "py-2 px-2 h-[38px] inline-flex items-center gap-x-1.5 text-sm rounded-lg border border-gray-200 bg-white text-gray-600 shadow-sm hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100"
|
3453
|
+
}, [
|
3454
|
+
P(Ha)
|
3455
|
+
])
|
3456
|
+
])
|
3457
|
+
])
|
3458
|
+
]),
|
3459
|
+
a("div", co, [
|
3460
|
+
a("div", {
|
3461
|
+
class: z([
|
3462
|
+
"relative overflow-hidden shrink-0",
|
3463
|
+
m.value ? "w-2/4 mr-0" : "w-full mr-3",
|
3464
|
+
k.value ? "hidden" : ""
|
3465
|
+
])
|
3466
|
+
}, [
|
3467
|
+
(ce = $.$slots) != null && ce.header ? S("", !0) : (c(), w("h1", po, [
|
3468
|
+
a("span", fo, K(l.title), 1),
|
3469
|
+
a("span", vo, K(n.value), 1),
|
3470
|
+
D[9] || (D[9] = a("span", { class: "text-sm text-stone-500 font-medium" }, " об'єктів", -1))
|
3471
|
+
])),
|
3472
|
+
a("div", mo, [
|
3473
|
+
n.value >= 1 ? ee($.$slots, "table", {
|
3474
|
+
key: 0,
|
3475
|
+
rows: p.value,
|
3476
|
+
selectRow: B
|
3477
|
+
}) : (c(), w("div", go, [
|
3478
|
+
P(Ra),
|
3479
|
+
D[10] || (D[10] = a("h2", { class: "font-medium text-base text-gray-500 rounded-xl" }, " За вашим запитом даних не знайдено! ", -1)),
|
3480
|
+
D[11] || (D[11] = a("p", { class: "font-normal text-sm text-gray-500 rounded-xl" }, " Введіть, будь ласка, інші значення для пошуку. ", -1)),
|
3481
|
+
a("button", {
|
3482
|
+
type: "button",
|
3483
|
+
class: "mt-[10px] py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs rounded-lg border border-stone-200 bg-white text-stone-800 shadow-sm hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100",
|
3484
|
+
onClick: J
|
3485
|
+
}, " Очистити дані пошуку ")
|
3486
|
+
]))
|
3487
|
+
]),
|
3488
|
+
n.value >= 1 ? (c(), w("hr", ho)) : S("", !0),
|
3489
|
+
n.value >= 1 ? (c(), w("div", bo, [
|
3490
|
+
a("div", yo, [
|
3491
|
+
P(Ma, {
|
3492
|
+
total: n.value,
|
3493
|
+
currentPage: x.value ?? 1,
|
3494
|
+
pageSize: C.value,
|
3495
|
+
onPageChange: D[4] || (D[4] = (Q) => I(Q)),
|
3496
|
+
onPageSizeChange: D[5] || (D[5] = (Q) => U(Q))
|
3497
|
+
}, null, 8, ["total", "currentPage", "pageSize"])
|
3498
|
+
])
|
3499
|
+
])) : S("", !0)
|
3500
|
+
], 2),
|
3501
|
+
k.value ? (c(), w("div", {
|
3502
|
+
key: 0,
|
3503
|
+
class: z(
|
3504
|
+
m.value ? "lg:static lg:w-1/2 mr-0 pb-5" : "pb-5 mr-3"
|
3505
|
+
),
|
3506
|
+
style: { height: "calc(100vh - 152px)" }
|
3507
|
+
}, [
|
3508
|
+
ee($.$slots, "details", {
|
3509
|
+
table: l.table,
|
3510
|
+
selectedRow: y.value,
|
3511
|
+
closeObjCard: T
|
3512
|
+
})
|
3513
|
+
], 2)) : S("", !0),
|
3514
|
+
H(a("div", xo, [
|
3515
|
+
P(oo, {
|
3516
|
+
table: l.table,
|
3517
|
+
map: g.value,
|
3518
|
+
"onUpdate:map": D[6] || (D[6] = (Q) => g.value = Q),
|
3519
|
+
colorAttr: l.colorAttr,
|
3520
|
+
filter: i.value,
|
3521
|
+
center: s.value,
|
3522
|
+
modelValue: b.value,
|
3523
|
+
"onUpdate:modelValue": D[7] || (D[7] = (Q) => b.value = Q)
|
3524
|
+
}, {
|
3525
|
+
default: re(({ hoverData: Q }) => [
|
3526
|
+
ee($.$slots, "popup", { data: Q })
|
3527
|
+
]),
|
3528
|
+
_: 3
|
3529
|
+
}, 8, ["table", "map", "colorAttr", "filter", "center", "modelValue"]),
|
3530
|
+
ee($.$slots, "default", {
|
3531
|
+
table: l.table,
|
3532
|
+
map: g.value,
|
3533
|
+
selectedRow: y.value
|
3534
|
+
})
|
3535
|
+
], 512), [
|
3536
|
+
[X, m.value]
|
3537
|
+
])
|
3538
|
+
])
|
3539
|
+
]);
|
3540
|
+
};
|
3541
|
+
}
|
3542
|
+
});
|
3543
|
+
export {
|
3544
|
+
ko as default
|
3545
|
+
};
|