admins-components 9.0.75 → 9.0.77
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/admins-components.js +16 -16
- package/dist/admins-components100.js +1 -1
- package/dist/admins-components100.js.map +1 -1
- package/dist/admins-components102.js +4 -4
- package/dist/admins-components103.js +2 -2
- package/dist/admins-components103.js.map +1 -1
- package/dist/admins-components105.js +4 -4
- package/dist/admins-components11.js +6 -6
- package/dist/admins-components110.js +1 -1
- package/dist/admins-components110.js.map +1 -1
- package/dist/admins-components111.js +2 -2
- package/dist/admins-components111.js.map +1 -1
- package/dist/admins-components112.js.map +1 -1
- package/dist/admins-components113.js +1 -1
- package/dist/admins-components113.js.map +1 -1
- package/dist/admins-components115.js +144 -126
- package/dist/admins-components115.js.map +1 -1
- package/dist/admins-components116.js +7 -5
- package/dist/admins-components116.js.map +1 -1
- package/dist/admins-components117.js +1 -1
- package/dist/admins-components117.js.map +1 -1
- package/dist/admins-components118.js +75 -27
- package/dist/admins-components118.js.map +1 -1
- package/dist/admins-components119.js +30 -6
- package/dist/admins-components119.js.map +1 -1
- package/dist/admins-components12.js.map +1 -1
- package/dist/admins-components120.js +34 -20
- package/dist/admins-components120.js.map +1 -1
- package/dist/admins-components121.js +1 -3
- package/dist/admins-components121.js.map +1 -1
- package/dist/admins-components122.js +4 -3
- package/dist/admins-components122.js.map +1 -1
- package/dist/admins-components124.js +2 -1
- package/dist/admins-components124.js.map +1 -1
- package/dist/admins-components129.js +1 -1
- package/dist/admins-components129.js.map +1 -1
- package/dist/admins-components13.js +2 -2
- package/dist/admins-components13.js.map +1 -1
- package/dist/admins-components132.js +23 -15
- package/dist/admins-components132.js.map +1 -1
- package/dist/admins-components133.js.map +1 -1
- package/dist/admins-components14.js +4 -4
- package/dist/admins-components141.js +2 -2
- package/dist/admins-components141.js.map +1 -1
- package/dist/admins-components142.js.map +1 -1
- package/dist/admins-components143.js +5 -1
- package/dist/admins-components143.js.map +1 -1
- package/dist/admins-components144.js +1 -1
- package/dist/admins-components144.js.map +1 -1
- package/dist/admins-components145.js +4 -1
- package/dist/admins-components145.js.map +1 -1
- package/dist/admins-components146.js +30 -6
- package/dist/admins-components146.js.map +1 -1
- package/dist/admins-components147.js +64 -54
- package/dist/admins-components147.js.map +1 -1
- package/dist/admins-components148.js +8 -25
- package/dist/admins-components148.js.map +1 -1
- package/dist/admins-components149.js +26 -56
- package/dist/admins-components149.js.map +1 -1
- package/dist/admins-components150.js +56 -21
- package/dist/admins-components150.js.map +1 -1
- package/dist/admins-components151.js +27 -45
- package/dist/admins-components151.js.map +1 -1
- package/dist/admins-components152.js +48 -29
- package/dist/admins-components152.js.map +1 -1
- package/dist/admins-components153.js +48 -3
- package/dist/admins-components153.js.map +1 -1
- package/dist/admins-components154.js +3 -179
- package/dist/admins-components154.js.map +1 -1
- package/dist/admins-components155.js +200 -42
- package/dist/admins-components155.js.map +1 -1
- package/dist/admins-components156.js +44 -35
- package/dist/admins-components156.js.map +1 -1
- package/dist/admins-components157.js +35 -44
- package/dist/admins-components157.js.map +1 -1
- package/dist/admins-components158.js +42 -137
- package/dist/admins-components158.js.map +1 -1
- package/dist/admins-components159.js +146 -51
- package/dist/admins-components159.js.map +1 -1
- package/dist/admins-components16.js +2 -2
- package/dist/admins-components16.js.map +1 -1
- package/dist/admins-components160.js +58 -7
- package/dist/admins-components160.js.map +1 -1
- package/dist/admins-components161.js +6 -5
- package/dist/admins-components161.js.map +1 -1
- package/dist/admins-components162.js +6 -76
- package/dist/admins-components162.js.map +1 -1
- package/dist/admins-components163.js +77 -29
- package/dist/admins-components163.js.map +1 -1
- package/dist/admins-components164.js +29 -1931
- package/dist/admins-components164.js.map +1 -1
- package/dist/admins-components165.js +1743 -24631
- package/dist/admins-components165.js.map +1 -1
- package/dist/admins-components166.js +24788 -8
- package/dist/admins-components166.js.map +1 -1
- package/dist/admins-components167.js +9 -7
- package/dist/admins-components167.js.map +1 -0
- package/dist/admins-components168.js +7 -142
- package/dist/admins-components169.js +141 -8
- package/dist/admins-components169.js.map +1 -1
- package/dist/admins-components17.js +3 -3
- package/dist/admins-components170.js +3 -3
- package/dist/admins-components170.js.map +1 -1
- package/dist/admins-components171.js +10 -0
- package/dist/admins-components171.js.map +1 -0
- package/dist/admins-components173.js +160 -45
- package/dist/admins-components173.js.map +1 -1
- package/dist/admins-components174.js +52 -8
- package/dist/admins-components174.js.map +1 -1
- package/dist/admins-components175.js +8 -49
- package/dist/admins-components175.js.map +1 -1
- package/dist/admins-components176.js +50 -6
- package/dist/admins-components176.js.map +1 -1
- package/dist/admins-components177.js +6 -80
- package/dist/admins-components177.js.map +1 -1
- package/dist/admins-components178.js +71 -48
- package/dist/admins-components178.js.map +1 -1
- package/dist/admins-components179.js +30 -35
- package/dist/admins-components179.js.map +1 -1
- package/dist/admins-components18.js +1 -1
- package/dist/admins-components18.js.map +1 -1
- package/dist/admins-components180.js +62 -8
- package/dist/admins-components180.js.map +1 -1
- package/dist/admins-components181.js +8 -51
- package/dist/admins-components181.js.map +1 -1
- package/dist/admins-components182.js +51 -8
- package/dist/admins-components182.js.map +1 -1
- package/dist/admins-components183.js +10 -0
- package/dist/admins-components183.js.map +1 -0
- package/dist/{admins-components184.js → admins-components185.js} +5 -5
- package/dist/{admins-components184.js.map → admins-components185.js.map} +1 -1
- package/dist/admins-components20.js +1 -1
- package/dist/admins-components21.js +10 -6
- package/dist/admins-components21.js.map +1 -1
- package/dist/admins-components22.js +4 -4
- package/dist/admins-components23.js +1 -1
- package/dist/admins-components23.js.map +1 -1
- package/dist/admins-components25.js +1 -1
- package/dist/admins-components26.js +124 -124
- package/dist/admins-components26.js.map +1 -1
- package/dist/admins-components28.js +4 -4
- package/dist/admins-components28.js.map +1 -1
- package/dist/admins-components29.js +1 -1
- package/dist/admins-components29.js.map +1 -1
- package/dist/admins-components3.js +1 -3
- package/dist/admins-components3.js.map +1 -1
- package/dist/admins-components30.js +1 -1
- package/dist/admins-components31.js.map +1 -1
- package/dist/admins-components32.js +2 -2
- package/dist/admins-components32.js.map +1 -1
- package/dist/admins-components34.js +4 -4
- package/dist/admins-components35.js +2 -2
- package/dist/admins-components35.js.map +1 -1
- package/dist/admins-components37.js +4 -4
- package/dist/admins-components38.js +1 -1
- package/dist/admins-components38.js.map +1 -1
- package/dist/admins-components40.js +1 -1
- package/dist/admins-components41.js +1 -1
- package/dist/admins-components41.js.map +1 -1
- package/dist/admins-components43.js +1 -1
- package/dist/admins-components43.js.map +1 -1
- package/dist/admins-components45.js +1 -1
- package/dist/admins-components46.js +1 -1
- package/dist/admins-components46.js.map +1 -1
- package/dist/admins-components48.js +1 -1
- package/dist/admins-components49.js +1 -1
- package/dist/admins-components49.js.map +1 -1
- package/dist/admins-components5.js +2 -2
- package/dist/admins-components5.js.map +1 -1
- package/dist/admins-components51.js +1 -1
- package/dist/admins-components51.js.map +1 -1
- package/dist/admins-components54.js +1 -1
- package/dist/admins-components54.js.map +1 -1
- package/dist/admins-components56.js +1 -1
- package/dist/admins-components57.js +1 -1
- package/dist/admins-components57.js.map +1 -1
- package/dist/admins-components6.js +3 -3
- package/dist/admins-components62.js +1 -1
- package/dist/admins-components62.js.map +1 -1
- package/dist/admins-components64.js +1 -1
- package/dist/admins-components65.js.map +1 -1
- package/dist/admins-components66.js +1 -1
- package/dist/admins-components66.js.map +1 -1
- package/dist/admins-components68.js +5 -5
- package/dist/admins-components68.js.map +1 -1
- package/dist/admins-components7.js +1 -1
- package/dist/admins-components7.js.map +1 -1
- package/dist/admins-components70.js +1 -1
- package/dist/admins-components71.js +1 -1
- package/dist/admins-components71.js.map +1 -1
- package/dist/admins-components73.js +1 -1
- package/dist/admins-components74.js +1 -1
- package/dist/admins-components74.js.map +1 -1
- package/dist/admins-components75.js +1 -1
- package/dist/admins-components75.js.map +1 -1
- package/dist/admins-components77.js +1 -1
- package/dist/admins-components78.js +1 -1
- package/dist/admins-components79.js +1 -1
- package/dist/admins-components79.js.map +1 -1
- package/dist/admins-components8.js +2 -2
- package/dist/admins-components8.js.map +1 -1
- package/dist/admins-components80.js +2 -2
- package/dist/admins-components80.js.map +1 -1
- package/dist/admins-components82.js +4 -4
- package/dist/admins-components83.js +1 -1
- package/dist/admins-components83.js.map +1 -1
- package/dist/admins-components85.js +4 -4
- package/dist/admins-components86.js.map +1 -1
- package/dist/admins-components87.js +6 -4
- package/dist/admins-components87.js.map +1 -1
- package/dist/admins-components88.js +4 -4
- package/dist/admins-components88.js.map +1 -1
- package/dist/admins-components90.js +1 -1
- package/dist/admins-components91.js +1 -1
- package/dist/admins-components91.js.map +1 -1
- package/dist/admins-components93.js +1 -1
- package/dist/admins-components94.js +1 -1
- package/dist/admins-components94.js.map +1 -1
- package/dist/admins-components96.js +1 -1
- package/dist/admins-components97.js +1 -1
- package/dist/admins-components97.js.map +1 -1
- package/dist/admins-components99.js +1 -1
- package/dist/main.css +1 -1
- package/dist/main.css.map +1 -1
- package/dist/src/composables/useDropdownAnchor.d.ts +0 -11
- package/dist/{src/styles → styles}/components/data-table/filter-tags.scss_vue_type_style_index_0_src_true_lang.css +1 -1
- package/dist/styles/components/dropdown-select.scss_vue_type_style_index_0_src_true_lang.css +1 -0
- package/package.json +1 -1
- package/dist/admins-components168.js.map +0 -1
- package/dist/admins-components172.js +0 -169
- package/dist/admins-components172.js.map +0 -1
- package/dist/src/styles/components/dropdown-select.scss_vue_type_style_index_0_src_true_lang.css +0 -1
- /package/dist/{src/styles → styles}/components/calendar.scss_vue_type_style_index_0_src_true_lang.css +0 -0
- /package/dist/{src/styles → styles}/components/copy-to-clipboard.scss_vue_type_style_index_0_src_true_lang.css +0 -0
- /package/dist/{src/styles → styles}/components/data-table/data-cards.scss_vue_type_style_index_0_src_true_lang.css +0 -0
- /package/dist/{src/styles → styles}/components/data-table/data-filters.scss_vue_type_style_index_0_src_true_lang.css +0 -0
- /package/dist/{src/styles → styles}/components/data-table/data-list-guide.scss_vue_type_style_index_0_src_true_lang.css +0 -0
- /package/dist/{src/styles → styles}/components/data-table/data-list-options.scss_vue_type_style_index_0_src_true_lang.css +0 -0
- /package/dist/{src/styles → styles}/components/data-table/data-list.scss_vue_type_style_index_0_src_true_lang.css +0 -0
- /package/dist/{src/styles → styles}/components/data-table/data-paginator.scss_vue_type_style_index_0_src_true_lang.css +0 -0
- /package/dist/{src/styles → styles}/components/data-table/data-search.scss_vue_type_style_index_0_src_true_lang.css +0 -0
- /package/dist/{src/styles → styles}/components/data-table/data-sort.scss_vue_type_style_index_0_src_true_lang.css +0 -0
- /package/dist/{src/styles → styles}/components/data-table/data-table.scss_vue_type_style_index_0_src_true_lang.css +0 -0
- /package/dist/{src/styles → styles}/components/data-table/filters-history.scss_vue_type_style_index_0_src_true_lang.css +0 -0
- /package/dist/{src/styles → styles}/components/data-table/tag-list.scss_vue_type_style_index_0_src_true_lang.css +0 -0
- /package/dist/{src/styles → styles}/components/datepickers.scss_vue_type_style_index_1_src_true_lang.css +0 -0
- /package/dist/{src/styles → styles}/components/header.scss_vue_type_style_index_0_src_true_lang.css +0 -0
- /package/dist/{src/styles → styles}/components/image-picker.scss_vue_type_style_index_0_src_true_lang.css +0 -0
- /package/dist/{src/styles → styles}/components/loader.scss_vue_type_style_index_0_src_true_lang.css +0 -0
- /package/dist/{src/styles → styles}/components/modal.scss_vue_type_style_index_0_src_true_lang.css +0 -0
- /package/dist/{src/styles → styles}/components/sidebar.scss_vue_type_style_index_0_src_true_lang.css +0 -0
- /package/dist/{src/styles → styles}/components/toast-notification.scss_vue_type_style_index_0_src_true_lang.css +0 -0
- /package/dist/{src/vueformelements → vueformelements}/ArticlePickerElement.vue_vue_type_style_index_0_scoped_43c54caa_lang.css +0 -0
- /package/dist/{src/vueformelements → vueformelements}/PartnerPickerElement.vue_vue_type_style_index_0_scoped_09bea4ae_lang.css +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./admins-components7.js";
|
|
2
|
-
import
|
|
1
|
+
import { dateRangePickerConfigDefaults as e } from "./admins-components7.js";
|
|
2
|
+
import t from "./admins-components21.js";
|
|
3
3
|
//#region src/components/DateRangePicker.vue
|
|
4
|
-
var
|
|
4
|
+
var n = t;
|
|
5
5
|
//#endregion
|
|
6
|
-
export {
|
|
6
|
+
export { e as dateRangePickerConfigDefaults, n as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createElementBlock as e, defineComponent as t, normalizeStyle as n, openBlock as r } from "vue";
|
|
2
2
|
//#region src/components/Loader.vue?vue&type=script&setup=true&lang.ts
|
|
3
|
-
var i =
|
|
3
|
+
var i = /*@__PURE__*/ t({
|
|
4
4
|
__name: "Loader",
|
|
5
5
|
props: {
|
|
6
6
|
loading: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admins-components23.js","names":[],"sources":["../src/components/Loader.vue"],"sourcesContent":["<script setup lang=\"ts\">\nwithDefaults(\n defineProps<{\n loading?: boolean\n size?: string\n color?: string\n }>(),\n {\n loading: true,\n size: '2rem',\n color: 'var(--site-500)',\n },\n)\n</script>\n<template>\n <div\n class=\"loader\"\n :style=\"{\n width: size,\n '--loader-thickness': `calc(${size} / 6)`,\n '--loader-color': color,\n }\"\n ></div>\n</template>\n\n<style lang=\"scss\" src=\"@/styles/components/loader.scss\"></style>\n"],"mappings":";;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"admins-components23.js","names":[],"sources":["../src/components/Loader.vue"],"sourcesContent":["<script setup lang=\"ts\">\nwithDefaults(\n defineProps<{\n loading?: boolean\n size?: string\n color?: string\n }>(),\n {\n loading: true,\n size: '2rem',\n color: 'var(--site-500)',\n },\n)\n</script>\n<template>\n <div\n class=\"loader\"\n :style=\"{\n width: size,\n '--loader-thickness': `calc(${size} / 6)`,\n '--loader-color': color,\n }\"\n ></div>\n</template>\n\n<style lang=\"scss\" src=\"@/styles/components/loader.scss\"></style>\n"],"mappings":";;;;;;;;;;;;;oBAeE,EAAA,GAAA,EAOO,OAAA;GANL,OAAM;GACL,OAAK,EAAA;IAAiB,OAAA,EAAA;IAA0C,sBAAA,QAAA,EAAA,KAAI;IAAiC,kBAAA,EAAA"}
|
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
import e from "./admins-components6.js";
|
|
2
|
-
import t from "./admins-
|
|
3
|
-
import
|
|
2
|
+
import { useDropdownAnchor as t } from "./admins-components12.js";
|
|
3
|
+
import n from "./admins-components25.js";
|
|
4
|
+
import { Fragment as r, Teleport as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createVNode as u, defineComponent as d, nextTick as f, normalizeClass as p, normalizeStyle as ee, openBlock as m, ref as h, renderList as g, toDisplayString as _, unref as v, watch as y, withModifiers as b } from "vue";
|
|
4
5
|
//#region src/components/DropdownSelect.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
-
var
|
|
6
|
+
var x = { class: "ac-component" }, S = ["aria-disabled"], C = {
|
|
6
7
|
key: 0,
|
|
7
8
|
class: "c-truncate ds-value"
|
|
8
|
-
},
|
|
9
|
+
}, te = {
|
|
9
10
|
key: 1,
|
|
10
11
|
class: "c-placeholder"
|
|
11
|
-
},
|
|
12
|
+
}, ne = { class: "ac-component" }, re = {
|
|
12
13
|
key: 0,
|
|
13
14
|
class: "ds-filter"
|
|
14
|
-
},
|
|
15
|
+
}, w = ["title"], T = ["value", "placeholder"], E = { class: "ds-options c-scroll" }, ie = {
|
|
15
16
|
key: 0,
|
|
16
17
|
class: "ds-option ds-option--loading"
|
|
17
|
-
},
|
|
18
|
+
}, ae = ["onClick", "onKeydown"], oe = ["innerHTML"], D = {
|
|
18
19
|
key: 0,
|
|
19
20
|
class: "ds-option ds-option--empty"
|
|
20
|
-
},
|
|
21
|
+
}, O = {
|
|
21
22
|
key: 1,
|
|
22
23
|
class: "c-footer"
|
|
23
|
-
},
|
|
24
|
+
}, k = {
|
|
24
25
|
placeholder: "Válassz...",
|
|
25
26
|
filterable: !0,
|
|
26
27
|
filterPlaceholder: "Kezdj el gépelni...",
|
|
@@ -32,45 +33,48 @@ var v = { class: "ac-component" }, ne = ["aria-disabled"], re = {
|
|
|
32
33
|
size: "normal",
|
|
33
34
|
highlight: !0,
|
|
34
35
|
disabled: !1
|
|
35
|
-
},
|
|
36
|
+
}, A = /*@__PURE__*/ d({
|
|
36
37
|
__name: "DropdownSelect",
|
|
37
38
|
props: {
|
|
38
39
|
modelValue: { default: null },
|
|
39
40
|
options: {},
|
|
40
|
-
config: { default: () => ({ ...
|
|
41
|
+
config: { default: () => ({ ...k }) }
|
|
41
42
|
},
|
|
42
43
|
emits: ["update:modelValue", "filter-input"],
|
|
43
|
-
setup(
|
|
44
|
-
let
|
|
45
|
-
...
|
|
46
|
-
...
|
|
47
|
-
})),
|
|
48
|
-
|
|
44
|
+
setup(d, { expose: A, emit: j }) {
|
|
45
|
+
let M = d, N = a(() => ({
|
|
46
|
+
...k,
|
|
47
|
+
...M.config
|
|
48
|
+
})), P = j, F = h(""), I = h(null), L = h(null), R = h(null), z = h([]), B = h(U(M.modelValue, M.options)), { isOpen: V, dropdownStyle: H } = t(I, L, { extraStyle: (e) => ({
|
|
49
|
+
minWidth: `${e.width}px`,
|
|
50
|
+
maxWidth: `${e.width * 1.5}px`
|
|
51
|
+
}) });
|
|
52
|
+
function U(e, t) {
|
|
49
53
|
return e == null ? [] : (Array.isArray(e) ? e : [e]).map((e) => e == null ? null : typeof e == "object" && "label" in e ? e : typeof e == "string" ? t.find((t) => t.value === e) ?? {
|
|
50
54
|
value: e,
|
|
51
55
|
label: e
|
|
52
56
|
} : null).filter((e) => e !== null);
|
|
53
57
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}),
|
|
57
|
-
e && (F.value = "",
|
|
58
|
+
y(() => [M.modelValue, M.options], ([e]) => {
|
|
59
|
+
B.value = U(e, M.options);
|
|
60
|
+
}), y(V, (e) => {
|
|
61
|
+
e && (F.value = "", N.value.filterable && f(() => R.value?.focus()), N.value.lazy && (z.value = [...B.value]));
|
|
58
62
|
});
|
|
59
|
-
function
|
|
60
|
-
F.value = e,
|
|
63
|
+
function W(e) {
|
|
64
|
+
F.value = e, P("filter-input", e);
|
|
61
65
|
}
|
|
62
|
-
let
|
|
63
|
-
if (
|
|
64
|
-
if (!
|
|
65
|
-
let e =
|
|
66
|
-
return
|
|
66
|
+
let G = a(() => {
|
|
67
|
+
if (B.value.length === 0) return null;
|
|
68
|
+
if (!N.value.multiple) {
|
|
69
|
+
let e = B.value[0];
|
|
70
|
+
return M.options.find((t) => t.value === e?.value)?.label ?? e?.label ?? null;
|
|
67
71
|
}
|
|
68
|
-
return
|
|
69
|
-
}),
|
|
72
|
+
return B.value.length > 2 ? `${B.value.length} kiválasztva` : B.value.map((e) => M.options.find((t) => t.value === e.value)?.label ?? e.label ?? e.value).join(", ");
|
|
73
|
+
}), K = a(() => {
|
|
70
74
|
let e = F.value.toLowerCase();
|
|
71
|
-
return e ?
|
|
75
|
+
return e ? M.options.filter((t) => t.label.toLowerCase().includes(e)) : M.options;
|
|
72
76
|
});
|
|
73
|
-
function
|
|
77
|
+
function q(e) {
|
|
74
78
|
return e.replace(/[&<>"']/g, (e) => ({
|
|
75
79
|
"&": "&",
|
|
76
80
|
"<": "<",
|
|
@@ -79,159 +83,155 @@ var v = { class: "ac-component" }, ne = ["aria-disabled"], re = {
|
|
|
79
83
|
"'": "'"
|
|
80
84
|
})[e]);
|
|
81
85
|
}
|
|
82
|
-
function
|
|
86
|
+
function se(e) {
|
|
83
87
|
let t = F.value.trim();
|
|
84
|
-
if (!t || !
|
|
85
|
-
let n =
|
|
88
|
+
if (!t || !N.value.highlight) return q(e);
|
|
89
|
+
let n = q(e), r = q(t), i = new RegExp(r.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "ig");
|
|
86
90
|
return n.replace(i, (e) => `<mark class="ds-option__highlight">${e}</mark>`);
|
|
87
91
|
}
|
|
88
|
-
let
|
|
89
|
-
if (
|
|
90
|
-
let e =
|
|
91
|
-
return
|
|
92
|
+
let J = a(() => K.value.filter((e) => e.value)), Y = a(() => {
|
|
93
|
+
if (J.value.length === 0) return !1;
|
|
94
|
+
let e = N.value.lazy && V.value ? z.value : B.value;
|
|
95
|
+
return J.value.every((t) => t.value && e.some((e) => e.value === t.value));
|
|
92
96
|
});
|
|
93
|
-
function
|
|
94
|
-
return (
|
|
97
|
+
function X(e) {
|
|
98
|
+
return (N.value.lazy && V.value ? z : B).value.some((t) => t.value === e);
|
|
95
99
|
}
|
|
96
|
-
function
|
|
97
|
-
let e =
|
|
98
|
-
if (
|
|
100
|
+
function ce() {
|
|
101
|
+
let e = N.value.lazy && V.value ? z : B, t = J.value.filter((e) => e.value);
|
|
102
|
+
if (Y.value) {
|
|
99
103
|
let n = new Set(t.map((e) => e.value));
|
|
100
104
|
e.value = e.value.filter((e) => !n.has(e.value ?? ""));
|
|
101
105
|
} else {
|
|
102
106
|
let n = new Set(e.value.map((e) => e.value)), r = t.filter((e) => !n.has(e.value));
|
|
103
107
|
e.value = [...e.value, ...r];
|
|
104
108
|
}
|
|
105
|
-
|
|
109
|
+
N.value.lazy || P("update:modelValue", B.value.length > 0 ? [...B.value] : null);
|
|
106
110
|
}
|
|
107
|
-
function
|
|
111
|
+
function Z(e, t) {
|
|
108
112
|
let n = e.findIndex((e) => e.value === t.value);
|
|
109
113
|
return n >= 0 ? e.filter((e, t) => t !== n) : [...e, t];
|
|
110
114
|
}
|
|
111
|
-
function
|
|
115
|
+
function Q(e) {
|
|
112
116
|
if (e.callback) {
|
|
113
|
-
e.callback(),
|
|
117
|
+
e.callback(), V.value = !1;
|
|
114
118
|
return;
|
|
115
119
|
}
|
|
116
|
-
e.value && (
|
|
120
|
+
e.value && (N.value.multiple ? N.value.lazy ? z.value = Z(z.value, e) : (B.value = Z(B.value, e), P("update:modelValue", B.value.length > 0 ? [...B.value] : null)) : (B.value = [e], P("update:modelValue", e), V.value = !1));
|
|
117
121
|
}
|
|
118
|
-
function
|
|
119
|
-
|
|
122
|
+
function $() {
|
|
123
|
+
N.value.lazy && (B.value = [...z.value], P("update:modelValue", z.value.length > 0 ? [...z.value] : null)), V.value = !1;
|
|
120
124
|
}
|
|
121
|
-
function
|
|
122
|
-
|
|
125
|
+
function le() {
|
|
126
|
+
N.value.lazy ? z.value = [] : (B.value = [], P("update:modelValue", null));
|
|
123
127
|
}
|
|
124
|
-
function
|
|
125
|
-
e.key === " " ? (e.preventDefault(),
|
|
128
|
+
function ue(e, t) {
|
|
129
|
+
e.key === " " ? (e.preventDefault(), Q(t)) : e.key === "Enter" && (e.preventDefault(), $());
|
|
126
130
|
}
|
|
127
|
-
function
|
|
128
|
-
|
|
131
|
+
function de() {
|
|
132
|
+
N.value.disabled || (V.value = !V.value, V.value && N.value.filterable && (F.value = "", P("filter-input", "")));
|
|
129
133
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
});
|
|
133
|
-
function se() {
|
|
134
|
-
M.value.disabled || (P.value = !P.value, P.value && M.value.filterable && (F.value = "", N("filter-input", "")));
|
|
134
|
+
function fe() {
|
|
135
|
+
N.value.disabled || (B.value = [], P("update:modelValue", null), V.value = !1);
|
|
135
136
|
}
|
|
136
|
-
function
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
function le() {
|
|
140
|
-
M.value.disabled || (P.value = !0, M.value.filterable && l(() => L.value?.focus()));
|
|
137
|
+
function pe() {
|
|
138
|
+
N.value.disabled || (V.value = !0, N.value.filterable && f(() => R.value?.focus()));
|
|
141
139
|
}
|
|
142
|
-
function
|
|
143
|
-
F.value = "",
|
|
140
|
+
function me() {
|
|
141
|
+
F.value = "", P("filter-input", "");
|
|
144
142
|
}
|
|
145
|
-
return
|
|
143
|
+
return A({ focusAndOpen: pe }), (t, a) => (m(), c("div", x, [l("div", {
|
|
146
144
|
ref_key: "wrapperRef",
|
|
147
145
|
ref: I,
|
|
148
146
|
class: "c-wrapper ds-wrapper"
|
|
149
|
-
}, [
|
|
150
|
-
class:
|
|
151
|
-
"c-input-row--sm":
|
|
152
|
-
"c-input-row--lg":
|
|
153
|
-
"c-input-row--disabled":
|
|
147
|
+
}, [l("div", {
|
|
148
|
+
class: p(["c-input-row pointer", {
|
|
149
|
+
"c-input-row--sm": N.value.size === "small",
|
|
150
|
+
"c-input-row--lg": N.value.size === "large",
|
|
151
|
+
"c-input-row--disabled": N.value.disabled
|
|
154
152
|
}]),
|
|
155
|
-
"aria-disabled":
|
|
156
|
-
onClick:
|
|
153
|
+
"aria-disabled": N.value.disabled || void 0,
|
|
154
|
+
onClick: a[1] ||= (e) => de()
|
|
157
155
|
}, [
|
|
158
|
-
|
|
159
|
-
|
|
156
|
+
G.value ? (m(), c("span", C, _(G.value), 1)) : (m(), c("span", te, _(N.value.placeholder), 1)),
|
|
157
|
+
N.value.clearable && B.value.length > 0 ? (m(), c("button", {
|
|
160
158
|
key: 2,
|
|
161
159
|
type: "button",
|
|
162
160
|
class: "c-icon-btn c-icon-btn--clear ds-clear-btn",
|
|
163
|
-
onClick:
|
|
161
|
+
onClick: a[0] ||= b((e) => fe(), ["stop"]),
|
|
164
162
|
"aria-label": "Törlés"
|
|
165
|
-
}, [...
|
|
166
|
-
|
|
167
|
-
], 10,
|
|
163
|
+
}, [...a[6] ||= [l("i", { class: "fa-solid fa-fw fa-xmark" }, null, -1)]])) : s("", !0),
|
|
164
|
+
l("span", { class: p(["c-icon-btn c-icon-btn--chevron mr-2", { "c-icon-btn--chevron-open": v(V) }]) }, [...a[7] ||= [l("i", { class: "fa-solid fa-fw fa-chevron-down" }, null, -1)]], 2)
|
|
165
|
+
], 10, S)], 512), (m(), o(i, { to: "body" }, [l("div", ne, [v(V) ? (m(), c("div", {
|
|
168
166
|
key: 0,
|
|
169
|
-
|
|
167
|
+
ref_key: "dropdownRef",
|
|
168
|
+
ref: L,
|
|
169
|
+
class: p(["c-dropdown ds-dropdown ds-wrapper", { "ds-dropdown--multiple": N.value.multiple }]),
|
|
170
|
+
style: ee(v(H))
|
|
170
171
|
}, [
|
|
171
|
-
|
|
172
|
-
|
|
172
|
+
N.value.filterable ? (m(), c("div", re, [
|
|
173
|
+
N.value.multiple ? (m(), c("span", {
|
|
173
174
|
key: 0,
|
|
174
|
-
class:
|
|
175
|
-
onClick:
|
|
176
|
-
title:
|
|
177
|
-
}, null, 10,
|
|
178
|
-
|
|
175
|
+
class: p(["c-checkbox ds-select-all-checkbox", { "c-checkbox--checked": Y.value }]),
|
|
176
|
+
onClick: a[2] ||= b((e) => ce(), ["stop"]),
|
|
177
|
+
title: Y.value ? "Összes kijelölés törlése" : "Összes kijelölése"
|
|
178
|
+
}, null, 10, w)) : s("", !0),
|
|
179
|
+
l("input", {
|
|
179
180
|
ref_key: "filterInputRef",
|
|
180
|
-
ref:
|
|
181
|
+
ref: R,
|
|
181
182
|
type: "text",
|
|
182
183
|
id: "ds-filter-input",
|
|
183
184
|
class: "c-focus ds-filter-input",
|
|
184
185
|
value: F.value,
|
|
185
|
-
onInput:
|
|
186
|
+
onInput: a[3] ||= (e) => W(e.target.value),
|
|
186
187
|
autocomplete: "off",
|
|
187
|
-
placeholder:
|
|
188
|
-
onClick:
|
|
189
|
-
}, null, 40,
|
|
190
|
-
F.value ? (
|
|
188
|
+
placeholder: N.value.filterPlaceholder,
|
|
189
|
+
onClick: a[4] ||= b(() => {}, ["stop"])
|
|
190
|
+
}, null, 40, T),
|
|
191
|
+
F.value ? (m(), c("button", {
|
|
191
192
|
key: 1,
|
|
192
193
|
type: "button",
|
|
193
194
|
class: "c-icon-btn c-icon-btn--clear ds-filter-clear",
|
|
194
|
-
onClick:
|
|
195
|
+
onClick: a[5] ||= b((e) => me(), ["stop"]),
|
|
195
196
|
"aria-label": "Szűrők törlése"
|
|
196
|
-
}, [...
|
|
197
|
-
])) :
|
|
198
|
-
|
|
197
|
+
}, [...a[8] ||= [l("i", { class: "fa-solid fa-xmark" }, null, -1)]])) : s("", !0)
|
|
198
|
+
])) : s("", !0),
|
|
199
|
+
l("ul", E, [N.value.loading ? (m(), c("li", ie, [u(n, {
|
|
199
200
|
size: "2rem",
|
|
200
201
|
color: "var(--neutral-300)",
|
|
201
202
|
class: "m-auto p-3"
|
|
202
|
-
})])) : (
|
|
203
|
+
})])) : (m(), c(r, { key: 1 }, [(m(!0), c(r, null, g(K.value, (e, t) => (m(), c("li", {
|
|
203
204
|
key: e.value ?? `cb-${t}`,
|
|
204
|
-
class:
|
|
205
|
+
class: p(["d-option ds-option", { "ds-option--selected": e.value && X(e.value) }]),
|
|
205
206
|
tabindex: "0",
|
|
206
|
-
onClick: (t) =>
|
|
207
|
-
onKeydown: (t) =>
|
|
207
|
+
onClick: (t) => Q(e),
|
|
208
|
+
onKeydown: (t) => ue(t, e)
|
|
208
209
|
}, [
|
|
209
|
-
|
|
210
|
+
N.value.multiple && e.value ? (m(), c("span", {
|
|
210
211
|
key: 0,
|
|
211
|
-
class:
|
|
212
|
-
}, null, 2)) :
|
|
213
|
-
e.icon ? (
|
|
212
|
+
class: p(["c-checkbox", { "c-checkbox--checked": X(e.value) }])
|
|
213
|
+
}, null, 2)) : s("", !0),
|
|
214
|
+
e.icon ? (m(), c("i", {
|
|
214
215
|
key: 1,
|
|
215
|
-
class:
|
|
216
|
-
}, null, 2)) :
|
|
217
|
-
|
|
218
|
-
class:
|
|
219
|
-
innerHTML:
|
|
220
|
-
}, null, 10,
|
|
221
|
-
], 42,
|
|
222
|
-
|
|
216
|
+
class: p(["fa-fw", e.icon])
|
|
217
|
+
}, null, 2)) : s("", !0),
|
|
218
|
+
l("span", {
|
|
219
|
+
class: p(["d-option__label", { "c-truncate": N.value.textEllipsis }]),
|
|
220
|
+
innerHTML: se(e.label)
|
|
221
|
+
}, null, 10, oe)
|
|
222
|
+
], 42, ae))), 128)), K.value.length === 0 ? (m(), c("li", D, " Nincs találat ")) : s("", !0)], 64))]),
|
|
223
|
+
N.value.multiple ? (m(), c("div", O, [N.value.clearable && B.value.length > 0 ? (m(), o(e, {
|
|
223
224
|
key: 0,
|
|
224
225
|
label: "Törlés",
|
|
225
226
|
outline: "",
|
|
226
|
-
onClick:
|
|
227
|
-
})) :
|
|
228
|
-
key: 1,
|
|
227
|
+
onClick: le
|
|
228
|
+
})) : s("", !0), u(e, {
|
|
229
229
|
label: "OK",
|
|
230
230
|
type: "success",
|
|
231
|
-
onClick:
|
|
232
|
-
})
|
|
233
|
-
],
|
|
231
|
+
onClick: $
|
|
232
|
+
})])) : s("", !0)
|
|
233
|
+
], 6)) : s("", !0)])]))]));
|
|
234
234
|
}
|
|
235
235
|
});
|
|
236
236
|
//#endregion
|
|
237
|
-
export {
|
|
237
|
+
export { A as default, k as dropdownSelectConfigDefaults };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admins-components26.js","names":[],"sources":["../src/components/DropdownSelect.vue"],"sourcesContent":["<script lang=\"ts\">\nexport interface DropdownSelectConfig {\n placeholder?: string\n filterable?: boolean\n filterPlaceholder?: string\n clearable?: boolean\n textEllipsis?: boolean\n multiple?: boolean\n lazy?: boolean\n size?: ControlSize\n loading?: boolean\n highlight?: boolean\n disabled?: boolean\n}\n\nexport const dropdownSelectConfigDefaults: DropdownSelectConfig = {\n placeholder: 'Válassz...',\n filterable: true,\n filterPlaceholder: 'Kezdj el gépelni...',\n clearable: true,\n textEllipsis: true,\n multiple: false,\n lazy: false,\n loading: false,\n size: 'normal' as ControlSize,\n highlight: true,\n disabled: false,\n}\n\nexport interface DropdownOption {\n icon?: string\n value?: string\n label: string\n callback?: () => void\n}\n\nexport interface DropdownSelectProps {\n modelValue?: DropdownOption | DropdownOption[] | string | string[] | null\n options: DropdownOption[]\n config?: DropdownSelectConfig\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { ref, computed, watch, nextTick, onMounted, onBeforeUnmount } from 'vue'\nimport Button from '@/components/Button.vue'\nimport type { ControlSize } from '@/types/types'\nimport Loader from '@/components/Loader.vue'\n\nconst props = withDefaults(defineProps<DropdownSelectProps>(), {\n modelValue: null,\n config: () => ({ ...dropdownSelectConfigDefaults }),\n})\n\nconst cfg = computed(() => ({ ...dropdownSelectConfigDefaults, ...props.config }))\n\nconst emit = defineEmits<{\n 'update:modelValue': [value: DropdownOption | DropdownOption[] | null]\n 'filter-input': [filterText: string]\n}>()\n\nconst isOpen = ref(false)\nconst filterText = ref('')\nconst wrapperRef = ref<HTMLElement | null>(null)\nconst filterInputRef = ref<HTMLInputElement | null>(null)\nconst buffer = ref<DropdownOption[]>([])\nconst selection = ref<DropdownOption[]>(normalizeToOptions(props.modelValue, props.options))\n\n\nfunction normalizeToOptions(\n val: DropdownOption | DropdownOption[] | string | string[] | null | undefined,\n options: DropdownOption[],\n): DropdownOption[] {\n if (val == null) return []\n const arr = Array.isArray(val) ? val : [val]\n return arr\n .map((entry): DropdownOption | null => {\n if (entry == null) return null\n if (typeof entry === 'object' && 'label' in entry) {\n return entry as DropdownOption\n }\n if (typeof entry === 'string') {\n const found = options.find((o) => o.value === entry)\n return found ?? { value: entry, label: entry }\n }\n return null\n })\n .filter((o): o is DropdownOption => o !== null)\n}\n\nwatch(\n () => [props.modelValue, props.options],\n ([v]) => {\n selection.value = normalizeToOptions(v as typeof props.modelValue, props.options)\n },\n)\n\nwatch(isOpen, (open) => {\n if (open) {\n filterText.value = ''\n if (cfg.value.filterable) nextTick(() => filterInputRef.value?.focus())\n if (cfg.value.lazy) buffer.value = [...selection.value]\n }\n})\n\nfunction onFilterInput(text: string) {\n filterText.value = text\n emit('filter-input', text)\n //debouncedEmit(text)\n}\n\n/* const debouncedEmit = debounce((raw: string) => {\n emit('filter-input', raw)\n}) */\n\n// Display\nconst selectedLabel = computed(() => {\n if (selection.value.length === 0) return null\n if (!cfg.value.multiple) {\n const sel = selection.value[0]\n // Prefer the label from the live options list, fall back to the stored label\n return props.options.find((o) => o.value === sel?.value)?.label ?? sel?.label ?? null\n }\n if (selection.value.length > 2) return `${selection.value.length} kiválasztva`\n return selection.value\n .map((sel) => props.options.find((o) => o.value === sel.value)?.label ?? sel.label ?? sel.value)\n .join(', ')\n})\n\nconst filteredOptions = computed(() => {\n const q = filterText.value.toLowerCase()\n return q ? props.options.filter((o) => o.label.toLowerCase().includes(q)) : props.options\n})\n\nfunction escapeHtml(str: string) {\n return str.replace(\n /[&<>\"']/g,\n (m) => ({ '&': '&', '<': '<', '>': '>', '\"': '"', \"'\": ''' })[m]!,\n )\n}\n\nfunction highlight(label: string) {\n const q = filterText.value.trim()\n if (!q || !cfg.value.highlight) return escapeHtml(label)\n\n const safeLabel = escapeHtml(label)\n const safeQ = escapeHtml(q)\n\n const re = new RegExp(safeQ.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'), 'ig')\n return safeLabel.replace(re, (m) => `<mark class=\"ds-option__highlight\">${m}</mark>`)\n}\n\nconst selectableOptions = computed(() => {\n return filteredOptions.value.filter((o) => o.value)\n})\n\nconst allOptionsSelected = computed(() => {\n if (selectableOptions.value.length === 0) return false\n const currentList = cfg.value.lazy && isOpen.value ? buffer.value : selection.value\n return selectableOptions.value.every((o) => o.value && currentList.some((s) => s.value === o.value))\n})\n\nfunction isSelected(value: string): boolean {\n const list = cfg.value.lazy && isOpen.value ? buffer : selection\n return list.value.some((s) => s.value === value)\n}\n\nfunction toggleAllOptions() {\n const currentList = cfg.value.lazy && isOpen.value ? buffer : selection\n const selectableOpts = selectableOptions.value.filter((o) => o.value)\n\n if (allOptionsSelected.value) {\n const selectableValues = new Set(selectableOpts.map((o) => o.value as string))\n currentList.value = currentList.value.filter((s) => !selectableValues.has(s.value ?? ''))\n } else {\n const existingValues = new Set(currentList.value.map((s) => s.value))\n const toAdd = selectableOpts.filter((o) => !existingValues.has(o.value as string))\n currentList.value = [...currentList.value, ...toAdd]\n }\n\n if (!cfg.value.lazy) {\n emit('update:modelValue', selection.value.length > 0 ? [...selection.value] : null)\n }\n}\n\n// Actions\nfunction toggleList(list: DropdownOption[], opt: DropdownOption): DropdownOption[] {\n const idx = list.findIndex((s) => s.value === opt.value)\n return idx >= 0 ? list.filter((_, i) => i !== idx) : [...list, opt]\n}\n\nfunction selectOption(opt: DropdownOption) {\n if (opt.callback) {\n opt.callback()\n isOpen.value = false\n return\n }\n\n const value = opt.value\n if (!value) return\n\n if (cfg.value.multiple) {\n if (cfg.value.lazy) {\n buffer.value = toggleList(buffer.value, opt)\n } else {\n selection.value = toggleList(selection.value, opt)\n emit('update:modelValue', selection.value.length > 0 ? [...selection.value] : null)\n }\n } else {\n selection.value = [opt]\n emit('update:modelValue', opt)\n isOpen.value = false\n }\n}\n\nfunction confirm() {\n if (cfg.value.lazy) {\n selection.value = [...buffer.value]\n emit('update:modelValue', buffer.value.length > 0 ? [...buffer.value] : null)\n }\n isOpen.value = false\n}\n\nfunction clear() {\n if (cfg.value.lazy) {\n buffer.value = []\n } else {\n selection.value = []\n emit('update:modelValue', null)\n }\n}\n\nfunction onOptionKeydown(e: KeyboardEvent, opt: DropdownOption) {\n if (e.key === ' ') {\n e.preventDefault()\n selectOption(opt)\n } else if (e.key === 'Enter') {\n e.preventDefault()\n confirm()\n }\n}\n\nfunction onClickOutside(e: MouseEvent) {\n if (wrapperRef.value && !wrapperRef.value.contains(e.target as Node)) isOpen.value = false\n}\n\nonMounted(() => document.addEventListener('mousedown', onClickOutside))\nonBeforeUnmount(() => {\n document.removeEventListener('mousedown', onClickOutside)\n})\n\nfunction toggleOpen() {\n if (cfg.value.disabled) return\n isOpen.value = !isOpen.value\n if (isOpen.value) {\n if (cfg.value.filterable) {\n filterText.value = ''\n emit('filter-input', '')\n }\n }\n}\n\nfunction clearInput() {\n if (cfg.value.disabled) return\n selection.value = []\n emit('update:modelValue', null)\n isOpen.value = false\n}\n\nfunction focusAndOpen() {\n if (cfg.value.disabled) return\n isOpen.value = true\n if (cfg.value.filterable) nextTick(() => filterInputRef.value?.focus())\n}\n\nfunction handleFilterClear() {\n filterText.value = ''\n emit('filter-input', '')\n}\n\ndefineExpose({ focusAndOpen })\n</script>\n\n<template>\n <div class=\"ac-component\">\n <div ref=\"wrapperRef\" class=\"c-wrapper ds-wrapper\">\n <div\n class=\"c-input-row pointer\"\n :class=\"{\n 'c-input-row--sm': cfg.size === 'small',\n 'c-input-row--lg': cfg.size === 'large',\n 'c-input-row--disabled': cfg.disabled,\n }\"\n :aria-disabled=\"cfg.disabled || undefined\"\n @click=\"toggleOpen()\"\n >\n <span v-if=\"selectedLabel\" class=\"c-truncate ds-value\">{{ selectedLabel }}</span>\n <span v-else class=\"c-placeholder\">{{ cfg.placeholder }}</span>\n <button\n v-if=\"cfg.clearable && selection.length > 0\"\n type=\"button\"\n class=\"c-icon-btn c-icon-btn--clear ds-clear-btn\"\n @click.stop=\"clearInput()\"\n aria-label=\"Törlés\"\n >\n <i class=\"fa-solid fa-fw fa-xmark\"></i>\n </button>\n <span\n class=\"c-icon-btn c-icon-btn--chevron mr-2\"\n :class=\"{ 'c-icon-btn--chevron-open': isOpen }\"\n >\n <i class=\"fa-solid fa-fw fa-chevron-down\"></i>\n </span>\n </div>\n\n <div\n v-if=\"isOpen\"\n class=\"c-dropdown ds-dropdown ac-component\"\n :class=\"{ 'ds-dropdown--multiple': cfg.multiple }\"\n >\n <div v-if=\"cfg.filterable\" class=\"ds-filter\">\n <span\n v-if=\"cfg.multiple\"\n class=\"c-checkbox ds-select-all-checkbox\"\n :class=\"{ 'c-checkbox--checked': allOptionsSelected }\"\n @click.stop=\"toggleAllOptions()\"\n :title=\"allOptionsSelected ? 'Összes kijelölés törlése' : 'Összes kijelölése'\"\n ></span>\n <input\n ref=\"filterInputRef\"\n type=\"text\"\n id=\"ds-filter-input\"\n class=\"c-focus ds-filter-input\"\n :value=\"filterText\"\n @input=\"onFilterInput(($event.target as HTMLInputElement).value)\"\n autocomplete=\"off\"\n :placeholder=\"cfg.filterPlaceholder\"\n @click.stop\n />\n <button\n v-if=\"filterText\"\n type=\"button\"\n class=\"c-icon-btn c-icon-btn--clear ds-filter-clear\"\n @click.stop=\"handleFilterClear()\"\n aria-label=\"Szűrők törlése\"\n >\n <i class=\"fa-solid fa-xmark\"></i>\n </button>\n </div>\n\n <ul class=\"ds-options c-scroll\">\n <li v-if=\"cfg.loading\" class=\"ds-option ds-option--loading\">\n <Loader size=\"2rem\" color=\"var(--neutral-300)\" class=\"m-auto p-3\" />\n </li>\n <template v-else>\n <li\n v-for=\"(opt, idx) in filteredOptions\"\n :key=\"opt.value ?? `cb-${idx}`\"\n class=\"d-option ds-option\"\n :class=\"{ 'ds-option--selected': opt.value && isSelected(opt.value) }\"\n tabindex=\"0\"\n @click=\"selectOption(opt)\"\n @keydown=\"onOptionKeydown($event, opt)\"\n >\n <span\n v-if=\"cfg.multiple && opt.value\"\n class=\"c-checkbox\"\n :class=\"{ 'c-checkbox--checked': isSelected(opt.value) }\"\n ></span>\n <i v-if=\"opt.icon\" class=\"fa-fw\" :class=\"opt.icon\"></i>\n <span\n class=\"d-option__label\"\n :class=\"{ 'c-truncate': cfg.textEllipsis }\"\n v-html=\"highlight(opt.label)\"\n ></span>\n </li>\n <li v-if=\"filteredOptions.length === 0\" class=\"ds-option ds-option--empty\">\n Nincs találat\n </li>\n </template>\n </ul>\n\n <div v-if=\"cfg.multiple || (cfg.clearable && selection.length > 0)\" class=\"c-footer\">\n <Button v-if=\"cfg.clearable\" label=\"Törlés\" outline @click=\"clear\" />\n <Button v-if=\"cfg.multiple\" label=\"OK\" type=\"success\" @click=\"confirm\" />\n </div>\n </div>\n </div>\n </div>\n</template>\n\n<style lang=\"scss\" src=\"@/styles/components/dropdown-select.scss\"></style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;GAea,IAAqD;CAChE,aAAa;CACb,YAAY;CACZ,mBAAmB;CACnB,WAAW;CACX,cAAc;CACd,UAAU;CACV,MAAM;CACN,SAAS;CACT,MAAM;CACN,WAAW;CACX,UAAU;AACZ;;;;;;;;;EAsBA,IAAM,IAAQ,GAKR,IAAM,SAAgB;GAAE,GAAG;GAA8B,GAAG,EAAM;EAAO,EAAE,GAE3E,IAAO,GAKP,IAAS,EAAI,EAAK,GAClB,IAAa,EAAI,EAAE,GACnB,IAAa,EAAwB,IAAI,GACzC,IAAiB,EAA6B,IAAI,GAClD,IAAS,EAAsB,C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EAAA,MAAgB,WAAM,KAAA,EAAA,GAAhC,EAEK,MAFL,GAA2E,iBAE3E,KAAA,EAAA,IAAA,EAAA,CAAA,GAAA,EAAA,EAAA,CAAA;GAIO,EAAA,MAAI,YAAa,EAAA,MAAI,aAAa,EAAA,MAAU,SAAM,KAAA,EAAA,GAA7D,EAGM,OAHN,GAGM,CAFU,EAAA,MAAI,aAAA,EAAA,GAAlB,EAAqE,GAAA;;IAAxC,OAAM;IAAS,SAAA;IAAS,SAAO;oBAC9C,EAAA,MAAI,YAAA,EAAA,GAAlB,EAAyE,GAAA;;IAA7C,OAAM;IAAK,MAAK;IAAW,SAAO"}
|
|
1
|
+
{"version":3,"file":"admins-components26.js","names":[],"sources":["../src/components/DropdownSelect.vue"],"sourcesContent":["<script lang=\"ts\">\nexport interface DropdownSelectConfig {\n placeholder?: string\n filterable?: boolean\n filterPlaceholder?: string\n clearable?: boolean\n textEllipsis?: boolean\n multiple?: boolean\n lazy?: boolean\n size?: ControlSize\n loading?: boolean\n highlight?: boolean\n disabled?: boolean\n}\n\nexport const dropdownSelectConfigDefaults: DropdownSelectConfig = {\n placeholder: 'Válassz...',\n filterable: true,\n filterPlaceholder: 'Kezdj el gépelni...',\n clearable: true,\n textEllipsis: true,\n multiple: false,\n lazy: false,\n loading: false,\n size: 'normal' as ControlSize,\n highlight: true,\n disabled: false,\n}\n\nexport interface DropdownOption {\n icon?: string\n value?: string\n label: string\n callback?: () => void\n}\n\nexport interface DropdownSelectProps {\n modelValue?: DropdownOption | DropdownOption[] | string | string[] | null\n options: DropdownOption[]\n config?: DropdownSelectConfig\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { ref, computed, watch, nextTick } from 'vue'\nimport Button from '@/components/Button.vue'\nimport type { ControlSize } from '@/types/types'\nimport Loader from '@/components/Loader.vue'\nimport { useDropdownAnchor } from '@/composables/useDropdownAnchor'\n\nconst props = withDefaults(defineProps<DropdownSelectProps>(), {\n modelValue: null,\n config: () => ({ ...dropdownSelectConfigDefaults }),\n})\n\nconst cfg = computed(() => ({ ...dropdownSelectConfigDefaults, ...props.config }))\n\nconst emit = defineEmits<{\n 'update:modelValue': [value: DropdownOption | DropdownOption[] | null]\n 'filter-input': [filterText: string]\n}>()\n\nconst filterText = ref('')\nconst wrapperRef = ref<HTMLElement | null>(null)\nconst dropdownRef = ref<HTMLElement | null>(null)\nconst filterInputRef = ref<HTMLInputElement | null>(null)\nconst buffer = ref<DropdownOption[]>([])\nconst selection = ref<DropdownOption[]>(normalizeToOptions(props.modelValue, props.options))\n\nconst { isOpen, dropdownStyle } = useDropdownAnchor(wrapperRef, dropdownRef, {\n extraStyle: (rect) => ({\n minWidth: `${rect.width}px`,\n maxWidth: `${rect.width * 1.5}px`,\n }),\n})\n\n\nfunction normalizeToOptions(\n val: DropdownOption | DropdownOption[] | string | string[] | null | undefined,\n options: DropdownOption[],\n): DropdownOption[] {\n if (val == null) return []\n const arr = Array.isArray(val) ? val : [val]\n return arr\n .map((entry): DropdownOption | null => {\n if (entry == null) return null\n if (typeof entry === 'object' && 'label' in entry) {\n return entry as DropdownOption\n }\n if (typeof entry === 'string') {\n const found = options.find((o) => o.value === entry)\n return found ?? { value: entry, label: entry }\n }\n return null\n })\n .filter((o): o is DropdownOption => o !== null)\n}\n\nwatch(\n () => [props.modelValue, props.options],\n ([v]) => {\n selection.value = normalizeToOptions(v as typeof props.modelValue, props.options)\n },\n)\n\nwatch(isOpen, (open) => {\n if (open) {\n filterText.value = ''\n if (cfg.value.filterable) nextTick(() => filterInputRef.value?.focus())\n if (cfg.value.lazy) buffer.value = [...selection.value]\n }\n})\n\nfunction onFilterInput(text: string) {\n filterText.value = text\n emit('filter-input', text)\n}\n\nconst selectedLabel = computed(() => {\n if (selection.value.length === 0) return null\n if (!cfg.value.multiple) {\n const sel = selection.value[0]\n\n return props.options.find((o) => o.value === sel?.value)?.label ?? sel?.label ?? null\n }\n if (selection.value.length > 2) return `${selection.value.length} kiválasztva`\n return selection.value\n .map((sel) => props.options.find((o) => o.value === sel.value)?.label ?? sel.label ?? sel.value)\n .join(', ')\n})\n\nconst filteredOptions = computed(() => {\n const q = filterText.value.toLowerCase()\n return q ? props.options.filter((o) => o.label.toLowerCase().includes(q)) : props.options\n})\n\nfunction escapeHtml(str: string) {\n return str.replace(\n /[&<>\"']/g,\n (m) => ({ '&': '&', '<': '<', '>': '>', '\"': '"', \"'\": ''' })[m]!,\n )\n}\n\nfunction highlight(label: string) {\n const q = filterText.value.trim()\n if (!q || !cfg.value.highlight) return escapeHtml(label)\n\n const safeLabel = escapeHtml(label)\n const safeQ = escapeHtml(q)\n\n const re = new RegExp(safeQ.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'), 'ig')\n return safeLabel.replace(re, (m) => `<mark class=\"ds-option__highlight\">${m}</mark>`)\n}\n\nconst selectableOptions = computed(() => {\n return filteredOptions.value.filter((o) => o.value)\n})\n\nconst allOptionsSelected = computed(() => {\n if (selectableOptions.value.length === 0) return false\n const currentList = cfg.value.lazy && isOpen.value ? buffer.value : selection.value\n return selectableOptions.value.every((o) => o.value && currentList.some((s) => s.value === o.value))\n})\n\nfunction isSelected(value: string): boolean {\n const list = cfg.value.lazy && isOpen.value ? buffer : selection\n return list.value.some((s) => s.value === value)\n}\n\nfunction toggleAllOptions() {\n const currentList = cfg.value.lazy && isOpen.value ? buffer : selection\n const selectableOpts = selectableOptions.value.filter((o) => o.value)\n\n if (allOptionsSelected.value) {\n const selectableValues = new Set(selectableOpts.map((o) => o.value as string))\n currentList.value = currentList.value.filter((s) => !selectableValues.has(s.value ?? ''))\n } else {\n const existingValues = new Set(currentList.value.map((s) => s.value))\n const toAdd = selectableOpts.filter((o) => !existingValues.has(o.value as string))\n currentList.value = [...currentList.value, ...toAdd]\n }\n\n if (!cfg.value.lazy) {\n emit('update:modelValue', selection.value.length > 0 ? [...selection.value] : null)\n }\n}\n\nfunction toggleList(list: DropdownOption[], opt: DropdownOption): DropdownOption[] {\n const idx = list.findIndex((s) => s.value === opt.value)\n return idx >= 0 ? list.filter((_, i) => i !== idx) : [...list, opt]\n}\n\nfunction selectOption(opt: DropdownOption) {\n if (opt.callback) {\n opt.callback()\n isOpen.value = false\n return\n }\n\n const value = opt.value\n if (!value) return\n\n if (cfg.value.multiple) {\n if (cfg.value.lazy) {\n buffer.value = toggleList(buffer.value, opt)\n } else {\n selection.value = toggleList(selection.value, opt)\n emit('update:modelValue', selection.value.length > 0 ? [...selection.value] : null)\n }\n } else {\n selection.value = [opt]\n emit('update:modelValue', opt)\n isOpen.value = false\n }\n}\n\nfunction confirm() {\n if (cfg.value.lazy) {\n selection.value = [...buffer.value]\n emit('update:modelValue', buffer.value.length > 0 ? [...buffer.value] : null)\n }\n isOpen.value = false\n}\n\nfunction clear() {\n if (cfg.value.lazy) {\n buffer.value = []\n } else {\n selection.value = []\n emit('update:modelValue', null)\n }\n}\n\nfunction onOptionKeydown(e: KeyboardEvent, opt: DropdownOption) {\n if (e.key === ' ') {\n e.preventDefault()\n selectOption(opt)\n } else if (e.key === 'Enter') {\n e.preventDefault()\n confirm()\n }\n}\n\nfunction toggleOpen() {\n if (cfg.value.disabled) return\n isOpen.value = !isOpen.value\n if (isOpen.value) {\n if (cfg.value.filterable) {\n filterText.value = ''\n emit('filter-input', '')\n }\n }\n}\n\nfunction clearInput() {\n if (cfg.value.disabled) return\n selection.value = []\n emit('update:modelValue', null)\n isOpen.value = false\n}\n\nfunction focusAndOpen() {\n if (cfg.value.disabled) return\n isOpen.value = true\n if (cfg.value.filterable) nextTick(() => filterInputRef.value?.focus())\n}\n\nfunction handleFilterClear() {\n filterText.value = ''\n emit('filter-input', '')\n}\n\ndefineExpose({ focusAndOpen })\n</script>\n\n<template>\n <div class=\"ac-component\">\n <div ref=\"wrapperRef\" class=\"c-wrapper ds-wrapper\">\n <div\n class=\"c-input-row pointer\"\n :class=\"{\n 'c-input-row--sm': cfg.size === 'small',\n 'c-input-row--lg': cfg.size === 'large',\n 'c-input-row--disabled': cfg.disabled,\n }\"\n :aria-disabled=\"cfg.disabled || undefined\"\n @click=\"toggleOpen()\"\n >\n <span v-if=\"selectedLabel\" class=\"c-truncate ds-value\">{{ selectedLabel }}</span>\n <span v-else class=\"c-placeholder\">{{ cfg.placeholder }}</span>\n <button\n v-if=\"cfg.clearable && selection.length > 0\"\n type=\"button\"\n class=\"c-icon-btn c-icon-btn--clear ds-clear-btn\"\n @click.stop=\"clearInput()\"\n aria-label=\"Törlés\"\n >\n <i class=\"fa-solid fa-fw fa-xmark\"></i>\n </button>\n <span\n class=\"c-icon-btn c-icon-btn--chevron mr-2\"\n :class=\"{ 'c-icon-btn--chevron-open': isOpen }\"\n >\n <i class=\"fa-solid fa-fw fa-chevron-down\"></i>\n </span>\n </div>\n </div>\n <Teleport to=\"body\">\n <div class=\"ac-component\">\n <div\n v-if=\"isOpen\"\n ref=\"dropdownRef\"\n class=\"c-dropdown ds-dropdown ds-wrapper\"\n :class=\"{ 'ds-dropdown--multiple': cfg.multiple }\"\n :style=\"dropdownStyle\"\n >\n <div v-if=\"cfg.filterable\" class=\"ds-filter\">\n <span\n v-if=\"cfg.multiple\"\n class=\"c-checkbox ds-select-all-checkbox\"\n :class=\"{ 'c-checkbox--checked': allOptionsSelected }\"\n @click.stop=\"toggleAllOptions()\"\n :title=\"allOptionsSelected ? 'Összes kijelölés törlése' : 'Összes kijelölése'\"\n ></span>\n <input\n ref=\"filterInputRef\"\n type=\"text\"\n id=\"ds-filter-input\"\n class=\"c-focus ds-filter-input\"\n :value=\"filterText\"\n @input=\"onFilterInput(($event.target as HTMLInputElement).value)\"\n autocomplete=\"off\"\n :placeholder=\"cfg.filterPlaceholder\"\n @click.stop\n />\n <button\n v-if=\"filterText\"\n type=\"button\"\n class=\"c-icon-btn c-icon-btn--clear ds-filter-clear\"\n @click.stop=\"handleFilterClear()\"\n aria-label=\"Szűrők törlése\"\n >\n <i class=\"fa-solid fa-xmark\"></i>\n </button>\n </div>\n\n <ul class=\"ds-options c-scroll\">\n <li v-if=\"cfg.loading\" class=\"ds-option ds-option--loading\">\n <Loader size=\"2rem\" color=\"var(--neutral-300)\" class=\"m-auto p-3\" />\n </li>\n <template v-else>\n <li\n v-for=\"(opt, idx) in filteredOptions\"\n :key=\"opt.value ?? `cb-${idx}`\"\n class=\"d-option ds-option\"\n :class=\"{ 'ds-option--selected': opt.value && isSelected(opt.value) }\"\n tabindex=\"0\"\n @click=\"selectOption(opt)\"\n @keydown=\"onOptionKeydown($event, opt)\"\n >\n <span\n v-if=\"cfg.multiple && opt.value\"\n class=\"c-checkbox\"\n :class=\"{ 'c-checkbox--checked': isSelected(opt.value) }\"\n ></span>\n <i v-if=\"opt.icon\" class=\"fa-fw\" :class=\"opt.icon\"></i>\n <span\n class=\"d-option__label\"\n :class=\"{ 'c-truncate': cfg.textEllipsis }\"\n v-html=\"highlight(opt.label)\"\n ></span>\n </li>\n <li v-if=\"filteredOptions.length === 0\" class=\"ds-option ds-option--empty\">\n Nincs találat\n </li>\n </template>\n </ul>\n <div v-if=\"cfg.multiple\" class=\"c-footer\">\n <Button v-if=\"cfg.clearable && selection.length > 0\" label=\"Törlés\" outline @click=\"clear\" />\n <Button label=\"OK\" type=\"success\" @click=\"confirm\" />\n </div>\n </div>\n </div>\n </Teleport>\n </div>\n</template>\n\n<style lang=\"scss\" src=\"@/styles/components/dropdown-select.scss\"></style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;GAea,IAAqD;CAChE,aAAa;CACb,YAAY;CACZ,mBAAmB;CACnB,WAAW;CACX,cAAc;CACd,UAAU;CACV,MAAM;CACN,SAAS;CACT,MAAM;CACN,WAAW;CACX,UAAU;AACZ;;;;;;;;;EAuBA,IAAM,IAAQ,GAKR,IAAM,SAAgB;GAAE,GAAG;GAA8B,GAAG,EAAM;EAAO,EAAE,GAE3E,IAAO,GAKP,IAAa,EAAI,EAAE,GACnB,IAAa,EAAwB,IAAI,GACzC,IAAc,EAAwB,IAAI,GAC1C,IAAiB,EAA6B,IAAI,GAClD,IAAS,EAAs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EAAA,MAAI,YAAY,EAAI,SAD5B,EAAA,GAAA,EAIQ,QAAA;;KAFN,OAAK,EAAA,CAAC,cAAY,EAAA,uBACe,EAAW,EAAI,KAAK,EAAA,CAAA,CAAA;;IAE9C,EAAI,QAAb,EAAA,GAAA,EAAuD,KAAA;;KAApC,OAAK,EAAA,CAAC,SAAgB,EAAI,IAAI,CAAA;;IACjD,EAIQ,QAAA;KAHN,OAAK,EAAA,CAAC,mBAAiB,EAAA,cACC,EAAA,MAAI,aAAY,CAAA,CAAA;KACxC,WAAQ,GAAU,EAAI,KAAK;;cAGrB,GAAA,GAAA,IAAA,EAAA,MAAgB,WAAM,KAAhC,EAAA,GAAA,EAEK,MAFL,GAA2E,iBAE3E,KAAA,EAAA,IAAA,EAAA,CAAA,GAAA,EAAA,EAAA,CAAA;GAGO,EAAA,MAAI,YAAf,EAAA,GAAA,EAGM,OAHN,GAGM,CAFU,EAAA,MAAI,aAAa,EAAA,MAAU,SAAM,KAA/C,EAAA,GAAA,EAA6F,GAAA;;IAAxC,OAAM;IAAS,SAAA;IAAS,SAAO;GACpF,CAAA,KAAA,EAAA,IAAA,EAAA,GAAA,EAAqD,GAAA;IAA7C,OAAM;IAAK,MAAK;IAAW,SAAO"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import './
|
|
2
|
-
import e from "./admins-components26.js";
|
|
1
|
+
import './styles/components/dropdown-select.scss_vue_type_style_index_0_src_true_lang.css';
|
|
2
|
+
import e, { dropdownSelectConfigDefaults as t } from "./admins-components26.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
//#region src/components/DropdownSelect.vue
|
|
5
|
-
var
|
|
5
|
+
var n = e;
|
|
6
6
|
//#endregion
|
|
7
|
-
export {
|
|
7
|
+
export { n as default, t as dropdownSelectConfigDefaults };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admins-components28.js","names":[],"sources":["../src/components/DropdownSelect.vue"],"sourcesContent":["<script lang=\"ts\">\nexport interface DropdownSelectConfig {\n placeholder?: string\n filterable?: boolean\n filterPlaceholder?: string\n clearable?: boolean\n textEllipsis?: boolean\n multiple?: boolean\n lazy?: boolean\n size?: ControlSize\n loading?: boolean\n highlight?: boolean\n disabled?: boolean\n}\n\nexport const dropdownSelectConfigDefaults: DropdownSelectConfig = {\n placeholder: 'Válassz...',\n filterable: true,\n filterPlaceholder: 'Kezdj el gépelni...',\n clearable: true,\n textEllipsis: true,\n multiple: false,\n lazy: false,\n loading: false,\n size: 'normal' as ControlSize,\n highlight: true,\n disabled: false,\n}\n\nexport interface DropdownOption {\n icon?: string\n value?: string\n label: string\n callback?: () => void\n}\n\nexport interface DropdownSelectProps {\n modelValue?: DropdownOption | DropdownOption[] | string | string[] | null\n options: DropdownOption[]\n config?: DropdownSelectConfig\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { ref, computed, watch, nextTick, onMounted, onBeforeUnmount } from 'vue'\nimport Button from '@/components/Button.vue'\nimport type { ControlSize } from '@/types/types'\nimport Loader from '@/components/Loader.vue'\n\nconst props = withDefaults(defineProps<DropdownSelectProps>(), {\n modelValue: null,\n config: () => ({ ...dropdownSelectConfigDefaults }),\n})\n\nconst cfg = computed(() => ({ ...dropdownSelectConfigDefaults, ...props.config }))\n\nconst emit = defineEmits<{\n 'update:modelValue': [value: DropdownOption | DropdownOption[] | null]\n 'filter-input': [filterText: string]\n}>()\n\nconst isOpen = ref(false)\nconst filterText = ref('')\nconst wrapperRef = ref<HTMLElement | null>(null)\nconst filterInputRef = ref<HTMLInputElement | null>(null)\nconst buffer = ref<DropdownOption[]>([])\nconst selection = ref<DropdownOption[]>(normalizeToOptions(props.modelValue, props.options))\n\n\nfunction normalizeToOptions(\n val: DropdownOption | DropdownOption[] | string | string[] | null | undefined,\n options: DropdownOption[],\n): DropdownOption[] {\n if (val == null) return []\n const arr = Array.isArray(val) ? val : [val]\n return arr\n .map((entry): DropdownOption | null => {\n if (entry == null) return null\n if (typeof entry === 'object' && 'label' in entry) {\n return entry as DropdownOption\n }\n if (typeof entry === 'string') {\n const found = options.find((o) => o.value === entry)\n return found ?? { value: entry, label: entry }\n }\n return null\n })\n .filter((o): o is DropdownOption => o !== null)\n}\n\nwatch(\n () => [props.modelValue, props.options],\n ([v]) => {\n selection.value = normalizeToOptions(v as typeof props.modelValue, props.options)\n },\n)\n\nwatch(isOpen, (open) => {\n if (open) {\n filterText.value = ''\n if (cfg.value.filterable) nextTick(() => filterInputRef.value?.focus())\n if (cfg.value.lazy) buffer.value = [...selection.value]\n }\n})\n\nfunction onFilterInput(text: string) {\n filterText.value = text\n emit('filter-input', text)\n //debouncedEmit(text)\n}\n\n/* const debouncedEmit = debounce((raw: string) => {\n emit('filter-input', raw)\n}) */\n\n// Display\nconst selectedLabel = computed(() => {\n if (selection.value.length === 0) return null\n if (!cfg.value.multiple) {\n const sel = selection.value[0]\n // Prefer the label from the live options list, fall back to the stored label\n return props.options.find((o) => o.value === sel?.value)?.label ?? sel?.label ?? null\n }\n if (selection.value.length > 2) return `${selection.value.length} kiválasztva`\n return selection.value\n .map((sel) => props.options.find((o) => o.value === sel.value)?.label ?? sel.label ?? sel.value)\n .join(', ')\n})\n\nconst filteredOptions = computed(() => {\n const q = filterText.value.toLowerCase()\n return q ? props.options.filter((o) => o.label.toLowerCase().includes(q)) : props.options\n})\n\nfunction escapeHtml(str: string) {\n return str.replace(\n /[&<>\"']/g,\n (m) => ({ '&': '&', '<': '<', '>': '>', '\"': '"', \"'\": ''' })[m]!,\n )\n}\n\nfunction highlight(label: string) {\n const q = filterText.value.trim()\n if (!q || !cfg.value.highlight) return escapeHtml(label)\n\n const safeLabel = escapeHtml(label)\n const safeQ = escapeHtml(q)\n\n const re = new RegExp(safeQ.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'), 'ig')\n return safeLabel.replace(re, (m) => `<mark class=\"ds-option__highlight\">${m}</mark>`)\n}\n\nconst selectableOptions = computed(() => {\n return filteredOptions.value.filter((o) => o.value)\n})\n\nconst allOptionsSelected = computed(() => {\n if (selectableOptions.value.length === 0) return false\n const currentList = cfg.value.lazy && isOpen.value ? buffer.value : selection.value\n return selectableOptions.value.every((o) => o.value && currentList.some((s) => s.value === o.value))\n})\n\nfunction isSelected(value: string): boolean {\n const list = cfg.value.lazy && isOpen.value ? buffer : selection\n return list.value.some((s) => s.value === value)\n}\n\nfunction toggleAllOptions() {\n const currentList = cfg.value.lazy && isOpen.value ? buffer : selection\n const selectableOpts = selectableOptions.value.filter((o) => o.value)\n\n if (allOptionsSelected.value) {\n const selectableValues = new Set(selectableOpts.map((o) => o.value as string))\n currentList.value = currentList.value.filter((s) => !selectableValues.has(s.value ?? ''))\n } else {\n const existingValues = new Set(currentList.value.map((s) => s.value))\n const toAdd = selectableOpts.filter((o) => !existingValues.has(o.value as string))\n currentList.value = [...currentList.value, ...toAdd]\n }\n\n if (!cfg.value.lazy) {\n emit('update:modelValue', selection.value.length > 0 ? [...selection.value] : null)\n }\n}\n\n// Actions\nfunction toggleList(list: DropdownOption[], opt: DropdownOption): DropdownOption[] {\n const idx = list.findIndex((s) => s.value === opt.value)\n return idx >= 0 ? list.filter((_, i) => i !== idx) : [...list, opt]\n}\n\nfunction selectOption(opt: DropdownOption) {\n if (opt.callback) {\n opt.callback()\n isOpen.value = false\n return\n }\n\n const value = opt.value\n if (!value) return\n\n if (cfg.value.multiple) {\n if (cfg.value.lazy) {\n buffer.value = toggleList(buffer.value, opt)\n } else {\n selection.value = toggleList(selection.value, opt)\n emit('update:modelValue', selection.value.length > 0 ? [...selection.value] : null)\n }\n } else {\n selection.value = [opt]\n emit('update:modelValue', opt)\n isOpen.value = false\n }\n}\n\nfunction confirm() {\n if (cfg.value.lazy) {\n selection.value = [...buffer.value]\n emit('update:modelValue', buffer.value.length > 0 ? [...buffer.value] : null)\n }\n isOpen.value = false\n}\n\nfunction clear() {\n if (cfg.value.lazy) {\n buffer.value = []\n } else {\n selection.value = []\n emit('update:modelValue', null)\n }\n}\n\nfunction onOptionKeydown(e: KeyboardEvent, opt: DropdownOption) {\n if (e.key === ' ') {\n e.preventDefault()\n selectOption(opt)\n } else if (e.key === 'Enter') {\n e.preventDefault()\n confirm()\n }\n}\n\nfunction onClickOutside(e: MouseEvent) {\n if (wrapperRef.value && !wrapperRef.value.contains(e.target as Node)) isOpen.value = false\n}\n\nonMounted(() => document.addEventListener('mousedown', onClickOutside))\nonBeforeUnmount(() => {\n document.removeEventListener('mousedown', onClickOutside)\n})\n\nfunction toggleOpen() {\n if (cfg.value.disabled) return\n isOpen.value = !isOpen.value\n if (isOpen.value) {\n if (cfg.value.filterable) {\n filterText.value = ''\n emit('filter-input', '')\n }\n }\n}\n\nfunction clearInput() {\n if (cfg.value.disabled) return\n selection.value = []\n emit('update:modelValue', null)\n isOpen.value = false\n}\n\nfunction focusAndOpen() {\n if (cfg.value.disabled) return\n isOpen.value = true\n if (cfg.value.filterable) nextTick(() => filterInputRef.value?.focus())\n}\n\nfunction handleFilterClear() {\n filterText.value = ''\n emit('filter-input', '')\n}\n\ndefineExpose({ focusAndOpen })\n</script>\n\n<template>\n <div class=\"ac-component\">\n <div ref=\"wrapperRef\" class=\"c-wrapper ds-wrapper\">\n <div\n class=\"c-input-row pointer\"\n :class=\"{\n 'c-input-row--sm': cfg.size === 'small',\n 'c-input-row--lg': cfg.size === 'large',\n 'c-input-row--disabled': cfg.disabled,\n }\"\n :aria-disabled=\"cfg.disabled || undefined\"\n @click=\"toggleOpen()\"\n >\n <span v-if=\"selectedLabel\" class=\"c-truncate ds-value\">{{ selectedLabel }}</span>\n <span v-else class=\"c-placeholder\">{{ cfg.placeholder }}</span>\n <button\n v-if=\"cfg.clearable && selection.length > 0\"\n type=\"button\"\n class=\"c-icon-btn c-icon-btn--clear ds-clear-btn\"\n @click.stop=\"clearInput()\"\n aria-label=\"Törlés\"\n >\n <i class=\"fa-solid fa-fw fa-xmark\"></i>\n </button>\n <span\n class=\"c-icon-btn c-icon-btn--chevron mr-2\"\n :class=\"{ 'c-icon-btn--chevron-open': isOpen }\"\n >\n <i class=\"fa-solid fa-fw fa-chevron-down\"></i>\n </span>\n </div>\n\n <div\n v-if=\"isOpen\"\n class=\"c-dropdown ds-dropdown ac-component\"\n :class=\"{ 'ds-dropdown--multiple': cfg.multiple }\"\n >\n <div v-if=\"cfg.filterable\" class=\"ds-filter\">\n <span\n v-if=\"cfg.multiple\"\n class=\"c-checkbox ds-select-all-checkbox\"\n :class=\"{ 'c-checkbox--checked': allOptionsSelected }\"\n @click.stop=\"toggleAllOptions()\"\n :title=\"allOptionsSelected ? 'Összes kijelölés törlése' : 'Összes kijelölése'\"\n ></span>\n <input\n ref=\"filterInputRef\"\n type=\"text\"\n id=\"ds-filter-input\"\n class=\"c-focus ds-filter-input\"\n :value=\"filterText\"\n @input=\"onFilterInput(($event.target as HTMLInputElement).value)\"\n autocomplete=\"off\"\n :placeholder=\"cfg.filterPlaceholder\"\n @click.stop\n />\n <button\n v-if=\"filterText\"\n type=\"button\"\n class=\"c-icon-btn c-icon-btn--clear ds-filter-clear\"\n @click.stop=\"handleFilterClear()\"\n aria-label=\"Szűrők törlése\"\n >\n <i class=\"fa-solid fa-xmark\"></i>\n </button>\n </div>\n\n <ul class=\"ds-options c-scroll\">\n <li v-if=\"cfg.loading\" class=\"ds-option ds-option--loading\">\n <Loader size=\"2rem\" color=\"var(--neutral-300)\" class=\"m-auto p-3\" />\n </li>\n <template v-else>\n <li\n v-for=\"(opt, idx) in filteredOptions\"\n :key=\"opt.value ?? `cb-${idx}`\"\n class=\"d-option ds-option\"\n :class=\"{ 'ds-option--selected': opt.value && isSelected(opt.value) }\"\n tabindex=\"0\"\n @click=\"selectOption(opt)\"\n @keydown=\"onOptionKeydown($event, opt)\"\n >\n <span\n v-if=\"cfg.multiple && opt.value\"\n class=\"c-checkbox\"\n :class=\"{ 'c-checkbox--checked': isSelected(opt.value) }\"\n ></span>\n <i v-if=\"opt.icon\" class=\"fa-fw\" :class=\"opt.icon\"></i>\n <span\n class=\"d-option__label\"\n :class=\"{ 'c-truncate': cfg.textEllipsis }\"\n v-html=\"highlight(opt.label)\"\n ></span>\n </li>\n <li v-if=\"filteredOptions.length === 0\" class=\"ds-option ds-option--empty\">\n Nincs találat\n </li>\n </template>\n </ul>\n\n <div v-if=\"cfg.multiple || (cfg.clearable && selection.length > 0)\" class=\"c-footer\">\n <Button v-if=\"cfg.clearable\" label=\"Törlés\" outline @click=\"clear\" />\n <Button v-if=\"cfg.multiple\" label=\"OK\" type=\"success\" @click=\"confirm\" />\n </div>\n </div>\n </div>\n </div>\n</template>\n\n<style lang=\"scss\" src=\"@/styles/components/dropdown-select.scss\"></style>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"admins-components28.js","names":[],"sources":["../src/components/DropdownSelect.vue"],"sourcesContent":["<script lang=\"ts\">\nexport interface DropdownSelectConfig {\n placeholder?: string\n filterable?: boolean\n filterPlaceholder?: string\n clearable?: boolean\n textEllipsis?: boolean\n multiple?: boolean\n lazy?: boolean\n size?: ControlSize\n loading?: boolean\n highlight?: boolean\n disabled?: boolean\n}\n\nexport const dropdownSelectConfigDefaults: DropdownSelectConfig = {\n placeholder: 'Válassz...',\n filterable: true,\n filterPlaceholder: 'Kezdj el gépelni...',\n clearable: true,\n textEllipsis: true,\n multiple: false,\n lazy: false,\n loading: false,\n size: 'normal' as ControlSize,\n highlight: true,\n disabled: false,\n}\n\nexport interface DropdownOption {\n icon?: string\n value?: string\n label: string\n callback?: () => void\n}\n\nexport interface DropdownSelectProps {\n modelValue?: DropdownOption | DropdownOption[] | string | string[] | null\n options: DropdownOption[]\n config?: DropdownSelectConfig\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { ref, computed, watch, nextTick } from 'vue'\nimport Button from '@/components/Button.vue'\nimport type { ControlSize } from '@/types/types'\nimport Loader from '@/components/Loader.vue'\nimport { useDropdownAnchor } from '@/composables/useDropdownAnchor'\n\nconst props = withDefaults(defineProps<DropdownSelectProps>(), {\n modelValue: null,\n config: () => ({ ...dropdownSelectConfigDefaults }),\n})\n\nconst cfg = computed(() => ({ ...dropdownSelectConfigDefaults, ...props.config }))\n\nconst emit = defineEmits<{\n 'update:modelValue': [value: DropdownOption | DropdownOption[] | null]\n 'filter-input': [filterText: string]\n}>()\n\nconst filterText = ref('')\nconst wrapperRef = ref<HTMLElement | null>(null)\nconst dropdownRef = ref<HTMLElement | null>(null)\nconst filterInputRef = ref<HTMLInputElement | null>(null)\nconst buffer = ref<DropdownOption[]>([])\nconst selection = ref<DropdownOption[]>(normalizeToOptions(props.modelValue, props.options))\n\nconst { isOpen, dropdownStyle } = useDropdownAnchor(wrapperRef, dropdownRef, {\n extraStyle: (rect) => ({\n minWidth: `${rect.width}px`,\n maxWidth: `${rect.width * 1.5}px`,\n }),\n})\n\n\nfunction normalizeToOptions(\n val: DropdownOption | DropdownOption[] | string | string[] | null | undefined,\n options: DropdownOption[],\n): DropdownOption[] {\n if (val == null) return []\n const arr = Array.isArray(val) ? val : [val]\n return arr\n .map((entry): DropdownOption | null => {\n if (entry == null) return null\n if (typeof entry === 'object' && 'label' in entry) {\n return entry as DropdownOption\n }\n if (typeof entry === 'string') {\n const found = options.find((o) => o.value === entry)\n return found ?? { value: entry, label: entry }\n }\n return null\n })\n .filter((o): o is DropdownOption => o !== null)\n}\n\nwatch(\n () => [props.modelValue, props.options],\n ([v]) => {\n selection.value = normalizeToOptions(v as typeof props.modelValue, props.options)\n },\n)\n\nwatch(isOpen, (open) => {\n if (open) {\n filterText.value = ''\n if (cfg.value.filterable) nextTick(() => filterInputRef.value?.focus())\n if (cfg.value.lazy) buffer.value = [...selection.value]\n }\n})\n\nfunction onFilterInput(text: string) {\n filterText.value = text\n emit('filter-input', text)\n}\n\nconst selectedLabel = computed(() => {\n if (selection.value.length === 0) return null\n if (!cfg.value.multiple) {\n const sel = selection.value[0]\n\n return props.options.find((o) => o.value === sel?.value)?.label ?? sel?.label ?? null\n }\n if (selection.value.length > 2) return `${selection.value.length} kiválasztva`\n return selection.value\n .map((sel) => props.options.find((o) => o.value === sel.value)?.label ?? sel.label ?? sel.value)\n .join(', ')\n})\n\nconst filteredOptions = computed(() => {\n const q = filterText.value.toLowerCase()\n return q ? props.options.filter((o) => o.label.toLowerCase().includes(q)) : props.options\n})\n\nfunction escapeHtml(str: string) {\n return str.replace(\n /[&<>\"']/g,\n (m) => ({ '&': '&', '<': '<', '>': '>', '\"': '"', \"'\": ''' })[m]!,\n )\n}\n\nfunction highlight(label: string) {\n const q = filterText.value.trim()\n if (!q || !cfg.value.highlight) return escapeHtml(label)\n\n const safeLabel = escapeHtml(label)\n const safeQ = escapeHtml(q)\n\n const re = new RegExp(safeQ.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'), 'ig')\n return safeLabel.replace(re, (m) => `<mark class=\"ds-option__highlight\">${m}</mark>`)\n}\n\nconst selectableOptions = computed(() => {\n return filteredOptions.value.filter((o) => o.value)\n})\n\nconst allOptionsSelected = computed(() => {\n if (selectableOptions.value.length === 0) return false\n const currentList = cfg.value.lazy && isOpen.value ? buffer.value : selection.value\n return selectableOptions.value.every((o) => o.value && currentList.some((s) => s.value === o.value))\n})\n\nfunction isSelected(value: string): boolean {\n const list = cfg.value.lazy && isOpen.value ? buffer : selection\n return list.value.some((s) => s.value === value)\n}\n\nfunction toggleAllOptions() {\n const currentList = cfg.value.lazy && isOpen.value ? buffer : selection\n const selectableOpts = selectableOptions.value.filter((o) => o.value)\n\n if (allOptionsSelected.value) {\n const selectableValues = new Set(selectableOpts.map((o) => o.value as string))\n currentList.value = currentList.value.filter((s) => !selectableValues.has(s.value ?? ''))\n } else {\n const existingValues = new Set(currentList.value.map((s) => s.value))\n const toAdd = selectableOpts.filter((o) => !existingValues.has(o.value as string))\n currentList.value = [...currentList.value, ...toAdd]\n }\n\n if (!cfg.value.lazy) {\n emit('update:modelValue', selection.value.length > 0 ? [...selection.value] : null)\n }\n}\n\nfunction toggleList(list: DropdownOption[], opt: DropdownOption): DropdownOption[] {\n const idx = list.findIndex((s) => s.value === opt.value)\n return idx >= 0 ? list.filter((_, i) => i !== idx) : [...list, opt]\n}\n\nfunction selectOption(opt: DropdownOption) {\n if (opt.callback) {\n opt.callback()\n isOpen.value = false\n return\n }\n\n const value = opt.value\n if (!value) return\n\n if (cfg.value.multiple) {\n if (cfg.value.lazy) {\n buffer.value = toggleList(buffer.value, opt)\n } else {\n selection.value = toggleList(selection.value, opt)\n emit('update:modelValue', selection.value.length > 0 ? [...selection.value] : null)\n }\n } else {\n selection.value = [opt]\n emit('update:modelValue', opt)\n isOpen.value = false\n }\n}\n\nfunction confirm() {\n if (cfg.value.lazy) {\n selection.value = [...buffer.value]\n emit('update:modelValue', buffer.value.length > 0 ? [...buffer.value] : null)\n }\n isOpen.value = false\n}\n\nfunction clear() {\n if (cfg.value.lazy) {\n buffer.value = []\n } else {\n selection.value = []\n emit('update:modelValue', null)\n }\n}\n\nfunction onOptionKeydown(e: KeyboardEvent, opt: DropdownOption) {\n if (e.key === ' ') {\n e.preventDefault()\n selectOption(opt)\n } else if (e.key === 'Enter') {\n e.preventDefault()\n confirm()\n }\n}\n\nfunction toggleOpen() {\n if (cfg.value.disabled) return\n isOpen.value = !isOpen.value\n if (isOpen.value) {\n if (cfg.value.filterable) {\n filterText.value = ''\n emit('filter-input', '')\n }\n }\n}\n\nfunction clearInput() {\n if (cfg.value.disabled) return\n selection.value = []\n emit('update:modelValue', null)\n isOpen.value = false\n}\n\nfunction focusAndOpen() {\n if (cfg.value.disabled) return\n isOpen.value = true\n if (cfg.value.filterable) nextTick(() => filterInputRef.value?.focus())\n}\n\nfunction handleFilterClear() {\n filterText.value = ''\n emit('filter-input', '')\n}\n\ndefineExpose({ focusAndOpen })\n</script>\n\n<template>\n <div class=\"ac-component\">\n <div ref=\"wrapperRef\" class=\"c-wrapper ds-wrapper\">\n <div\n class=\"c-input-row pointer\"\n :class=\"{\n 'c-input-row--sm': cfg.size === 'small',\n 'c-input-row--lg': cfg.size === 'large',\n 'c-input-row--disabled': cfg.disabled,\n }\"\n :aria-disabled=\"cfg.disabled || undefined\"\n @click=\"toggleOpen()\"\n >\n <span v-if=\"selectedLabel\" class=\"c-truncate ds-value\">{{ selectedLabel }}</span>\n <span v-else class=\"c-placeholder\">{{ cfg.placeholder }}</span>\n <button\n v-if=\"cfg.clearable && selection.length > 0\"\n type=\"button\"\n class=\"c-icon-btn c-icon-btn--clear ds-clear-btn\"\n @click.stop=\"clearInput()\"\n aria-label=\"Törlés\"\n >\n <i class=\"fa-solid fa-fw fa-xmark\"></i>\n </button>\n <span\n class=\"c-icon-btn c-icon-btn--chevron mr-2\"\n :class=\"{ 'c-icon-btn--chevron-open': isOpen }\"\n >\n <i class=\"fa-solid fa-fw fa-chevron-down\"></i>\n </span>\n </div>\n </div>\n <Teleport to=\"body\">\n <div class=\"ac-component\">\n <div\n v-if=\"isOpen\"\n ref=\"dropdownRef\"\n class=\"c-dropdown ds-dropdown ds-wrapper\"\n :class=\"{ 'ds-dropdown--multiple': cfg.multiple }\"\n :style=\"dropdownStyle\"\n >\n <div v-if=\"cfg.filterable\" class=\"ds-filter\">\n <span\n v-if=\"cfg.multiple\"\n class=\"c-checkbox ds-select-all-checkbox\"\n :class=\"{ 'c-checkbox--checked': allOptionsSelected }\"\n @click.stop=\"toggleAllOptions()\"\n :title=\"allOptionsSelected ? 'Összes kijelölés törlése' : 'Összes kijelölése'\"\n ></span>\n <input\n ref=\"filterInputRef\"\n type=\"text\"\n id=\"ds-filter-input\"\n class=\"c-focus ds-filter-input\"\n :value=\"filterText\"\n @input=\"onFilterInput(($event.target as HTMLInputElement).value)\"\n autocomplete=\"off\"\n :placeholder=\"cfg.filterPlaceholder\"\n @click.stop\n />\n <button\n v-if=\"filterText\"\n type=\"button\"\n class=\"c-icon-btn c-icon-btn--clear ds-filter-clear\"\n @click.stop=\"handleFilterClear()\"\n aria-label=\"Szűrők törlése\"\n >\n <i class=\"fa-solid fa-xmark\"></i>\n </button>\n </div>\n\n <ul class=\"ds-options c-scroll\">\n <li v-if=\"cfg.loading\" class=\"ds-option ds-option--loading\">\n <Loader size=\"2rem\" color=\"var(--neutral-300)\" class=\"m-auto p-3\" />\n </li>\n <template v-else>\n <li\n v-for=\"(opt, idx) in filteredOptions\"\n :key=\"opt.value ?? `cb-${idx}`\"\n class=\"d-option ds-option\"\n :class=\"{ 'ds-option--selected': opt.value && isSelected(opt.value) }\"\n tabindex=\"0\"\n @click=\"selectOption(opt)\"\n @keydown=\"onOptionKeydown($event, opt)\"\n >\n <span\n v-if=\"cfg.multiple && opt.value\"\n class=\"c-checkbox\"\n :class=\"{ 'c-checkbox--checked': isSelected(opt.value) }\"\n ></span>\n <i v-if=\"opt.icon\" class=\"fa-fw\" :class=\"opt.icon\"></i>\n <span\n class=\"d-option__label\"\n :class=\"{ 'c-truncate': cfg.textEllipsis }\"\n v-html=\"highlight(opt.label)\"\n ></span>\n </li>\n <li v-if=\"filteredOptions.length === 0\" class=\"ds-option ds-option--empty\">\n Nincs találat\n </li>\n </template>\n </ul>\n <div v-if=\"cfg.multiple\" class=\"c-footer\">\n <Button v-if=\"cfg.clearable && selection.length > 0\" label=\"Törlés\" outline @click=\"clear\" />\n <Button label=\"OK\" type=\"success\" @click=\"confirm\" />\n </div>\n </div>\n </div>\n </Teleport>\n </div>\n</template>\n\n<style lang=\"scss\" src=\"@/styles/components/dropdown-select.scss\"></style>\n"],"mappings":""}
|
|
@@ -2,7 +2,7 @@ import { sizeToClass as e } from "./admins-components4.js";
|
|
|
2
2
|
import { useDropdownAnchor as t } from "./admins-components12.js";
|
|
3
3
|
import { Fragment as n, Teleport as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, defineComponent as c, normalizeClass as l, normalizeStyle as u, openBlock as d, ref as f, renderList as p, toDisplayString as m, unref as h, vShow as g, withDirectives as _ } from "vue";
|
|
4
4
|
//#region src/components/DropdownMenu.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
-
var v = ["aria-label"], y = { class: "ac-component" }, b = { class: "ds-options c-scroll" }, x = ["onClick", "aria-label"], S =
|
|
5
|
+
var v = ["aria-label"], y = { class: "ac-component" }, b = { class: "ds-options c-scroll" }, x = ["onClick", "aria-label"], S = /*@__PURE__*/ c({
|
|
6
6
|
__name: "DropdownMenu",
|
|
7
7
|
props: {
|
|
8
8
|
size: { default: "normal" },
|