@oneb/ui-vue 0.3.27 → 0.3.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dropdown/index.cjs +1 -1
- package/dist/dropdown/index.js +1 -1
- package/dist/entityPicker/EntityPickerCreateButton.vue.d.ts +2 -0
- package/dist/entityPicker/EntityPickerIndicator.vue.d.ts +2 -0
- package/dist/entityPicker/EntityPickerList.vue.d.ts +2 -0
- package/dist/entityPicker/EntityPickerListItem.vue.d.ts +2 -0
- package/dist/entityPicker/EntityPickerModal.vue.d.ts +2 -0
- package/dist/entityPicker/EntityPickerSearch.vue.d.ts +2 -0
- package/dist/entityPicker/EntityPickerTrigger.vue.d.ts +2 -0
- package/dist/entityPicker/entityPicker.d.ts +80 -1
- package/dist/entityPicker/index.cjs +1 -1
- package/dist/entityPicker/index.js +965 -392
- package/dist/entityPicker/useEntityList.d.ts +46 -0
- package/dist/entityPicker/useEntityModal.d.ts +48 -0
- package/dist/entityPicker/useEntityResolvers.d.ts +37 -0
- package/dist/form/form.d.ts +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/layout/index.cjs +1 -1
- package/dist/layout/index.js +398 -395
- package/dist/layout/layout.d.ts +1 -0
- package/dist/modal/index.cjs +1 -1
- package/dist/modal/index.js +2 -2
- package/dist/modal/modal.d.ts +5 -0
- package/dist/periodPicker/index.cjs +1 -1
- package/dist/periodPicker/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/useModal-0c73777f.cjs +1 -0
- package/dist/useModal-7fe9444b.js +194 -0
- package/package.json +1 -1
- package/dist/useModal-85f57682.js +0 -177
- package/dist/useModal-98810f6a.cjs +0 -1
|
@@ -1,68 +1,745 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import { _ as
|
|
1
|
+
import { defineComponent as M, openBlock as a, createBlock as F, unref as d, createSlots as R, withCtx as x, createElementBlock as o, renderSlot as c, createCommentVNode as C, computed as S, normalizeClass as m, toDisplayString as E, createElementVNode as r, normalizeStyle as X, resolveDynamicComponent as H, withModifiers as Q, createTextVNode as G, ref as I, onMounted as ne, onUnmounted as ae, watch as Y, nextTick as ie, createVNode as q, Fragment as Z, renderList as se, normalizeProps as oe, guardReactiveProps as re, isRef as de } from "vue";
|
|
2
|
+
import { O as ue, u as ce } from "../useModal-7fe9444b.js";
|
|
3
|
+
import { _ as D } from "../OneAvatar.vue_vue_type_script_setup_true_lang-08ab80dd.js";
|
|
4
4
|
import "vue-markdown-render";
|
|
5
5
|
import "../OneMarkdown.vue_vue_type_style_index_0_lang-4ed993c7.js";
|
|
6
6
|
import "../SpinnerIcon.vue_vue_type_style_index_0_lang-4ed993c7.js";
|
|
7
|
-
import { useOnebI18n as
|
|
7
|
+
import { useOnebI18n as ye } from "../i18n/index.js";
|
|
8
8
|
import "../_plugin-vue_export-helper-dad06003.js";
|
|
9
|
-
const
|
|
10
|
-
key: 0,
|
|
11
|
-
class: "space-y-1 flex flex-col"
|
|
12
|
-
}, je = {
|
|
13
|
-
key: 0,
|
|
14
|
-
class: "text-gray-400 text-xs font-light"
|
|
15
|
-
}, $e = {
|
|
16
|
-
key: 0,
|
|
17
|
-
class: "text-[10px] text-gray-500 ml-1 py-0.5 rounded-full font-semibold hover:text-info-base"
|
|
18
|
-
}, ze = {
|
|
9
|
+
const fe = {
|
|
19
10
|
key: 0,
|
|
20
11
|
class: "overflow-auto max-h-[85dvh] h-full"
|
|
21
|
-
},
|
|
12
|
+
}, ve = {
|
|
22
13
|
key: 1,
|
|
23
14
|
class: "overflow-auto max-h-[85dvh] h-full"
|
|
24
|
-
},
|
|
15
|
+
}, me = {
|
|
25
16
|
key: 2,
|
|
26
17
|
class: "pb-6"
|
|
27
|
-
},
|
|
18
|
+
}, ge = {
|
|
28
19
|
key: 0,
|
|
29
20
|
class: "px-2 pt-3"
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
},
|
|
21
|
+
}, be = /* @__PURE__ */ M({
|
|
22
|
+
__name: "EntityPickerModal",
|
|
23
|
+
props: {
|
|
24
|
+
useModal: {
|
|
25
|
+
type: Object,
|
|
26
|
+
required: !0
|
|
27
|
+
},
|
|
28
|
+
title: { type: String, default: "" },
|
|
29
|
+
subtitle: { type: String, default: "" },
|
|
30
|
+
titleCenter: { type: Boolean, default: !1 },
|
|
31
|
+
size: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: "sm"
|
|
34
|
+
},
|
|
35
|
+
mobileView: { type: Boolean, default: !1 },
|
|
36
|
+
view: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: "browse"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
setup(e) {
|
|
42
|
+
return (l, t) => e.useModal.isOpened.value ? (a(), F(d(ue), {
|
|
43
|
+
key: 0,
|
|
44
|
+
useModal: e.useModal,
|
|
45
|
+
title: e.title,
|
|
46
|
+
subtitle: e.subtitle,
|
|
47
|
+
size: e.size,
|
|
48
|
+
classModal: e.mobileView,
|
|
49
|
+
titleCenter: e.titleCenter
|
|
50
|
+
}, R({
|
|
51
|
+
default: x(() => [
|
|
52
|
+
e.view === "create" ? (a(), o("div", fe, [
|
|
53
|
+
c(l.$slots, "create")
|
|
54
|
+
])) : e.view === "edit" ? (a(), o("div", ve, [
|
|
55
|
+
c(l.$slots, "edit")
|
|
56
|
+
])) : (a(), o("div", me, [
|
|
57
|
+
l.$slots.header ? (a(), o("div", ge, [
|
|
58
|
+
c(l.$slots, "header")
|
|
59
|
+
])) : C("", !0),
|
|
60
|
+
c(l.$slots, "search"),
|
|
61
|
+
c(l.$slots, "prepend"),
|
|
62
|
+
c(l.$slots, "createButton"),
|
|
63
|
+
c(l.$slots, "list")
|
|
64
|
+
]))
|
|
65
|
+
]),
|
|
66
|
+
_: 2
|
|
67
|
+
}, [
|
|
68
|
+
l.$slots.subtitle ? {
|
|
69
|
+
name: "subtitle",
|
|
70
|
+
fn: x(() => [
|
|
71
|
+
c(l.$slots, "subtitle")
|
|
72
|
+
]),
|
|
73
|
+
key: "0"
|
|
74
|
+
} : void 0
|
|
75
|
+
]), 1032, ["useModal", "title", "subtitle", "size", "classModal", "titleCenter"])) : C("", !0);
|
|
76
|
+
}
|
|
77
|
+
}), he = {
|
|
37
78
|
key: 0,
|
|
38
|
-
class: "flex items-center
|
|
39
|
-
},
|
|
40
|
-
key: 1,
|
|
41
|
-
class: "relative px-5 py-10 text-center"
|
|
42
|
-
}, He = { class: "mb-4 text-sm text-gray-500" }, We = {
|
|
43
|
-
key: 2,
|
|
44
|
-
class: "p-3 text-center mt-6"
|
|
45
|
-
}, Je = { class: "text-xs" }, Re = ["onClick"], Xe = { class: "mr-2" }, Ye = { class: "w-full" }, Ze = { class: "font-bold truncate overflow-hidden sm:max-w-[400px] max-w-[280px] text-xs" }, Qe = {
|
|
79
|
+
class: "relative select-none inline-flex items-center gap-3"
|
|
80
|
+
}, ke = { class: "text-sm font-medium truncate text-inherit" }, Se = ["aria-label"], Ce = {
|
|
46
81
|
key: 0,
|
|
47
|
-
class: "
|
|
48
|
-
|
|
82
|
+
class: "w-4 h-4",
|
|
83
|
+
fill: "none",
|
|
84
|
+
viewBox: "0 0 24 24",
|
|
85
|
+
stroke: "currentColor",
|
|
86
|
+
"stroke-width": "2"
|
|
87
|
+
}, xe = {
|
|
49
88
|
key: 1,
|
|
50
|
-
class: "w-
|
|
89
|
+
class: "w-4 h-4",
|
|
51
90
|
fill: "none",
|
|
52
91
|
viewBox: "0 0 24 24",
|
|
53
92
|
stroke: "currentColor",
|
|
54
93
|
"stroke-width": "2"
|
|
55
|
-
},
|
|
56
|
-
key:
|
|
57
|
-
class: "
|
|
94
|
+
}, Ee = { key: 0 }, Le = { class: "" }, $e = {
|
|
95
|
+
key: 0,
|
|
96
|
+
class: "space-y-1 flex flex-col"
|
|
97
|
+
}, we = {
|
|
98
|
+
key: 0,
|
|
99
|
+
class: "text-gray-400 text-xs font-light"
|
|
100
|
+
}, Ve = {
|
|
101
|
+
key: 0,
|
|
102
|
+
class: "text-[10px] text-gray-500 ml-1 py-0.5 rounded-full font-semibold hover:text-info-base"
|
|
103
|
+
}, Ae = /* @__PURE__ */ M({
|
|
104
|
+
__name: "EntityPickerTrigger",
|
|
105
|
+
props: {
|
|
106
|
+
variant: {
|
|
107
|
+
type: String,
|
|
108
|
+
default: "default"
|
|
109
|
+
},
|
|
110
|
+
modelValue: { type: [Object, null], default: null },
|
|
111
|
+
icon: { type: [Object, Function, null], default: null },
|
|
112
|
+
title: { type: String, default: "" },
|
|
113
|
+
labelSelect: { type: String, default: "" },
|
|
114
|
+
labelSelectNote: { type: String, default: "" },
|
|
115
|
+
labelClass: { type: String, default: "" },
|
|
116
|
+
iconClass: { type: String, default: "" },
|
|
117
|
+
iconClassBlock: { type: String, default: "" },
|
|
118
|
+
noIcon: { type: Boolean, default: !1 },
|
|
119
|
+
readonly: { type: Boolean, default: !1 },
|
|
120
|
+
tagColor: { type: String, default: "#525B66" },
|
|
121
|
+
changeLabel: { type: String, default: "" },
|
|
122
|
+
resolvers: { type: Object, required: !0 }
|
|
123
|
+
},
|
|
124
|
+
emits: ["open", "clear"],
|
|
125
|
+
setup(e, { emit: l }) {
|
|
126
|
+
const t = e, n = l, g = () => n("open"), i = S(() => t.variant === "compact" || t.variant === "minimal"), b = S(() => t.variant === "compact"), y = S(() => t.variant === "pill"), f = S(() => t.modelValue == null ? {} : { backgroundColor: `${t.tagColor}1A` }), L = S(
|
|
127
|
+
() => t.modelValue != null ? t.tagColor : "#979CA9"
|
|
128
|
+
);
|
|
129
|
+
return (s, h) => e.variant === "tag" ? (a(), o("div", he, [
|
|
130
|
+
c(s.$slots, "button", {
|
|
131
|
+
title: e.title,
|
|
132
|
+
modelValue: e.modelValue,
|
|
133
|
+
openModal: g
|
|
134
|
+
}, () => [
|
|
135
|
+
e.title ? (a(), o("p", {
|
|
136
|
+
key: 0,
|
|
137
|
+
class: m(["font-semibold text-black", e.labelClass])
|
|
138
|
+
}, E(e.title), 3)) : C("", !0),
|
|
139
|
+
r("div", {
|
|
140
|
+
class: m([
|
|
141
|
+
"flex items-center gap-2 h-10 px-3 rounded-xl transition-colors",
|
|
142
|
+
e.readonly ? "" : "cursor-pointer",
|
|
143
|
+
e.modelValue == null ? "bg-[#FAFAFA] hover:bg-gray-100 text-[#979CA9]" : "hover:opacity-90 text-black"
|
|
144
|
+
]),
|
|
145
|
+
style: X(f.value),
|
|
146
|
+
onClick: g
|
|
147
|
+
}, [
|
|
148
|
+
e.icon ? (a(), F(H(e.icon), {
|
|
149
|
+
key: 0,
|
|
150
|
+
class: m(["w-5 h-5 flex-shrink-0", e.iconClass]),
|
|
151
|
+
style: X({ color: L.value })
|
|
152
|
+
}, null, 8, ["style", "class"])) : C("", !0),
|
|
153
|
+
r("span", ke, E(e.modelValue != null ? e.resolvers.getEntityLabel(e.modelValue) : e.labelSelect), 1),
|
|
154
|
+
e.readonly ? C("", !0) : (a(), o("button", {
|
|
155
|
+
key: 1,
|
|
156
|
+
type: "button",
|
|
157
|
+
class: "text-[#979CA9] hover:text-gray-700 flex-shrink-0 -mr-1",
|
|
158
|
+
"aria-label": e.changeLabel,
|
|
159
|
+
onClick: h[0] || (h[0] = Q(($) => e.modelValue != null ? s.$emit("clear") : g(), ["stop"]))
|
|
160
|
+
}, [
|
|
161
|
+
e.modelValue != null ? (a(), o("svg", Ce, [...h[2] || (h[2] = [
|
|
162
|
+
r("path", {
|
|
163
|
+
"stroke-linecap": "round",
|
|
164
|
+
"stroke-linejoin": "round",
|
|
165
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
166
|
+
}, null, -1)
|
|
167
|
+
])])) : (a(), o("svg", xe, [...h[3] || (h[3] = [
|
|
168
|
+
r("path", {
|
|
169
|
+
"stroke-linecap": "round",
|
|
170
|
+
"stroke-linejoin": "round",
|
|
171
|
+
d: "M19.5 8.25l-7.5 7.5-7.5-7.5"
|
|
172
|
+
}, null, -1)
|
|
173
|
+
])]))
|
|
174
|
+
], 8, Se))
|
|
175
|
+
], 6)
|
|
176
|
+
])
|
|
177
|
+
])) : (a(), o("div", {
|
|
178
|
+
key: 1,
|
|
179
|
+
class: m(["relative select-none", i.value ? "space-y-1.5" : "space-y-3"])
|
|
180
|
+
}, [
|
|
181
|
+
c(s.$slots, "button", {
|
|
182
|
+
title: e.title,
|
|
183
|
+
modelValue: e.modelValue,
|
|
184
|
+
openModal: g
|
|
185
|
+
}, () => [
|
|
186
|
+
e.title ? (a(), o("p", {
|
|
187
|
+
key: 0,
|
|
188
|
+
class: m(["font-semibold pb-0", e.labelClass])
|
|
189
|
+
}, E(e.title), 3)) : C("", !0),
|
|
190
|
+
r("div", {
|
|
191
|
+
class: m(["flex justify-between z-10 items-center", [
|
|
192
|
+
e.readonly ? "" : "cursor-pointer hover:bg-gray-50",
|
|
193
|
+
i.value ? ["rounded-full", b.value ? "bg-[#4089E01A]" : ""] : "border px-3 pr-3 py-3 rounded-lg h-[72px]",
|
|
194
|
+
y.value ? "border-none !py-0 h-max !rounded-full" : "",
|
|
195
|
+
y.value && e.modelValue !== null ? "bg-[#4089E01A]" : ""
|
|
196
|
+
]])
|
|
197
|
+
}, [
|
|
198
|
+
r("div", {
|
|
199
|
+
class: m(["flex items-center w-full gap-x-3", [i.value ? "!gap-x-1 px-0.5 py-0.5" : "", y.value ? "h-9 p-0" : ""]]),
|
|
200
|
+
onClick: g
|
|
201
|
+
}, [
|
|
202
|
+
!e.noIcon && (y.value || i.value || e.icon || e.modelValue) ? (a(), o("div", {
|
|
203
|
+
key: 0,
|
|
204
|
+
class: m(["w-10 h-10 flex items-center justify-center", e.iconClassBlock])
|
|
205
|
+
}, [
|
|
206
|
+
y.value ? (a(), o("div", Ee, [
|
|
207
|
+
e.modelValue == null ? (a(), o("svg", {
|
|
208
|
+
key: 0,
|
|
209
|
+
class: m(["w-3 text-blue-600", e.iconClass]),
|
|
210
|
+
fill: "none",
|
|
211
|
+
viewBox: "0 0 24 24",
|
|
212
|
+
stroke: "currentColor",
|
|
213
|
+
"stroke-width": "2"
|
|
214
|
+
}, [...h[4] || (h[4] = [
|
|
215
|
+
r("path", {
|
|
216
|
+
"stroke-linecap": "round",
|
|
217
|
+
"stroke-linejoin": "round",
|
|
218
|
+
d: "M12 4.5v15m7.5-7.5h-15"
|
|
219
|
+
}, null, -1)
|
|
220
|
+
])], 2)) : (a(), F(H(e.icon), {
|
|
221
|
+
key: 1,
|
|
222
|
+
class: m(["w-5", e.iconClass])
|
|
223
|
+
}, null, 8, ["class"]))
|
|
224
|
+
])) : e.icon != null && e.modelValue == null || i.value ? (a(), o("div", {
|
|
225
|
+
key: 1,
|
|
226
|
+
class: m(i.value ? "" : "bg-gray-50 p-2.5 rounded-lg")
|
|
227
|
+
}, [
|
|
228
|
+
(a(), F(H(e.icon), {
|
|
229
|
+
class: m([["w-5", e.iconClass], "text-gray-600"])
|
|
230
|
+
}, null, 8, ["class"]))
|
|
231
|
+
], 2)) : e.modelValue ? (a(), F(d(D), {
|
|
232
|
+
key: 2,
|
|
233
|
+
text: e.resolvers.getEntityLabel(e.modelValue),
|
|
234
|
+
src: e.resolvers.getEntityAvatar(e.modelValue),
|
|
235
|
+
rounded: !1,
|
|
236
|
+
size: "40",
|
|
237
|
+
class: "!rounded-lg"
|
|
238
|
+
}, null, 8, ["text", "src"])) : C("", !0)
|
|
239
|
+
], 2)) : C("", !0),
|
|
240
|
+
r("div", Le, [
|
|
241
|
+
e.modelValue == null ? (a(), o("div", $e, [
|
|
242
|
+
r("div", {
|
|
243
|
+
class: m(["font-medium text-gray-600 truncate overflow-hidden whitespace-nowrap", [
|
|
244
|
+
i.value ? "text-xs truncate max-w-[120px] text-[#525B66]" : "text-sm",
|
|
245
|
+
y.value ? "!text-xs truncate max-w-[120px] text-[#4089E0]" : ""
|
|
246
|
+
]])
|
|
247
|
+
}, E(e.labelSelect), 3),
|
|
248
|
+
e.labelSelectNote && !i.value && !y.value ? (a(), o("span", we, E(e.labelSelectNote), 1)) : C("", !0)
|
|
249
|
+
])) : (a(), o("div", {
|
|
250
|
+
key: 1,
|
|
251
|
+
class: m(["grid items-center pr-2", i.value ? "" : "py-1"])
|
|
252
|
+
}, [
|
|
253
|
+
r("div", {
|
|
254
|
+
class: m(["break-all leading-4 truncate !text-sm", {
|
|
255
|
+
"text-sm font-medium": e.resolvers.getEntityLabel(e.modelValue).length < 20,
|
|
256
|
+
"text-xs font-semibold": e.resolvers.getEntityLabel(e.modelValue).length > 20,
|
|
257
|
+
"truncate text-[#525B66] text-xs": i.value,
|
|
258
|
+
"truncate text-xs": y.value
|
|
259
|
+
}])
|
|
260
|
+
}, [
|
|
261
|
+
G(E(e.resolvers.getEntityLabel(e.modelValue)) + " ", 1),
|
|
262
|
+
!e.readonly && !i.value && !y.value ? (a(), o("span", Ve, E(e.changeLabel), 1)) : C("", !0)
|
|
263
|
+
], 2),
|
|
264
|
+
e.resolvers.getEntityAdditional(e.modelValue) ? (a(), o("div", {
|
|
265
|
+
key: 0,
|
|
266
|
+
class: m(["font-thin leading-3 break-all line-clamp-2 pt-1 truncate !text-xs", {
|
|
267
|
+
"text-xs": e.resolvers.getEntityAdditional(e.modelValue).length < 20,
|
|
268
|
+
"text-[10px]": e.resolvers.getEntityAdditional(e.modelValue).length > 20 && e.resolvers.getEntityAdditional(e.modelValue).length < 35,
|
|
269
|
+
"text-[9px]": e.resolvers.getEntityAdditional(e.modelValue).length > 35
|
|
270
|
+
}])
|
|
271
|
+
}, [
|
|
272
|
+
c(s.$slots, "entityAdditional", { item: e.modelValue }, () => [
|
|
273
|
+
G(E(e.resolvers.getEntityAdditional(e.modelValue)), 1)
|
|
274
|
+
])
|
|
275
|
+
], 2)) : C("", !0)
|
|
276
|
+
], 2))
|
|
277
|
+
])
|
|
278
|
+
], 2),
|
|
279
|
+
e.modelValue != null && !e.readonly ? (a(), o("button", {
|
|
280
|
+
key: 0,
|
|
281
|
+
type: "button",
|
|
282
|
+
class: m(["rounded-full hover:text-gray-900 text-gray-500", { "mr-2 text-[#525B66] p-0.5": i.value }]),
|
|
283
|
+
onClick: h[1] || (h[1] = Q(($) => s.$emit("clear"), ["stop"]))
|
|
284
|
+
}, [...h[5] || (h[5] = [
|
|
285
|
+
r("svg", {
|
|
286
|
+
class: "w-4 h-4",
|
|
287
|
+
fill: "none",
|
|
288
|
+
viewBox: "0 0 24 24",
|
|
289
|
+
stroke: "currentColor",
|
|
290
|
+
"stroke-width": "2"
|
|
291
|
+
}, [
|
|
292
|
+
r("path", {
|
|
293
|
+
"stroke-linecap": "round",
|
|
294
|
+
"stroke-linejoin": "round",
|
|
295
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
296
|
+
})
|
|
297
|
+
], -1)
|
|
298
|
+
])], 2)) : !e.readonly && !i.value && !y.value ? (a(), o("button", {
|
|
299
|
+
key: 1,
|
|
300
|
+
type: "button",
|
|
301
|
+
class: "py-2.5 text-gray-500",
|
|
302
|
+
onClick: g
|
|
303
|
+
}, [...h[6] || (h[6] = [
|
|
304
|
+
r("svg", {
|
|
305
|
+
class: "w-5 h-5",
|
|
306
|
+
fill: "none",
|
|
307
|
+
viewBox: "0 0 24 24",
|
|
308
|
+
stroke: "currentColor",
|
|
309
|
+
"stroke-width": "2"
|
|
310
|
+
}, [
|
|
311
|
+
r("path", {
|
|
312
|
+
"stroke-linecap": "round",
|
|
313
|
+
"stroke-linejoin": "round",
|
|
314
|
+
d: "M8.25 4.5l7.5 7.5-7.5 7.5"
|
|
315
|
+
})
|
|
316
|
+
], -1)
|
|
317
|
+
])])) : C("", !0)
|
|
318
|
+
], 2)
|
|
319
|
+
])
|
|
320
|
+
], 2));
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
function Ie(e) {
|
|
324
|
+
const l = (s) => s ? String(s[e.entityLabel] || "") : "", t = (s) => !s || !e.entityAvatar ? "" : String(s[e.entityAvatar] || ""), n = (s) => !s || !e.entityAdditional ? "" : String(s[e.entityAdditional] || ""), g = (s) => s ? s[e.entityKey] : "", i = (s) => s[e.entityListKey];
|
|
325
|
+
return {
|
|
326
|
+
getEntityLabel: l,
|
|
327
|
+
getEntityAvatar: t,
|
|
328
|
+
getEntityAdditional: n,
|
|
329
|
+
getEntityKey: g,
|
|
330
|
+
getEntityListKey: i,
|
|
331
|
+
getEntityListLabel: (s) => String(s[e.entityListLabel] || ""),
|
|
332
|
+
getEntityListAvatar: (s) => e.entityListAvatar ? String(s[e.entityListAvatar] || "") : "",
|
|
333
|
+
getEntityListAdditional: (s) => e.entityListAdditional ? String(s[e.entityListAdditional] || "") : "",
|
|
334
|
+
isSelected: (s) => g(e.modelValue) === i(s)
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
function Be(e, l) {
|
|
338
|
+
const t = e.listEntityUse ? e.listEntityUse() : null, n = t == null ? void 0 : t.nodes, g = t == null ? void 0 : t.load, i = t == null ? void 0 : t.searchTerm, b = t == null ? void 0 : t.isLoading, y = t == null ? void 0 : t.isLoad, f = t == null ? void 0 : t.group, L = I(null), s = S(() => (f == null ? void 0 : f.value) ?? L.value), h = (k) => {
|
|
339
|
+
f ? f.value = k : L.value = k;
|
|
340
|
+
}, $ = I(""), T = S({
|
|
341
|
+
get: () => (i == null ? void 0 : i.value) ?? $.value,
|
|
342
|
+
set: (k) => {
|
|
343
|
+
i ? i.value = k : $.value = k;
|
|
344
|
+
}
|
|
345
|
+
}), O = () => {
|
|
346
|
+
$.value = "", i && (i.value = "");
|
|
347
|
+
}, P = S(() => (b == null ? void 0 : b.value) ?? e.isLoading), z = S(() => (n == null ? void 0 : n.value) ?? e.items), u = S(() => {
|
|
348
|
+
const k = z.value;
|
|
349
|
+
if (e.modelValue == null)
|
|
350
|
+
return k;
|
|
351
|
+
const B = l.getEntityKey(e.modelValue);
|
|
352
|
+
return k.some(
|
|
353
|
+
(w) => l.getEntityListKey(w) === B
|
|
354
|
+
) ? k : [e.modelValue, ...k];
|
|
355
|
+
}), j = S(() => {
|
|
356
|
+
if (!T.value)
|
|
357
|
+
return u.value;
|
|
358
|
+
const k = T.value.toLowerCase(), B = e.modelValue != null ? l.getEntityKey(e.modelValue) : null;
|
|
359
|
+
return u.value.filter((V) => {
|
|
360
|
+
if (B != null && l.getEntityListKey(V) === B)
|
|
361
|
+
return !0;
|
|
362
|
+
const w = l.getEntityListLabel(V).toLowerCase(), K = l.getEntityListAdditional(V).toLowerCase();
|
|
363
|
+
return w.includes(k) || K.includes(k);
|
|
364
|
+
});
|
|
365
|
+
}), W = S(() => {
|
|
366
|
+
const k = j.value;
|
|
367
|
+
if (e.modelValue == null)
|
|
368
|
+
return k;
|
|
369
|
+
const B = l.getEntityKey(e.modelValue), V = k.findIndex(
|
|
370
|
+
(N) => l.getEntityListKey(N) === B
|
|
371
|
+
);
|
|
372
|
+
if (V <= 0)
|
|
373
|
+
return k;
|
|
374
|
+
const w = k.slice(), [K] = w.splice(V, 1);
|
|
375
|
+
return w.unshift(K), w;
|
|
376
|
+
});
|
|
377
|
+
return {
|
|
378
|
+
// dynamic data hooks (exposed for modal lifecycle watchers)
|
|
379
|
+
load: g,
|
|
380
|
+
dynamicIsLoad: y,
|
|
381
|
+
nodes: n,
|
|
382
|
+
// search
|
|
383
|
+
searchTerm: T,
|
|
384
|
+
clearSearchTerm: O,
|
|
385
|
+
// group selection (for prepend slot)
|
|
386
|
+
selectedGroup: s,
|
|
387
|
+
setSelectedGroup: h,
|
|
388
|
+
// items pipeline
|
|
389
|
+
rawItems: z,
|
|
390
|
+
availableItems: u,
|
|
391
|
+
filteredItems: j,
|
|
392
|
+
sortedItems: W,
|
|
393
|
+
// state
|
|
394
|
+
loading: P
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
function Me(e, l, t) {
|
|
398
|
+
const n = ce(), g = I(null), i = I(!1), b = I(null), y = I(!1), f = I(e.modalSize), L = I(!1);
|
|
399
|
+
let s = null;
|
|
400
|
+
ne(() => {
|
|
401
|
+
s = window.matchMedia("(max-width: 767px)"), L.value = s.matches;
|
|
402
|
+
const u = (j) => {
|
|
403
|
+
L.value = j.matches;
|
|
404
|
+
};
|
|
405
|
+
s.addEventListener("change", u), ae(() => {
|
|
406
|
+
s == null || s.removeEventListener("change", u);
|
|
407
|
+
});
|
|
408
|
+
});
|
|
409
|
+
const h = () => {
|
|
410
|
+
e.readonly || (l.clearSearchTerm(), i.value = !1, b.value = null, y.value = !1, f.value = e.modalSize, n.open(), ie(() => {
|
|
411
|
+
var u;
|
|
412
|
+
(u = g.value) == null || u.focus();
|
|
413
|
+
}));
|
|
414
|
+
}, $ = (u) => {
|
|
415
|
+
t("update:modelValue", u), n.close();
|
|
416
|
+
}, T = () => {
|
|
417
|
+
t("update:modelValue", null);
|
|
418
|
+
}, O = () => {
|
|
419
|
+
i.value = !0, f.value = e.sizeModalCreateEntity;
|
|
420
|
+
}, P = (u) => {
|
|
421
|
+
b.value = u, f.value = e.sizeModalCreateEntity;
|
|
422
|
+
}, z = (u) => {
|
|
423
|
+
i.value = !1, b.value = null, y.value = !1, f.value = e.modalSize, u ? (n.close(), t("update:modelValue", u)) : !l.loading.value && l.availableItems.value.length === 0 && !l.searchTerm.value && n.close();
|
|
424
|
+
};
|
|
425
|
+
return Y(n.isOpened, (u) => {
|
|
426
|
+
u && l.load && l.load(), u || (i.value = !1, f.value = e.modalSize);
|
|
427
|
+
}), Y(
|
|
428
|
+
() => {
|
|
429
|
+
var u;
|
|
430
|
+
return (u = l.dynamicIsLoad) == null ? void 0 : u.value;
|
|
431
|
+
},
|
|
432
|
+
() => {
|
|
433
|
+
var u;
|
|
434
|
+
l.dynamicIsLoad && !l.loading.value && l.dynamicIsLoad.value && !l.searchTerm.value && ((u = l.nodes) == null ? void 0 : u.value.length) === 0 && (y.value = !0, f.value = e.sizeModalCreateEntity);
|
|
435
|
+
}
|
|
436
|
+
), {
|
|
437
|
+
modal: n,
|
|
438
|
+
searchInput: g,
|
|
439
|
+
creatingEntity: i,
|
|
440
|
+
editEntity: b,
|
|
441
|
+
startCreate: y,
|
|
442
|
+
currentModalSize: f,
|
|
443
|
+
isMobileView: L,
|
|
444
|
+
openPicker: h,
|
|
445
|
+
selectItem: $,
|
|
446
|
+
onClear: T,
|
|
447
|
+
onCreateEntity: O,
|
|
448
|
+
onEditEntity: P,
|
|
449
|
+
onCloseCreateEntity: z
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
const Te = { class: "relative px-4 pt-3 pb-2" }, ze = { class: "relative" }, qe = ["value", "placeholder"], je = /* @__PURE__ */ M({
|
|
453
|
+
__name: "EntityPickerSearch",
|
|
454
|
+
props: {
|
|
455
|
+
modelValue: {
|
|
456
|
+
type: String,
|
|
457
|
+
default: ""
|
|
458
|
+
},
|
|
459
|
+
placeholder: {
|
|
460
|
+
type: String,
|
|
461
|
+
default: ""
|
|
462
|
+
}
|
|
463
|
+
},
|
|
464
|
+
emits: ["update:modelValue"],
|
|
465
|
+
setup(e, { expose: l, emit: t }) {
|
|
466
|
+
const n = t, g = I(null), i = (b) => {
|
|
467
|
+
n("update:modelValue", b.target.value);
|
|
468
|
+
};
|
|
469
|
+
return l({
|
|
470
|
+
focus: () => {
|
|
471
|
+
var b;
|
|
472
|
+
return (b = g.value) == null ? void 0 : b.focus();
|
|
473
|
+
}
|
|
474
|
+
}), (b, y) => (a(), o("div", Te, [
|
|
475
|
+
r("div", ze, [
|
|
476
|
+
y[0] || (y[0] = r("svg", {
|
|
477
|
+
class: "absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-[#979CA9]",
|
|
478
|
+
fill: "none",
|
|
479
|
+
viewBox: "0 0 24 24",
|
|
480
|
+
stroke: "currentColor",
|
|
481
|
+
"stroke-width": "2"
|
|
482
|
+
}, [
|
|
483
|
+
r("path", {
|
|
484
|
+
"stroke-linecap": "round",
|
|
485
|
+
"stroke-linejoin": "round",
|
|
486
|
+
d: "M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z"
|
|
487
|
+
})
|
|
488
|
+
], -1)),
|
|
489
|
+
r("input", {
|
|
490
|
+
ref_key: "inputRef",
|
|
491
|
+
ref: g,
|
|
492
|
+
value: e.modelValue,
|
|
493
|
+
type: "text",
|
|
494
|
+
class: "w-full h-10 pl-11 pr-3 border border-[#E2E7EF] rounded-[10px] text-sm placeholder:text-[#979CA9] focus:outline-none focus:ring-2 focus:ring-primary-base focus:border-transparent",
|
|
495
|
+
placeholder: e.placeholder,
|
|
496
|
+
onInput: i
|
|
497
|
+
}, null, 40, qe)
|
|
498
|
+
])
|
|
499
|
+
]));
|
|
500
|
+
}
|
|
501
|
+
}), Fe = { class: "px-3 pb-2" }, Oe = { class: "text-xs font-semibold tracking-[0.4px]" }, Pe = /* @__PURE__ */ M({
|
|
502
|
+
__name: "EntityPickerCreateButton",
|
|
503
|
+
props: {
|
|
504
|
+
label: { type: String, required: !0 }
|
|
505
|
+
},
|
|
506
|
+
emits: ["click"],
|
|
507
|
+
setup(e) {
|
|
508
|
+
return (l, t) => (a(), o("div", Fe, [
|
|
509
|
+
r("button", {
|
|
510
|
+
type: "button",
|
|
511
|
+
class: "w-full h-10 flex items-center justify-center gap-2 bg-[#FAFAFA] border border-[#E3ECF2] rounded-[10px] text-[#4089E0] hover:bg-[#F2F4F8] hover:border-[#D6DDE7] transition-colors",
|
|
512
|
+
onClick: t[0] || (t[0] = (n) => l.$emit("click"))
|
|
513
|
+
}, [
|
|
514
|
+
t[1] || (t[1] = r("svg", {
|
|
515
|
+
class: "w-4 h-4",
|
|
516
|
+
fill: "none",
|
|
517
|
+
viewBox: "0 0 24 24",
|
|
518
|
+
stroke: "currentColor",
|
|
519
|
+
"stroke-width": "2"
|
|
520
|
+
}, [
|
|
521
|
+
r("path", {
|
|
522
|
+
"stroke-linecap": "round",
|
|
523
|
+
"stroke-linejoin": "round",
|
|
524
|
+
d: "M12 4.5v15m7.5-7.5h-15"
|
|
525
|
+
})
|
|
526
|
+
], -1)),
|
|
527
|
+
r("span", Oe, E(e.label), 1)
|
|
528
|
+
])
|
|
529
|
+
]));
|
|
530
|
+
}
|
|
531
|
+
}), Ke = {
|
|
532
|
+
key: 0,
|
|
533
|
+
class: "flex items-center justify-center w-8 h-8 flex-shrink-0"
|
|
534
|
+
}, Ne = {
|
|
535
|
+
key: 0,
|
|
536
|
+
class: "w-5 h-5 rounded-full bg-[#4089E0] flex items-center justify-center"
|
|
537
|
+
}, Ue = {
|
|
538
|
+
key: 1,
|
|
539
|
+
class: "w-4 h-4 text-[#525B66]",
|
|
58
540
|
fill: "none",
|
|
59
541
|
viewBox: "0 0 24 24",
|
|
60
542
|
stroke: "currentColor",
|
|
61
543
|
"stroke-width": "2"
|
|
62
|
-
},
|
|
544
|
+
}, Re = /* @__PURE__ */ M({
|
|
545
|
+
__name: "EntityPickerIndicator",
|
|
546
|
+
props: {
|
|
547
|
+
variant: {
|
|
548
|
+
type: String,
|
|
549
|
+
default: "check"
|
|
550
|
+
},
|
|
551
|
+
selected: {
|
|
552
|
+
type: Boolean,
|
|
553
|
+
default: !1
|
|
554
|
+
}
|
|
555
|
+
},
|
|
556
|
+
setup(e) {
|
|
557
|
+
return (l, t) => e.variant !== "none" ? (a(), o("div", Ke, [
|
|
558
|
+
e.selected ? (a(), o("span", Ne, [...t[0] || (t[0] = [
|
|
559
|
+
r("svg", {
|
|
560
|
+
class: "w-3 h-3 text-white",
|
|
561
|
+
fill: "none",
|
|
562
|
+
viewBox: "0 0 24 24",
|
|
563
|
+
stroke: "currentColor",
|
|
564
|
+
"stroke-width": "3"
|
|
565
|
+
}, [
|
|
566
|
+
r("path", {
|
|
567
|
+
"stroke-linecap": "round",
|
|
568
|
+
"stroke-linejoin": "round",
|
|
569
|
+
d: "M4.5 12.75l6 6 9-13.5"
|
|
570
|
+
})
|
|
571
|
+
], -1)
|
|
572
|
+
])])) : e.variant === "navigation" ? (a(), o("svg", Ue, [...t[1] || (t[1] = [
|
|
573
|
+
r("path", {
|
|
574
|
+
"stroke-linecap": "round",
|
|
575
|
+
"stroke-linejoin": "round",
|
|
576
|
+
d: "M8.25 4.5l7.5 7.5-7.5 7.5"
|
|
577
|
+
}, null, -1)
|
|
578
|
+
])])) : C("", !0)
|
|
579
|
+
])) : C("", !0);
|
|
580
|
+
}
|
|
581
|
+
}), Ge = { class: "flex-1 min-w-0" }, We = /* @__PURE__ */ M({
|
|
582
|
+
__name: "EntityPickerListItem",
|
|
583
|
+
props: {
|
|
584
|
+
selected: { type: Boolean, default: !1 },
|
|
585
|
+
title: { type: String, default: "" },
|
|
586
|
+
subtitle: { type: String, default: "" },
|
|
587
|
+
avatarText: { type: String, default: "" },
|
|
588
|
+
avatarSrc: { type: String, default: "" },
|
|
589
|
+
avatarSize: { type: [String, Number], default: 40 },
|
|
590
|
+
iconWrapperClass: { type: String, default: "" },
|
|
591
|
+
itemClass: { type: String, default: "" },
|
|
592
|
+
titleClass: { type: String, default: "" },
|
|
593
|
+
subtitleClass: { type: String, default: "" },
|
|
594
|
+
indicator: {
|
|
595
|
+
type: String,
|
|
596
|
+
default: "check"
|
|
597
|
+
},
|
|
598
|
+
showEdit: { type: Boolean, default: !1 },
|
|
599
|
+
editLabel: { type: String, default: "" }
|
|
600
|
+
},
|
|
601
|
+
emits: ["select", "edit"],
|
|
602
|
+
setup(e) {
|
|
603
|
+
return (l, t) => (a(), o("div", {
|
|
604
|
+
class: m(["flex items-center gap-3 py-3 px-4 hover:bg-secondary-body-hover cursor-pointer", [{ "bg-gray-50": e.selected }, e.itemClass]]),
|
|
605
|
+
onClick: t[1] || (t[1] = (n) => l.$emit("select"))
|
|
606
|
+
}, [
|
|
607
|
+
r("div", {
|
|
608
|
+
class: m(["flex-shrink-0", e.iconWrapperClass])
|
|
609
|
+
}, [
|
|
610
|
+
c(l.$slots, "icon", {}, () => [
|
|
611
|
+
q(d(D), {
|
|
612
|
+
text: e.avatarText,
|
|
613
|
+
src: e.avatarSrc,
|
|
614
|
+
rounded: !1,
|
|
615
|
+
size: String(e.avatarSize),
|
|
616
|
+
class: "!rounded-[10px]"
|
|
617
|
+
}, null, 8, ["text", "src", "size"])
|
|
618
|
+
])
|
|
619
|
+
], 2),
|
|
620
|
+
r("div", Ge, [
|
|
621
|
+
r("p", {
|
|
622
|
+
class: m(e.titleClass)
|
|
623
|
+
}, E(e.title), 3),
|
|
624
|
+
e.subtitle ? (a(), o("div", {
|
|
625
|
+
key: 0,
|
|
626
|
+
class: m(e.subtitleClass)
|
|
627
|
+
}, [
|
|
628
|
+
c(l.$slots, "additional", {}, () => [
|
|
629
|
+
G(E(e.subtitle), 1)
|
|
630
|
+
])
|
|
631
|
+
], 2)) : C("", !0)
|
|
632
|
+
]),
|
|
633
|
+
e.showEdit ? (a(), o("button", {
|
|
634
|
+
key: 0,
|
|
635
|
+
type: "button",
|
|
636
|
+
class: "text-xs font-semibold text-[#4089E0] hover:text-primary-active flex-shrink-0 tracking-[0.4px]",
|
|
637
|
+
onClick: t[0] || (t[0] = Q((n) => l.$emit("edit"), ["stop"]))
|
|
638
|
+
}, E(e.editLabel), 1)) : C("", !0),
|
|
639
|
+
q(Re, {
|
|
640
|
+
variant: e.indicator,
|
|
641
|
+
selected: e.selected
|
|
642
|
+
}, null, 8, ["variant", "selected"])
|
|
643
|
+
], 2));
|
|
644
|
+
}
|
|
645
|
+
}), He = {
|
|
646
|
+
key: 0,
|
|
647
|
+
class: "flex items-center justify-center py-8"
|
|
648
|
+
}, Qe = {
|
|
63
649
|
key: 1,
|
|
650
|
+
class: "relative px-5 py-10 text-center"
|
|
651
|
+
}, Je = { class: "mb-4 text-sm text-gray-500" }, Xe = {
|
|
652
|
+
key: 2,
|
|
653
|
+
class: "p-3 text-center mt-6"
|
|
654
|
+
}, Ye = { class: "text-xs" }, Ze = /* @__PURE__ */ M({
|
|
655
|
+
__name: "EntityPickerList",
|
|
656
|
+
props: {
|
|
657
|
+
loading: { type: Boolean, default: !1 },
|
|
658
|
+
items: { type: Array, default: () => [] },
|
|
659
|
+
searchTerm: { type: String, default: "" },
|
|
660
|
+
// scroll container height — applied as Tailwind class(es)
|
|
661
|
+
scrollHeightClass: {
|
|
662
|
+
type: [String, Object],
|
|
663
|
+
default: ""
|
|
664
|
+
},
|
|
665
|
+
resolvers: { type: Object, required: !0 },
|
|
666
|
+
// copy
|
|
667
|
+
emptyMessage: { type: String, default: "" },
|
|
668
|
+
notFoundLabel: { type: String, default: "" },
|
|
669
|
+
createWithQueryLabel: { type: String, default: "" },
|
|
670
|
+
canCreate: { type: Boolean, default: !1 },
|
|
671
|
+
// per-item appearance
|
|
672
|
+
itemSize: { type: [String, Number], default: 40 },
|
|
673
|
+
itemIconClass: { type: String, default: "" },
|
|
674
|
+
itemTitleClass: { type: String, default: "" },
|
|
675
|
+
itemSubtitleClass: { type: String, default: "" },
|
|
676
|
+
itemIndicator: {
|
|
677
|
+
type: String,
|
|
678
|
+
default: "check"
|
|
679
|
+
},
|
|
680
|
+
canEdit: { type: Boolean, default: !1 },
|
|
681
|
+
editLabel: { type: String, default: "" }
|
|
682
|
+
},
|
|
683
|
+
emits: ["select", "edit", "create"],
|
|
684
|
+
setup(e) {
|
|
685
|
+
return (l, t) => (a(), o("div", {
|
|
686
|
+
class: m(["divide-y divide-[#E3ECF2] overflow-auto", e.scrollHeightClass])
|
|
687
|
+
}, [
|
|
688
|
+
e.loading ? (a(), o("div", He, [...t[1] || (t[1] = [
|
|
689
|
+
r("div", { class: "animate-spin w-6 h-6 border-2 border-primary-base border-t-transparent rounded-full" }, null, -1)
|
|
690
|
+
])])) : e.items.length === 0 && !e.searchTerm ? (a(), o("div", Qe, [
|
|
691
|
+
c(l.$slots, "empty", {}, () => [
|
|
692
|
+
r("p", Je, E(e.emptyMessage), 1)
|
|
693
|
+
])
|
|
694
|
+
])) : e.items.length === 0 && e.searchTerm ? (a(), o("div", Xe, [
|
|
695
|
+
r("p", Ye, [
|
|
696
|
+
G(E(e.notFoundLabel) + " ", 1),
|
|
697
|
+
r("b", null, E(e.searchTerm), 1)
|
|
698
|
+
]),
|
|
699
|
+
e.canCreate ? (a(), o("button", {
|
|
700
|
+
key: 0,
|
|
701
|
+
type: "button",
|
|
702
|
+
class: "w-full text-xs text-blue-400 hover:text-blue-300 mt-2",
|
|
703
|
+
onClick: t[0] || (t[0] = (n) => l.$emit("create"))
|
|
704
|
+
}, E(e.createWithQueryLabel), 1)) : C("", !0)
|
|
705
|
+
])) : (a(!0), o(Z, { key: 3 }, se(e.items, (n) => (a(), F(We, {
|
|
706
|
+
key: e.resolvers.getEntityListKey(n),
|
|
707
|
+
selected: e.resolvers.isSelected(n),
|
|
708
|
+
title: e.resolvers.getEntityListLabel(n),
|
|
709
|
+
subtitle: e.resolvers.getEntityListAdditional(n),
|
|
710
|
+
"avatar-text": e.resolvers.getEntityListLabel(n),
|
|
711
|
+
"avatar-src": e.resolvers.getEntityListAvatar(n),
|
|
712
|
+
"avatar-size": e.itemSize,
|
|
713
|
+
"icon-wrapper-class": e.itemIconClass,
|
|
714
|
+
"title-class": e.itemTitleClass,
|
|
715
|
+
"subtitle-class": e.itemSubtitleClass,
|
|
716
|
+
indicator: e.itemIndicator,
|
|
717
|
+
"show-edit": e.resolvers.isSelected(n) && e.canEdit,
|
|
718
|
+
"edit-label": e.editLabel,
|
|
719
|
+
onSelect: (g) => l.$emit("select", n),
|
|
720
|
+
onEdit: (g) => l.$emit("edit", e.resolvers.getEntityKey(n))
|
|
721
|
+
}, R({ _: 2 }, [
|
|
722
|
+
l.$slots.itemIcon ? {
|
|
723
|
+
name: "icon",
|
|
724
|
+
fn: x(() => [
|
|
725
|
+
c(l.$slots, "itemIcon", { item: n })
|
|
726
|
+
]),
|
|
727
|
+
key: "0"
|
|
728
|
+
} : void 0,
|
|
729
|
+
l.$slots.itemAdditional ? {
|
|
730
|
+
name: "additional",
|
|
731
|
+
fn: x(() => [
|
|
732
|
+
c(l.$slots, "itemAdditional", { item: n })
|
|
733
|
+
]),
|
|
734
|
+
key: "1"
|
|
735
|
+
} : void 0
|
|
736
|
+
]), 1032, ["selected", "title", "subtitle", "avatar-text", "avatar-src", "avatar-size", "icon-wrapper-class", "title-class", "subtitle-class", "indicator", "show-edit", "edit-label", "onSelect", "onEdit"]))), 128))
|
|
737
|
+
], 2));
|
|
738
|
+
}
|
|
739
|
+
}), De = {
|
|
740
|
+
key: 0,
|
|
64
741
|
class: "text-xs px-2 py-1 text-red-600"
|
|
65
|
-
},
|
|
742
|
+
}, pe = "text-sm font-semibold text-black truncate leading-5 tracking-[0.4px]", _e = "text-xs text-[#979CA9] font-normal leading-5 truncate tracking-[0.4px]", rt = /* @__PURE__ */ M({
|
|
66
743
|
__name: "OneEntityPicker",
|
|
67
744
|
props: {
|
|
68
745
|
t: {
|
|
@@ -189,13 +866,71 @@ const Me = { key: 0 }, Ae = { class: "" }, qe = {
|
|
|
189
866
|
type: Boolean,
|
|
190
867
|
default: !1
|
|
191
868
|
},
|
|
192
|
-
//
|
|
869
|
+
// Trigger variant
|
|
193
870
|
variant: {
|
|
194
871
|
type: String,
|
|
195
872
|
default: "default",
|
|
196
|
-
validator: (
|
|
873
|
+
validator: (e) => ["default", "compact", "minimal", "pill", "tag"].includes(e)
|
|
874
|
+
},
|
|
875
|
+
tagColor: {
|
|
876
|
+
type: String,
|
|
877
|
+
default: "#525B66"
|
|
878
|
+
},
|
|
879
|
+
// ───── Modal customization ─────
|
|
880
|
+
modalTitle: {
|
|
881
|
+
required: !1,
|
|
882
|
+
type: String,
|
|
883
|
+
default: ""
|
|
884
|
+
},
|
|
885
|
+
modalSubtitle: {
|
|
886
|
+
required: !1,
|
|
887
|
+
type: String,
|
|
888
|
+
default: ""
|
|
889
|
+
},
|
|
890
|
+
modalTitlePosition: {
|
|
891
|
+
required: !1,
|
|
892
|
+
type: String,
|
|
893
|
+
default: "left",
|
|
894
|
+
validator: (e) => ["left", "center"].includes(e)
|
|
895
|
+
},
|
|
896
|
+
modalSize: {
|
|
897
|
+
required: !1,
|
|
898
|
+
type: String,
|
|
899
|
+
default: "sm"
|
|
900
|
+
},
|
|
901
|
+
searchPlaceholder: {
|
|
902
|
+
required: !1,
|
|
903
|
+
type: String,
|
|
904
|
+
default: ""
|
|
905
|
+
},
|
|
906
|
+
// ───── List item appearance ─────
|
|
907
|
+
listItemIndicator: {
|
|
908
|
+
required: !1,
|
|
909
|
+
type: String,
|
|
910
|
+
default: "check",
|
|
911
|
+
validator: (e) => ["check", "navigation", "none"].includes(e)
|
|
912
|
+
},
|
|
913
|
+
listItemSize: {
|
|
914
|
+
required: !1,
|
|
915
|
+
type: [String, Number],
|
|
916
|
+
default: 40
|
|
917
|
+
},
|
|
918
|
+
listItemIconClass: {
|
|
919
|
+
required: !1,
|
|
920
|
+
type: String,
|
|
921
|
+
default: ""
|
|
922
|
+
},
|
|
923
|
+
listItemTitleClass: {
|
|
924
|
+
required: !1,
|
|
925
|
+
type: String,
|
|
926
|
+
default: ""
|
|
927
|
+
},
|
|
928
|
+
listItemSubtitleClass: {
|
|
929
|
+
required: !1,
|
|
930
|
+
type: String,
|
|
931
|
+
default: ""
|
|
197
932
|
},
|
|
198
|
-
//
|
|
933
|
+
// ───── Misc ─────
|
|
199
934
|
noCreate: {
|
|
200
935
|
type: Boolean,
|
|
201
936
|
default: !1
|
|
@@ -215,361 +950,199 @@ const Me = { key: 0 }, Ae = { class: "" }, qe = {
|
|
|
215
950
|
listEmptyMessage: {
|
|
216
951
|
type: String,
|
|
217
952
|
default: ""
|
|
953
|
+
},
|
|
954
|
+
editButtonLabel: {
|
|
955
|
+
type: String,
|
|
956
|
+
default: ""
|
|
218
957
|
}
|
|
219
958
|
},
|
|
220
959
|
emits: ["update:modelValue", "onSetEntity"],
|
|
221
|
-
setup(
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
960
|
+
setup(e, { emit: l }) {
|
|
961
|
+
const t = ye(), n = e, g = l, i = S(() => n.t ?? t), b = Ie(n), y = Be(n, b), { searchTerm: f, selectedGroup: L, setSelectedGroup: s, sortedItems: h, loading: $ } = y, {
|
|
962
|
+
modal: T,
|
|
963
|
+
searchInput: O,
|
|
964
|
+
creatingEntity: P,
|
|
965
|
+
editEntity: z,
|
|
966
|
+
startCreate: u,
|
|
967
|
+
currentModalSize: j,
|
|
968
|
+
isMobileView: W,
|
|
969
|
+
openPicker: k,
|
|
970
|
+
selectItem: B,
|
|
971
|
+
onClear: V,
|
|
972
|
+
onCreateEntity: w,
|
|
973
|
+
onEditEntity: K,
|
|
974
|
+
onCloseCreateEntity: N
|
|
975
|
+
} = Me(n, y, g), p = S(
|
|
976
|
+
() => n.modalTitle || i.value("ui.entity_picker.Select")
|
|
977
|
+
), _ = S(
|
|
978
|
+
() => n.listItemTitleClass || pe
|
|
979
|
+
), ee = S(
|
|
980
|
+
() => n.listItemSubtitleClass || _e
|
|
981
|
+
), te = S(
|
|
982
|
+
() => n.noSearch ? "sm:h-[52vh] h-[86dvh] min-h-[300px]" : "sm:h-[40vh] h-[60dvh]"
|
|
983
|
+
), le = S(() => P.value || u.value ? "create" : z.value ? "edit" : "browse"), J = S(() => {
|
|
984
|
+
const v = [];
|
|
985
|
+
return n.validation == null || n.validationIndex == null || Object.keys(n.validation).forEach((U) => {
|
|
986
|
+
U.startsWith(n.validationIndex) && v.push(...n.validation[U]);
|
|
987
|
+
}), v;
|
|
232
988
|
});
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
"stroke-linejoin": "round",
|
|
317
|
-
d: "M12 4.5v15m7.5-7.5h-15"
|
|
318
|
-
}, null, -1)
|
|
319
|
-
])], 2)) : (l(), $(ne(P.value), {
|
|
320
|
-
key: 1,
|
|
321
|
-
class: u(["w-5", t.iconClass])
|
|
322
|
-
}, null, 8, ["class"]))
|
|
323
|
-
])) : P.value != null && t.modelValue == null || y.value ? (l(), a("div", {
|
|
324
|
-
key: 1,
|
|
325
|
-
class: u(y.value ? "" : "bg-gray-50 p-2.5 rounded-lg")
|
|
326
|
-
}, [
|
|
327
|
-
(l(), $(ne(P.value), {
|
|
328
|
-
class: u([["w-5", t.iconClass], "text-gray-600"])
|
|
329
|
-
}, null, 8, ["class"]))
|
|
330
|
-
], 2)) : t.modelValue ? (l(), $(V(se), {
|
|
331
|
-
key: 2,
|
|
332
|
-
text: j(t.modelValue),
|
|
333
|
-
src: ve(t.modelValue),
|
|
334
|
-
rounded: !1,
|
|
335
|
-
size: "40",
|
|
336
|
-
class: "!rounded-lg"
|
|
337
|
-
}, null, 8, ["text", "src"])) : c("", !0)
|
|
338
|
-
], 2)),
|
|
339
|
-
s("div", Ae, [
|
|
340
|
-
t.modelValue == null ? (l(), a("div", qe, [
|
|
341
|
-
s("div", {
|
|
342
|
-
class: u(["font-medium text-gray-600 truncate overflow-hidden whitespace-nowrap", [
|
|
343
|
-
y.value ? "text-xs truncate max-w-[120px] text-[#525B66]" : "text-sm",
|
|
344
|
-
x.value ? "!text-xs truncate max-w-[120px] text-[#4089E0]" : ""
|
|
345
|
-
]])
|
|
346
|
-
}, d(t.labelSelect), 3),
|
|
347
|
-
t.labelSelectNote && !y.value && !x.value ? (l(), a("span", je, d(t.labelSelectNote), 1)) : c("", !0)
|
|
348
|
-
])) : (l(), a("div", {
|
|
349
|
-
key: 1,
|
|
350
|
-
class: u(["grid items-center pr-2", y.value ? "" : "py-1"])
|
|
351
|
-
}, [
|
|
352
|
-
s("div", {
|
|
353
|
-
class: u(["break-all leading-4 truncate !text-sm", {
|
|
354
|
-
"text-sm font-medium": j(t.modelValue).length < 20,
|
|
355
|
-
"text-xs font-semibold": j(t.modelValue).length > 20,
|
|
356
|
-
"truncate text-[#525B66] text-xs": y.value,
|
|
357
|
-
"truncate text-xs": x.value
|
|
358
|
-
}])
|
|
359
|
-
}, [
|
|
360
|
-
z(d(j(t.modelValue)) + " ", 1),
|
|
361
|
-
!t.readonly && !y.value && !x.value ? (l(), a("span", $e, d(b.value("ui.entity_picker.Change")), 1)) : c("", !0)
|
|
362
|
-
], 2),
|
|
363
|
-
E(t.modelValue) ? (l(), a("div", {
|
|
364
|
-
key: 0,
|
|
365
|
-
class: u(["font-thin leading-3 break-all line-clamp-2 pt-1 truncate !text-xs", {
|
|
366
|
-
"text-xs": E(t.modelValue).length < 20,
|
|
367
|
-
"text-[10px]": E(t.modelValue).length > 20 && E(t.modelValue).length < 35,
|
|
368
|
-
"text-[9px]": E(t.modelValue).length > 35
|
|
369
|
-
}])
|
|
370
|
-
}, [
|
|
371
|
-
m(e.$slots, "entityAdditional", { item: t.modelValue }, () => [
|
|
372
|
-
z(d(E(t.modelValue)), 1)
|
|
373
|
-
])
|
|
374
|
-
], 2)) : c("", !0)
|
|
375
|
-
], 2))
|
|
376
|
-
])
|
|
377
|
-
], 2),
|
|
378
|
-
t.modelValue != null && !t.readonly ? (l(), a("button", {
|
|
379
|
-
key: 0,
|
|
380
|
-
type: "button",
|
|
381
|
-
onClick: ae(xe, ["stop"]),
|
|
382
|
-
class: u(["rounded-full hover:text-gray-900 text-gray-500", { "mr-2 text-[#525B66] p-0.5": y.value }])
|
|
383
|
-
}, [...o[2] || (o[2] = [
|
|
384
|
-
s("svg", {
|
|
385
|
-
class: "w-4 h-4",
|
|
386
|
-
fill: "none",
|
|
387
|
-
viewBox: "0 0 24 24",
|
|
388
|
-
stroke: "currentColor",
|
|
389
|
-
"stroke-width": "2"
|
|
390
|
-
}, [
|
|
391
|
-
s("path", {
|
|
392
|
-
"stroke-linecap": "round",
|
|
393
|
-
"stroke-linejoin": "round",
|
|
394
|
-
d: "M6 18L18 6M6 6l12 12"
|
|
395
|
-
})
|
|
396
|
-
], -1)
|
|
397
|
-
])], 2)) : !t.readonly && !y.value && !x.value ? (l(), a("button", {
|
|
398
|
-
key: 1,
|
|
399
|
-
type: "button",
|
|
400
|
-
class: "py-2.5 text-gray-500",
|
|
401
|
-
onClick: _
|
|
402
|
-
}, [...o[3] || (o[3] = [
|
|
403
|
-
s("svg", {
|
|
404
|
-
class: "w-5 h-5",
|
|
405
|
-
fill: "none",
|
|
406
|
-
viewBox: "0 0 24 24",
|
|
407
|
-
stroke: "currentColor",
|
|
408
|
-
"stroke-width": "2"
|
|
409
|
-
}, [
|
|
410
|
-
s("path", {
|
|
411
|
-
"stroke-linecap": "round",
|
|
412
|
-
"stroke-linejoin": "round",
|
|
413
|
-
d: "M8.25 4.5l7.5 7.5-7.5 7.5"
|
|
989
|
+
return (v, U) => (a(), o(Z, null, [
|
|
990
|
+
q(Ae, {
|
|
991
|
+
variant: e.variant,
|
|
992
|
+
"model-value": e.modelValue,
|
|
993
|
+
icon: e.icon,
|
|
994
|
+
title: e.title,
|
|
995
|
+
"label-select": e.labelSelect,
|
|
996
|
+
"label-select-note": e.labelSelectNote,
|
|
997
|
+
"label-class": e.labelClass,
|
|
998
|
+
"icon-class": e.iconClass,
|
|
999
|
+
"icon-class-block": e.iconClassBlock,
|
|
1000
|
+
"no-icon": e.noIcon,
|
|
1001
|
+
readonly: e.readonly,
|
|
1002
|
+
"tag-color": e.tagColor,
|
|
1003
|
+
"change-label": i.value("ui.entity_picker.Change"),
|
|
1004
|
+
resolvers: d(b),
|
|
1005
|
+
onOpen: d(k),
|
|
1006
|
+
onClear: d(V)
|
|
1007
|
+
}, R({ _: 2 }, [
|
|
1008
|
+
v.$slots.button ? {
|
|
1009
|
+
name: "button",
|
|
1010
|
+
fn: x((A) => [
|
|
1011
|
+
c(v.$slots, "button", oe(re(A)))
|
|
1012
|
+
]),
|
|
1013
|
+
key: "0"
|
|
1014
|
+
} : void 0,
|
|
1015
|
+
v.$slots.entityAdditional ? {
|
|
1016
|
+
name: "entityAdditional",
|
|
1017
|
+
fn: x(({ item: A }) => [
|
|
1018
|
+
c(v.$slots, "entityAdditional", { item: A })
|
|
1019
|
+
]),
|
|
1020
|
+
key: "1"
|
|
1021
|
+
} : void 0
|
|
1022
|
+
]), 1032, ["variant", "model-value", "icon", "title", "label-select", "label-select-note", "label-class", "icon-class", "icon-class-block", "no-icon", "readonly", "tag-color", "change-label", "resolvers", "onOpen", "onClear"]),
|
|
1023
|
+
q(be, {
|
|
1024
|
+
useModal: d(T),
|
|
1025
|
+
title: p.value,
|
|
1026
|
+
subtitle: e.modalSubtitle,
|
|
1027
|
+
"title-center": e.modalTitlePosition === "center",
|
|
1028
|
+
size: d(j),
|
|
1029
|
+
"mobile-view": d(W),
|
|
1030
|
+
view: le.value
|
|
1031
|
+
}, R({
|
|
1032
|
+
create: x(() => [
|
|
1033
|
+
c(v.$slots, "creating", {
|
|
1034
|
+
onCloseCreateEntity: d(N),
|
|
1035
|
+
find: d(f)
|
|
1036
|
+
})
|
|
1037
|
+
]),
|
|
1038
|
+
edit: x(() => [
|
|
1039
|
+
c(v.$slots, "edit", {
|
|
1040
|
+
onCloseCreateEntity: d(N),
|
|
1041
|
+
editId: d(z)
|
|
1042
|
+
})
|
|
1043
|
+
]),
|
|
1044
|
+
list: x(() => [
|
|
1045
|
+
q(Ze, {
|
|
1046
|
+
loading: d($),
|
|
1047
|
+
items: d(h),
|
|
1048
|
+
"search-term": d(f),
|
|
1049
|
+
"scroll-height-class": te.value,
|
|
1050
|
+
resolvers: d(b),
|
|
1051
|
+
"empty-message": e.listEmptyMessage || i.value("ui.entity_picker.List empty"),
|
|
1052
|
+
"not-found-label": i.value("ui.entity_picker.Nothing found for"),
|
|
1053
|
+
"create-with-query-label": `${e.labelCreateButton} «${d(f)}»`,
|
|
1054
|
+
"can-create": !e.noCreate && !!e.labelCreateButton,
|
|
1055
|
+
"item-size": e.listItemSize,
|
|
1056
|
+
"item-icon-class": e.listItemIconClass,
|
|
1057
|
+
"item-title-class": _.value,
|
|
1058
|
+
"item-subtitle-class": ee.value,
|
|
1059
|
+
"item-indicator": e.listItemIndicator,
|
|
1060
|
+
"can-edit": !!v.$slots.edit && !e.noEdit,
|
|
1061
|
+
"edit-label": e.editButtonLabel || i.value("ui.entity_picker.Edit"),
|
|
1062
|
+
onSelect: d(B),
|
|
1063
|
+
onEdit: d(K),
|
|
1064
|
+
onCreate: d(w)
|
|
1065
|
+
}, R({ _: 2 }, [
|
|
1066
|
+
v.$slots.creating ? {
|
|
1067
|
+
name: "empty",
|
|
1068
|
+
fn: x(() => [
|
|
1069
|
+
c(v.$slots, "creating", {
|
|
1070
|
+
onCloseCreateEntity: d(N),
|
|
1071
|
+
find: d(f)
|
|
414
1072
|
})
|
|
415
|
-
],
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
})
|
|
434
|
-
])) : B.value ? (l(), a("div", Oe, [
|
|
435
|
-
m(e.$slots, "edit", {
|
|
436
|
-
onCloseCreateEntity: R,
|
|
437
|
-
editId: B.value
|
|
438
|
-
})
|
|
439
|
-
])) : (l(), a("div", Ie, [
|
|
440
|
-
e.$slots.modalHeader ? (l(), a("div", Ne, [
|
|
441
|
-
m(e.$slots, "modalHeader")
|
|
442
|
-
])) : c("", !0),
|
|
443
|
-
t.noSearch ? c("", !0) : (l(), a("div", Te, [
|
|
444
|
-
s("div", Ke, [
|
|
445
|
-
o[4] || (o[4] = s("svg", {
|
|
446
|
-
class: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400",
|
|
447
|
-
fill: "none",
|
|
448
|
-
viewBox: "0 0 24 24",
|
|
449
|
-
stroke: "currentColor",
|
|
450
|
-
"stroke-width": "2"
|
|
451
|
-
}, [
|
|
452
|
-
s("path", {
|
|
453
|
-
"stroke-linecap": "round",
|
|
454
|
-
"stroke-linejoin": "round",
|
|
455
|
-
d: "M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z"
|
|
456
|
-
})
|
|
457
|
-
], -1)),
|
|
458
|
-
be(s("input", {
|
|
459
|
-
"onUpdate:modelValue": o[0] || (o[0] = (r) => v.value = r),
|
|
460
|
-
type: "text",
|
|
461
|
-
class: "w-full pl-9 pr-3 py-2 border rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-primary-base focus:border-transparent",
|
|
462
|
-
placeholder: b.value("ui.entity_picker.Search"),
|
|
463
|
-
ref_key: "searchInput",
|
|
464
|
-
ref: Y
|
|
465
|
-
}, null, 8, Pe), [
|
|
466
|
-
[Ce, v.value]
|
|
467
|
-
])
|
|
468
|
-
])
|
|
469
|
-
])),
|
|
470
|
-
m(e.$slots, "prepend", {
|
|
471
|
-
selectedGroup: re.value,
|
|
472
|
-
setSelectedGroup: ue
|
|
473
|
-
}),
|
|
474
|
-
!T.value && !t.noCreate && t.labelCreateButton ? (l(), a("div", Ue, [
|
|
475
|
-
s("button", {
|
|
476
|
-
type: "button",
|
|
477
|
-
onClick: ee,
|
|
478
|
-
class: "w-full flex items-center justify-center gap-2 py-2 text-blue-400 hover:text-blue-300 text-sm"
|
|
479
|
-
}, [
|
|
480
|
-
o[5] || (o[5] = s("svg", {
|
|
481
|
-
class: "w-4 h-4",
|
|
482
|
-
fill: "none",
|
|
483
|
-
viewBox: "0 0 24 24",
|
|
484
|
-
stroke: "currentColor",
|
|
485
|
-
"stroke-width": "2"
|
|
486
|
-
}, [
|
|
487
|
-
s("path", {
|
|
488
|
-
"stroke-linecap": "round",
|
|
489
|
-
"stroke-linejoin": "round",
|
|
490
|
-
d: "M12 4.5v15m7.5-7.5h-15"
|
|
491
|
-
})
|
|
492
|
-
], -1)),
|
|
493
|
-
z(" " + d(t.labelCreateButton), 1)
|
|
494
|
-
])
|
|
495
|
-
])) : c("", !0),
|
|
496
|
-
s("div", {
|
|
497
|
-
class: u(["divide-y overflow-auto", {
|
|
498
|
-
"sm:h-[40vh] h-[60dvh]": !t.noSearch,
|
|
499
|
-
"sm:h-[52vh] h-[86dvh] min-h-[300px]": t.noSearch
|
|
500
|
-
}])
|
|
501
|
-
}, [
|
|
502
|
-
T.value ? (l(), a("div", Fe, [...o[6] || (o[6] = [
|
|
503
|
-
s("div", { class: "animate-spin w-6 h-6 border-2 border-primary-base border-t-transparent rounded-full" }, null, -1)
|
|
504
|
-
])])) : U.value.length === 0 && !v.value ? (l(), a("div", Ge, [
|
|
505
|
-
m(e.$slots, "creating", {
|
|
506
|
-
onCloseCreateEntity: R,
|
|
507
|
-
find: v.value
|
|
508
|
-
}, () => [
|
|
509
|
-
s("p", He, d(t.listEmptyMessage || b.value("ui.entity_picker.List empty")), 1)
|
|
510
|
-
])
|
|
511
|
-
])) : U.value.length === 0 && v.value ? (l(), a("div", We, [
|
|
512
|
-
s("p", Je, [
|
|
513
|
-
z(d(b.value("ui.entity_picker.Nothing found for")) + " ", 1),
|
|
514
|
-
s("b", null, d(v.value), 1)
|
|
515
|
-
]),
|
|
516
|
-
!t.noCreate && t.labelCreateButton ? (l(), a("button", {
|
|
517
|
-
key: 0,
|
|
518
|
-
type: "button",
|
|
519
|
-
onClick: ee,
|
|
520
|
-
class: "w-full text-xs text-blue-400 hover:text-blue-300 mt-2"
|
|
521
|
-
}, d(t.labelCreateButton) + " «" + d(v.value) + "» ", 1)) : c("", !0)
|
|
522
|
-
])) : (l(!0), a(le, { key: 3 }, we(ce.value, (r) => (l(), a("div", {
|
|
523
|
-
key: G(r),
|
|
524
|
-
class: u(["flex items-center py-3 hover:bg-secondary-body-hover px-3 cursor-pointer", { "bg-gray-50 text-blue-900": J(r) }]),
|
|
525
|
-
onClick: (X) => fe(r)
|
|
526
|
-
}, [
|
|
527
|
-
s("div", Xe, [
|
|
528
|
-
Se(V(se), {
|
|
529
|
-
text: H(r),
|
|
530
|
-
src: ye(r),
|
|
531
|
-
rounded: !1,
|
|
532
|
-
size: "30",
|
|
533
|
-
class: "!rounded-lg"
|
|
534
|
-
}, null, 8, ["text", "src"])
|
|
535
|
-
]),
|
|
536
|
-
s("div", Ye, [
|
|
537
|
-
s("p", Ze, d(H(r)), 1),
|
|
538
|
-
W(r) ? (l(), a("div", Qe, [
|
|
539
|
-
m(e.$slots, "entityAdditional", { item: r }, () => [
|
|
540
|
-
s("span", De, d(W(r)), 1)
|
|
541
|
-
])
|
|
542
|
-
])) : c("", !0)
|
|
543
|
-
]),
|
|
544
|
-
J(r) && e.$slots.edit && !t.noEdit ? (l(), a("button", {
|
|
545
|
-
key: 0,
|
|
546
|
-
type: "button",
|
|
547
|
-
onClick: ae((X) => he(F(r)), ["stop"]),
|
|
548
|
-
class: "text-xs text-blue-400 hover:text-blue-300 mr-2"
|
|
549
|
-
}, d(b.value("ui.entity_picker.Edit")), 9, _e)) : c("", !0),
|
|
550
|
-
J(r) ? (l(), a("svg", et, [...o[7] || (o[7] = [
|
|
551
|
-
s("path", {
|
|
552
|
-
"stroke-linecap": "round",
|
|
553
|
-
"stroke-linejoin": "round",
|
|
554
|
-
d: "M4.5 12.75l6 6 9-13.5"
|
|
555
|
-
}, null, -1)
|
|
556
|
-
])])) : (l(), a("svg", tt, [...o[8] || (o[8] = [
|
|
557
|
-
s("path", {
|
|
558
|
-
"stroke-linecap": "round",
|
|
559
|
-
"stroke-linejoin": "round",
|
|
560
|
-
d: "M8.25 4.5l7.5 7.5-7.5 7.5"
|
|
561
|
-
}, null, -1)
|
|
562
|
-
])]))
|
|
563
|
-
], 10, Re))), 128))
|
|
564
|
-
], 2)
|
|
565
|
-
]))
|
|
1073
|
+
]),
|
|
1074
|
+
key: "0"
|
|
1075
|
+
} : void 0,
|
|
1076
|
+
v.$slots.entityListIcon ? {
|
|
1077
|
+
name: "itemIcon",
|
|
1078
|
+
fn: x(({ item: A }) => [
|
|
1079
|
+
c(v.$slots, "entityListIcon", { item: A })
|
|
1080
|
+
]),
|
|
1081
|
+
key: "1"
|
|
1082
|
+
} : void 0,
|
|
1083
|
+
v.$slots.entityAdditional ? {
|
|
1084
|
+
name: "itemAdditional",
|
|
1085
|
+
fn: x(({ item: A }) => [
|
|
1086
|
+
c(v.$slots, "entityAdditional", { item: A })
|
|
1087
|
+
]),
|
|
1088
|
+
key: "2"
|
|
1089
|
+
} : void 0
|
|
1090
|
+
]), 1032, ["loading", "items", "search-term", "scroll-height-class", "resolvers", "empty-message", "not-found-label", "create-with-query-label", "can-create", "item-size", "item-icon-class", "item-title-class", "item-subtitle-class", "item-indicator", "can-edit", "edit-label", "onSelect", "onEdit", "onCreate"])
|
|
566
1091
|
]),
|
|
567
|
-
_:
|
|
568
|
-
},
|
|
569
|
-
|
|
1092
|
+
_: 2
|
|
1093
|
+
}, [
|
|
1094
|
+
v.$slots.modalSubtitle ? {
|
|
1095
|
+
name: "subtitle",
|
|
1096
|
+
fn: x(() => [
|
|
1097
|
+
c(v.$slots, "modalSubtitle")
|
|
1098
|
+
]),
|
|
1099
|
+
key: "0"
|
|
1100
|
+
} : void 0,
|
|
1101
|
+
v.$slots.modalHeader ? {
|
|
1102
|
+
name: "header",
|
|
1103
|
+
fn: x(() => [
|
|
1104
|
+
c(v.$slots, "modalHeader")
|
|
1105
|
+
]),
|
|
1106
|
+
key: "1"
|
|
1107
|
+
} : void 0,
|
|
1108
|
+
e.noSearch ? void 0 : {
|
|
1109
|
+
name: "search",
|
|
1110
|
+
fn: x(() => [
|
|
1111
|
+
q(je, {
|
|
1112
|
+
ref_key: "searchInput",
|
|
1113
|
+
ref: O,
|
|
1114
|
+
modelValue: d(f),
|
|
1115
|
+
"onUpdate:modelValue": U[0] || (U[0] = (A) => de(f) ? f.value = A : null),
|
|
1116
|
+
placeholder: e.searchPlaceholder || i.value("ui.entity_picker.Search")
|
|
1117
|
+
}, null, 8, ["modelValue", "placeholder"])
|
|
1118
|
+
]),
|
|
1119
|
+
key: "2"
|
|
1120
|
+
},
|
|
1121
|
+
v.$slots.prepend ? {
|
|
1122
|
+
name: "prepend",
|
|
1123
|
+
fn: x(() => [
|
|
1124
|
+
c(v.$slots, "prepend", {
|
|
1125
|
+
selectedGroup: d(L),
|
|
1126
|
+
setSelectedGroup: d(s)
|
|
1127
|
+
})
|
|
1128
|
+
]),
|
|
1129
|
+
key: "3"
|
|
1130
|
+
} : void 0,
|
|
1131
|
+
!d($) && !e.noCreate && e.labelCreateButton ? {
|
|
1132
|
+
name: "createButton",
|
|
1133
|
+
fn: x(() => [
|
|
1134
|
+
q(Pe, {
|
|
1135
|
+
label: e.labelCreateButton,
|
|
1136
|
+
onClick: d(w)
|
|
1137
|
+
}, null, 8, ["label", "onClick"])
|
|
1138
|
+
]),
|
|
1139
|
+
key: "4"
|
|
1140
|
+
} : void 0
|
|
1141
|
+
]), 1032, ["useModal", "title", "subtitle", "title-center", "size", "mobile-view", "view"]),
|
|
1142
|
+
J.value.length > 0 ? (a(), o("div", De, E(J.value.join(" ")), 1)) : C("", !0)
|
|
570
1143
|
], 64));
|
|
571
1144
|
}
|
|
572
|
-
}),
|
|
1145
|
+
}), dt = {
|
|
573
1146
|
"entity_picker.Loading": "Завантаження...",
|
|
574
1147
|
"entity_picker.Select": "Вибір",
|
|
575
1148
|
"entity_picker.Search": "Пошук...",
|
|
@@ -579,6 +1152,6 @@ const Me = { key: 0 }, Ae = { class: "" }, qe = {
|
|
|
579
1152
|
"entity_picker.Nothing found for": "За запитом нічого не знайдено:"
|
|
580
1153
|
};
|
|
581
1154
|
export {
|
|
582
|
-
|
|
583
|
-
|
|
1155
|
+
rt as OneEntityPicker,
|
|
1156
|
+
dt as defaultEntityPickerTranslations
|
|
584
1157
|
};
|