admins-components 9.0.40 → 9.0.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/dist/admins-components.js +6 -6
  2. package/dist/admins-components169.js +1 -1
  3. package/dist/admins-components172.js +1 -1
  4. package/dist/admins-components173.js +1 -1
  5. package/dist/admins-components175.js +1 -1
  6. package/dist/admins-components23.js +20 -187
  7. package/dist/admins-components23.js.map +1 -1
  8. package/dist/admins-components25.js +2 -2
  9. package/dist/admins-components25.js.map +1 -1
  10. package/dist/admins-components26.js +214 -70
  11. package/dist/admins-components26.js.map +1 -1
  12. package/dist/admins-components28.js +6 -51
  13. package/dist/admins-components28.js.map +1 -1
  14. package/dist/admins-components29.js +71 -67
  15. package/dist/admins-components29.js.map +1 -1
  16. package/dist/{admins-components27.js → admins-components30.js} +1 -1
  17. package/dist/admins-components30.js.map +1 -0
  18. package/dist/admins-components31.js +51 -6
  19. package/dist/admins-components31.js.map +1 -1
  20. package/dist/admins-components32.js +68 -59
  21. package/dist/admins-components32.js.map +1 -1
  22. package/dist/admins-components34.js +2 -2
  23. package/dist/admins-components34.js.map +1 -1
  24. package/dist/admins-components35.js +61 -35
  25. package/dist/admins-components35.js.map +1 -1
  26. package/dist/admins-components37.js +2 -2
  27. package/dist/admins-components37.js.map +1 -1
  28. package/dist/admins-components38.js +37 -34
  29. package/dist/admins-components38.js.map +1 -1
  30. package/dist/admins-components40.js +6 -32
  31. package/dist/admins-components40.js.map +1 -1
  32. package/dist/admins-components41.js +37 -0
  33. package/dist/{admins-components39.js.map → admins-components41.js.map} +1 -1
  34. package/dist/admins-components42.js +2 -4
  35. package/dist/admins-components42.js.map +1 -1
  36. package/dist/admins-components43.js +28 -142
  37. package/dist/admins-components43.js.map +1 -1
  38. package/dist/admins-components45.js +2 -2
  39. package/dist/admins-components45.js.map +1 -1
  40. package/dist/admins-components46.js +132 -110
  41. package/dist/admins-components46.js.map +1 -1
  42. package/dist/admins-components48.js +6 -179
  43. package/dist/admins-components48.js.map +1 -1
  44. package/dist/admins-components49.js +124 -4
  45. package/dist/admins-components49.js.map +1 -1
  46. package/dist/admins-components50.js +4 -19
  47. package/dist/admins-components50.js.map +1 -1
  48. package/dist/admins-components51.js +180 -0
  49. package/dist/admins-components51.js.map +1 -0
  50. package/dist/admins-components52.js +2 -4
  51. package/dist/admins-components52.js.map +1 -1
  52. package/dist/admins-components58.js.map +1 -1
  53. package/dist/admins-components61.js +6 -6
  54. package/dist/admins-components63.js +21 -16
  55. package/dist/admins-components63.js.map +1 -1
  56. package/dist/admins-components64.js.map +1 -1
  57. package/dist/admins-components65.js +3 -3
  58. package/dist/admins-components65.js.map +1 -1
  59. package/dist/admins-components67.js.map +1 -1
  60. package/dist/admins-components68.js +18 -19
  61. package/dist/admins-components68.js.map +1 -1
  62. package/dist/admins-components70.js.map +1 -1
  63. package/dist/admins-components72.js +1 -1
  64. package/dist/admins-components81.js +1 -1
  65. package/dist/admins-components84.js +2 -2
  66. package/dist/admins-components90.js +1 -1
  67. package/dist/main.css +1 -1
  68. package/dist/main.css.map +1 -1
  69. package/dist/src/components/DropdownMenu.vue.d.ts +1 -0
  70. package/dist/src/components/DropdownSelect.vue.d.ts +3 -0
  71. package/dist/src/components/Loader.vue.d.ts +4 -1
  72. package/dist/src/styles/components/data-table/data-table.scss_vue_type_style_index_0_src_true_lang.css +1 -1
  73. package/dist/src/styles/components/dropdown-select.scss_vue_type_style_index_0_src_true_lang.css +1 -1
  74. package/dist/src/styles/components/loader.scss_vue_type_style_index_0_src_true_lang.css +1 -1
  75. package/dist/src/types/data-list.d.ts +2 -2
  76. package/package.json +1 -1
  77. package/dist/admins-components27.js.map +0 -1
  78. package/dist/admins-components39.js +0 -5
  79. package/dist/admins-components47.js +0 -5
  80. package/dist/admins-components47.js.map +0 -1
@@ -8,15 +8,15 @@ import g from "./admins-components17.js";
8
8
  import _ from "./admins-components19.js";
9
9
  import v from "./admins-components22.js";
10
10
  import y from "./admins-components25.js";
11
- import b from "./admins-components27.js";
12
- import x from "./admins-components31.js";
11
+ import b from "./admins-components28.js";
12
+ import x from "./admins-components30.js";
13
13
  import S from "./admins-components34.js";
14
14
  import C from "./admins-components37.js";
15
- import w from "./admins-components39.js";
15
+ import w from "./admins-components40.js";
16
16
  import T from "./admins-components42.js";
17
17
  import E from "./admins-components45.js";
18
- import D from "./admins-components47.js";
19
- import O from "./admins-components49.js";
18
+ import D from "./admins-components48.js";
19
+ import O from "./admins-components50.js";
20
20
  import k from "./admins-components52.js";
21
21
  import { toast as A } from "./admins-components53.js";
22
22
  import j from "./admins-components56.js";
@@ -60,4 +60,4 @@ import { configureInternalArticleOfferElement as Ue, iaoeConfig as We } from "./
60
60
  import Ge from "./admins-components175.js";
61
61
  import { configurePartnerPickerElement as Ke, ppeconfig as qe } from "./admins-components176.js";
62
62
  import Je from "./admins-components178.js";
63
- export { Oe as ArticleOfferElement, Ne as ArticlePickerElement, we as BackendService, l as Button, p as Calendar, _ as Checkbox, w as ConfirmModal, T as CopyToClipboard, q as DataCards, oe as DataFilters, pe as DataList, Y as DataListOptions, Q as DataPaginator, K as DataTable, m as DatePicker, v as DateRangePicker, Pe as DateTimePickerElement, b as DropdownMenu, y as DropdownSelect, D as ExternalArticleOffer, Le as ExternalArticleOfferElement, ve as FetchDetails, ye as FetchError, se as FilterTags, ae as FiltersHistory, Be as GalleryImageSelectorElement, S as HeaderComponent, E as ImagePicker, He as ImagePickerDetailsElement, Ve as ImagePickerElement, O as InternalArticleOffer, Ge as InternalArticleOfferElement, k as Loader, be as Methods, C as Modal, Je as PartnerPickerElement, x as Sidebar, g as TextInput, j as ToastNotification, Ee as aoeConfig, ke as apeConfig, F as booleanToString, u as calendarConfigDefaults, e as castToDate, De as configureArticleOfferElement, Ae as configureArticlePickerElement, Fe as configureExternalArticleOfferElement, Re as configureGalleryImageSelectorElement, je as configureImagePickerElement, Ue as configureInternalArticleOfferElement, Ke as configurePartnerPickerElement, _e as createNativeFetch, M as dataCardsSettingsDefaults, I as dataListConverters, fe as dataListDefaults, N as dataListSettingsDefaults, P as dataTableSettingsDefaults, d as datePickerConfigDefaults, f as dateRangePickerConfigDefaults, h as debounce, J as deepMerge, Ie as eaoeConfig, t as earlierOf, n as endOfDay, L as enumMap, $ as filterEmptyValues, R as formatCurrency, r as formatDate, z as formatNumber, he as getCurrentSite, ee as getDefaultFilters, Z as getDefaultPaginator, te as getDefaultSavedFilter, ne as getFilterUrlParams, X as getFullStorageKey, re as getSavedFilters, ce as getUrlParam, ze as gisConfig, We as iaoeConfig, B as identity, xe as initRequest, Me as ipeConfig, me as isIpInUrl, le as joinUrl, i as laterOf, V as listToString, H as localToLocalString, a as localToUTCString, o as parseDate, qe as ppeconfig, ue as removeUrlParam, de as setUrlParam, U as shortUuid, s as startOfDay, c as startOfWeek, W as textEllipse, A as toast, Se as useArticleEditorService, Te as useBackendService, Ce as useCurrentUser, G as utcToLocalString, ge as vTooltip, ie as writeFilterParams };
63
+ export { Oe as ArticleOfferElement, Ne as ArticlePickerElement, we as BackendService, l as Button, p as Calendar, _ as Checkbox, T as ConfirmModal, E as CopyToClipboard, q as DataCards, oe as DataFilters, pe as DataList, Y as DataListOptions, Q as DataPaginator, K as DataTable, m as DatePicker, v as DateRangePicker, Pe as DateTimePickerElement, x as DropdownMenu, b as DropdownSelect, O as ExternalArticleOffer, Le as ExternalArticleOfferElement, ve as FetchDetails, ye as FetchError, se as FilterTags, ae as FiltersHistory, Be as GalleryImageSelectorElement, C as HeaderComponent, D as ImagePicker, He as ImagePickerDetailsElement, Ve as ImagePickerElement, k as InternalArticleOffer, Ge as InternalArticleOfferElement, y as Loader, be as Methods, w as Modal, Je as PartnerPickerElement, S as Sidebar, g as TextInput, j as ToastNotification, Ee as aoeConfig, ke as apeConfig, F as booleanToString, u as calendarConfigDefaults, e as castToDate, De as configureArticleOfferElement, Ae as configureArticlePickerElement, Fe as configureExternalArticleOfferElement, Re as configureGalleryImageSelectorElement, je as configureImagePickerElement, Ue as configureInternalArticleOfferElement, Ke as configurePartnerPickerElement, _e as createNativeFetch, M as dataCardsSettingsDefaults, I as dataListConverters, fe as dataListDefaults, N as dataListSettingsDefaults, P as dataTableSettingsDefaults, d as datePickerConfigDefaults, f as dateRangePickerConfigDefaults, h as debounce, J as deepMerge, Ie as eaoeConfig, t as earlierOf, n as endOfDay, L as enumMap, $ as filterEmptyValues, R as formatCurrency, r as formatDate, z as formatNumber, he as getCurrentSite, ee as getDefaultFilters, Z as getDefaultPaginator, te as getDefaultSavedFilter, ne as getFilterUrlParams, X as getFullStorageKey, re as getSavedFilters, ce as getUrlParam, ze as gisConfig, We as iaoeConfig, B as identity, xe as initRequest, Me as ipeConfig, me as isIpInUrl, le as joinUrl, i as laterOf, V as listToString, H as localToLocalString, a as localToUTCString, o as parseDate, qe as ppeconfig, ue as removeUrlParam, de as setUrlParam, U as shortUuid, s as startOfDay, c as startOfWeek, W as textEllipse, A as toast, Se as useArticleEditorService, Te as useBackendService, Ce as useCurrentUser, G as utcToLocalString, ge as vTooltip, ie as writeFilterParams };
@@ -1,4 +1,4 @@
1
- import e from "./admins-components47.js";
1
+ import e from "./admins-components50.js";
2
2
  import { defineElement as t } from "./admins-components159.js";
3
3
  import n from "./admins-components161.js";
4
4
  import { ipeConfig as r } from "./admins-components164.js";
@@ -1,4 +1,4 @@
1
- import e from "./admins-components45.js";
1
+ import e from "./admins-components48.js";
2
2
  import { defineElement as t } from "./admins-components159.js";
3
3
  import n from "./admins-components161.js";
4
4
  import { ipeConfig as r } from "./admins-components164.js";
@@ -1,4 +1,4 @@
1
- import e from "./admins-components45.js";
1
+ import e from "./admins-components48.js";
2
2
  import { defineElement as t } from "./admins-components159.js";
3
3
  import n from "./admins-components161.js";
4
4
  import { ipeConfig as r } from "./admins-components164.js";
@@ -1,4 +1,4 @@
1
- import e from "./admins-components49.js";
1
+ import e from "./admins-components52.js";
2
2
  import { defineElement as t } from "./admins-components159.js";
3
3
  import n from "./admins-components161.js";
4
4
  import { ipeConfig as r } from "./admins-components164.js";
@@ -1,192 +1,25 @@
1
- import e from "./admins-components6.js";
2
- import { debounce as t } from "./admins-components15.js";
3
- import { Fragment as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, defineComponent as c, nextTick as l, normalizeClass as u, onBeforeUnmount as d, onMounted as f, openBlock as p, ref as m, renderList as h, toDisplayString as g, watch as _, withModifiers as v } from "vue";
4
- //#region src/components/DropdownSelect.vue?vue&type=script&setup=true&lang.ts
5
- var y = { class: "ac-component" }, b = {
6
- key: 0,
7
- class: "c-truncate ds-value"
8
- }, x = {
9
- key: 1,
10
- class: "c-placeholder"
11
- }, S = {
12
- key: 0,
13
- class: "ds-filter"
14
- }, ee = ["title"], C = ["value"], w = { class: "ds-options c-scroll" }, T = ["onClick", "onKeydown"], E = {
15
- key: 0,
16
- class: "ds-option ds-option--empty"
17
- }, D = {
18
- key: 1,
19
- class: "c-footer"
20
- }, O = {
21
- placeholder: "Select...",
22
- filterable: !0,
23
- clearable: !0,
24
- textEllipsis: !0,
25
- multiple: !1,
26
- lazy: !1,
27
- size: "normal"
28
- }, k = /* @__PURE__ */ c({
29
- __name: "DropdownSelect",
1
+ import { createElementBlock as e, defineComponent as t, normalizeStyle as n, openBlock as r } from "vue";
2
+ //#region src/components/Loader.vue?vue&type=script&setup=true&lang.ts
3
+ var i = /* @__PURE__ */ t({
4
+ __name: "Loader",
30
5
  props: {
31
- modelValue: { default: null },
32
- options: {},
33
- config: { default: () => ({ ...O }) }
6
+ loading: {
7
+ type: Boolean,
8
+ default: !0
9
+ },
10
+ size: { default: "2rem" },
11
+ color: { default: "var(--site-500)" }
34
12
  },
35
- emits: ["update:modelValue", "filter-input"],
36
- setup(c, { expose: k, emit: A }) {
37
- let j = c, M = r(() => ({
38
- ...O,
39
- ...j.config
40
- })), N = A, P = m(!1), F = m(""), I = m(null), L = m(null), R = m([]), z = m(B(j.modelValue));
41
- function B(e) {
42
- return e == null ? [] : Array.isArray(e) ? [...e] : [e];
43
- }
44
- _(() => j.modelValue, (e) => {
45
- z.value = B(e);
46
- }), _(P, (e) => {
47
- e && (F.value = "", M.value.filterable && l(() => L.value?.focus()), M.value.lazy && (R.value = [...z.value]));
48
- });
49
- function V(e) {
50
- F.value = e, H(e);
51
- }
52
- let H = t((e) => {
53
- N("filter-input", e);
54
- }), U = r(() => z.value.length === 0 ? null : M.value.multiple ? z.value.length > 2 ? `${z.value.length} kiválasztva` : z.value.map((e) => j.options.find((t) => t.value === e)?.label ?? e).join(", ") : j.options.find((e) => e.value === z.value[0])?.label ?? null), W = r(() => {
55
- let e = F.value.toLowerCase();
56
- return e ? j.options.filter((t) => t.label.toLowerCase().includes(e)) : j.options;
57
- }), G = r(() => W.value.filter((e) => e.value)), K = r(() => {
58
- if (G.value.length === 0) return !1;
59
- let e = M.value.lazy && P.value ? R.value : z.value;
60
- return G.value.every((t) => t.value && e.includes(t.value));
61
- });
62
- function q(e) {
63
- return (M.value.lazy && P.value ? R : z).value.includes(e);
64
- }
65
- function J() {
66
- let e = M.value.lazy && P.value ? R : z, t = G.value.map((e) => e.value);
67
- if (K.value) e.value = e.value.filter((e) => !t.includes(e));
68
- else {
69
- let n = t.filter((t) => !e.value.includes(t));
70
- e.value = [...e.value, ...n];
71
- }
72
- M.value.lazy || N("update:modelValue", z.value.length > 0 ? [...z.value] : null);
73
- }
74
- function Y(e, t) {
75
- let n = e.indexOf(t);
76
- return n >= 0 ? e.filter((e, t) => t !== n) : [...e, t];
77
- }
78
- function X(e) {
79
- if (e.callback) {
80
- e.callback(), P.value = !1;
81
- return;
82
- }
83
- let t = e.value;
84
- t && (M.value.multiple ? M.value.lazy ? R.value = Y(R.value, t) : (z.value = Y(z.value, t), N("update:modelValue", z.value.length > 0 ? [...z.value] : null)) : (z.value = [t], N("update:modelValue", t), P.value = !1));
85
- }
86
- function Z() {
87
- M.value.lazy && (z.value = [...R.value], N("update:modelValue", R.value.length > 0 ? [...R.value] : null)), P.value = !1;
88
- }
89
- function Q() {
90
- M.value.lazy ? R.value = [] : (z.value = [], N("update:modelValue", null));
91
- }
92
- function te(e, t) {
93
- e.key === " " ? (e.preventDefault(), X(t)) : e.key === "Enter" && (e.preventDefault(), Z());
94
- }
95
- function $(e) {
96
- I.value && !I.value.contains(e.target) && (P.value = !1);
97
- }
98
- f(() => document.addEventListener("mousedown", $)), d(() => {
99
- document.removeEventListener("mousedown", $);
100
- });
101
- function ne() {
102
- P.value = !P.value, P.value && (F.value = "");
103
- }
104
- function re() {
105
- z.value = [], N("update:modelValue", null), P.value = !1;
106
- }
107
- function ie() {
108
- P.value = !0, M.value.filterable && l(() => L.value?.focus());
109
- }
110
- return k({ focusAndOpen: ie }), (t, r) => (p(), o("div", y, [s("div", {
111
- ref_key: "wrapperRef",
112
- ref: I,
113
- class: "c-wrapper ds-wrapper"
114
- }, [s("div", {
115
- class: u(["c-input-row pointer", {
116
- "c-input-row--sm": M.value.size === "small",
117
- "c-input-row--lg": M.value.size === "large"
118
- }]),
119
- onClick: r[1] ||= (e) => ne()
120
- }, [
121
- U.value ? (p(), o("span", b, g(U.value), 1)) : (p(), o("span", x, g(M.value.placeholder), 1)),
122
- M.value.clearable && z.value.length > 0 ? (p(), o("button", {
123
- key: 2,
124
- type: "button",
125
- class: "c-icon-btn c-icon-btn--clear ds-clear-btn",
126
- onClick: r[0] ||= v((e) => re(), ["stop"]),
127
- "aria-label": "Törlés"
128
- }, [...r[6] ||= [s("i", { class: "fa-solid fa-fw fa-xmark" }, null, -1)]])) : a("", !0),
129
- s("span", { class: u(["c-icon-btn c-icon-btn--chevron mr-2", { "c-icon-btn--chevron-open": P.value }]) }, [...r[7] ||= [s("i", { class: "fa-solid fa-fw fa-chevron-down" }, null, -1)]], 2)
130
- ], 2), P.value ? (p(), o("div", {
131
- key: 0,
132
- class: u(["c-dropdown ds-dropdown ac-component", { "ds-dropdown--multiple": M.value.multiple }])
133
- }, [
134
- M.value.filterable ? (p(), o("div", S, [
135
- M.value.multiple ? (p(), o("span", {
136
- key: 0,
137
- class: u(["c-checkbox ds-select-all-checkbox", { "c-checkbox--checked": K.value }]),
138
- onClick: r[2] ||= v((e) => J(), ["stop"]),
139
- title: K.value ? "Összes kijelölés törlése" : "Összes kijelölése"
140
- }, null, 10, ee)) : a("", !0),
141
- s("input", {
142
- ref_key: "filterInputRef",
143
- ref: L,
144
- type: "text",
145
- id: "ds-filter-input",
146
- class: "c-focus ds-filter-input",
147
- value: F.value,
148
- onInput: r[3] ||= (e) => V(e.target.value),
149
- placeholder: "Filter...",
150
- onClick: r[4] ||= v(() => {}, ["stop"])
151
- }, null, 40, C),
152
- F.value ? (p(), o("button", {
153
- key: 1,
154
- type: "button",
155
- class: "c-icon-btn c-icon-btn--clear ds-filter-clear",
156
- onClick: r[5] ||= v((e) => F.value = "", ["stop"]),
157
- "aria-label": "Szűrők törlése"
158
- }, [...r[8] ||= [s("i", { class: "fa-solid fa-xmark" }, null, -1)]])) : a("", !0)
159
- ])) : a("", !0),
160
- s("ul", w, [(p(!0), o(n, null, h(W.value, (e, t) => (p(), o("li", {
161
- key: e.value ?? `cb-${t}`,
162
- class: u(["d-option ds-option", { "ds-option--selected": e.value && q(e.value) }]),
163
- tabindex: "0",
164
- onClick: (t) => X(e),
165
- onKeydown: (t) => te(t, e)
166
- }, [
167
- M.value.multiple && e.value ? (p(), o("span", {
168
- key: 0,
169
- class: u(["c-checkbox", { "c-checkbox--checked": q(e.value) }])
170
- }, null, 2)) : a("", !0),
171
- e.icon ? (p(), o("i", {
172
- key: 1,
173
- class: u(["fa-fw", e.icon])
174
- }, null, 2)) : a("", !0),
175
- s("span", { class: u(["d-option__label", { "c-truncate": M.value.textEllipsis }]) }, g(e.label), 3)
176
- ], 42, T))), 128)), W.value.length === 0 ? (p(), o("li", E, " Nincs találat ")) : a("", !0)]),
177
- M.value.multiple || M.value.clearable && z.value.length > 0 ? (p(), o("div", D, [M.value.clearable ? (p(), i(e, {
178
- key: 0,
179
- label: "Törlés",
180
- outline: "",
181
- onClick: Q
182
- })) : a("", !0), M.value.multiple ? (p(), i(e, {
183
- key: 1,
184
- label: "OK",
185
- type: "success",
186
- onClick: Z
187
- })) : a("", !0)])) : a("", !0)
188
- ], 2)) : a("", !0)], 512)]));
13
+ setup(t) {
14
+ return (i, a) => (r(), e("div", {
15
+ class: "loader",
16
+ style: n({
17
+ width: t.size,
18
+ "--loader-thickness": `calc(${t.size} / 6)`,
19
+ "--loader-color": t.color
20
+ })
21
+ }, null, 4));
189
22
  }
190
23
  });
191
24
  //#endregion
192
- export { k as default, O as dropdownSelectConfigDefaults };
25
+ export { i as default };
@@ -1 +1 @@
1
- {"version":3,"file":"admins-components23.js","names":[],"sources":["../src/components/DropdownSelect.vue"],"sourcesContent":["<script lang=\"ts\">\nexport interface DropdownSelectConfig {\n placeholder?: string\n filterable?: boolean\n clearable?: boolean\n textEllipsis?: boolean\n multiple?: boolean\n lazy?: boolean\n size?: ControlSize\n}\n\nexport const dropdownSelectConfigDefaults: DropdownSelectConfig = {\n placeholder: 'Select...',\n filterable: true,\n clearable: true,\n textEllipsis: true,\n multiple: false,\n lazy: false,\n size: 'normal' as ControlSize\n}\n\nexport interface DropdownOption {\n icon?: string\n value?: string\n label: string\n callback?: () => void\n}\n\nexport interface DropdownSelectProps {\n modelValue?: 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 { debounce } from '@/utils/debounce'\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: string | string[] | 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<string[]>([])\nconst selection = ref<string[]>(toArray(props.modelValue))\n\nfunction toArray(val: string | string[] | null | undefined): string[] {\n if (val == null) return []\n return Array.isArray(val) ? [...val] : [val]\n}\n\nwatch(\n () => props.modelValue,\n (v) => {\n selection.value = toArray(v)\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 debouncedEmit(text)\n}\n\nconst 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 return props.options.find((o) => o.value === selection.value[0])?.label ?? null\n if (selection.value.length > 2) return `${selection.value.length} kiválasztva`\n return selection.value.map((v) => props.options.find((o) => o.value === v)?.label ?? v).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\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.includes(o.value))\n})\n\nfunction isSelected(value: string): boolean {\n return (cfg.value.lazy && isOpen.value ? buffer : selection).value.includes(value)\n}\n\nfunction toggleAllOptions() {\n const currentList = cfg.value.lazy && isOpen.value ? buffer : selection\n const selectableValues = selectableOptions.value.map((o) => o.value as string)\n\n if (allOptionsSelected.value) {\n currentList.value = currentList.value.filter((v) => !selectableValues.includes(v))\n } else {\n const toAdd = selectableValues.filter((v) => !currentList.value.includes(v))\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: string[], value: string): string[] {\n const idx = list.indexOf(value)\n return idx >= 0 ? list.filter((_, i) => i !== idx) : [...list, value]\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, value)\n } else {\n selection.value = toggleList(selection.value, value)\n emit('update:modelValue', selection.value.length > 0 ? [...selection.value] : null)\n }\n } else {\n selection.value = [value]\n emit('update:modelValue', value)\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 isOpen.value = !isOpen.value\n if (isOpen.value) filterText.value = ''\n}\n\nfunction clearInput() {\n selection.value = []\n emit('update:modelValue', null)\n isOpen.value = false\n}\n\nfunction focusAndOpen() {\n isOpen.value = true\n if (cfg.value.filterable) nextTick(() => filterInputRef.value?.focus())\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 }\"\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 placeholder=\"Filter...\"\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=\"filterText = ''\"\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\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 class=\"d-option__label\" :class=\"{ 'c-truncate': cfg.textEllipsis }\">{{\n 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 </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":";;;;;;;;;;;;;;;;;;;GAWa,IAAqD;CAChE,aAAa;CACb,YAAY;CACZ,WAAW;CACX,cAAc;CACd,UAAU;CACV,MAAM;CACN,MAAM;AACR;;;;;;;;;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,EAAc,CAAC,CAAC,GACzB,IAAY,EAAc,EAAQ,EAAM,UAAU,CAAC;EAEzD,SAAS,EAAQ,GAAqD;GAEpE,OADI,KAAO,OAAa,CAAC,IAClB,MAAM,QAAQ,CAAG,IAAI,CAAC,GAAG,CAAG,IAAI,CAAC,CAAG;E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AAA,MAAI,YAAA,EAAA,GAAlB,EAAyE,GAAA;;IAA7C,OAAM;IAAK,MAAK;IAAW,SAAO"}
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":";;;;;;;;;;;;;yBAeE,EAOO,OAAA;GANL,OAAM;GACL,OAAK,EAAA;WAAiB,EAAA;kCAA0C,EAAA,KAAI;sBAAiC,EAAA"}
@@ -1,7 +1,7 @@
1
- import './src/styles/components/dropdown-select.scss_vue_type_style_index_0_src_true_lang.css';
1
+ import './src/styles/components/loader.scss_vue_type_style_index_0_src_true_lang.css';
2
2
  import e from "./admins-components23.js";
3
3
  /* empty css */
4
- //#region src/components/DropdownSelect.vue
4
+ //#region src/components/Loader.vue
5
5
  var t = e;
6
6
  //#endregion
7
7
  export { t as default };
@@ -1 +1 @@
1
- {"version":3,"file":"admins-components25.js","names":[],"sources":["../src/components/DropdownSelect.vue"],"sourcesContent":["<script lang=\"ts\">\nexport interface DropdownSelectConfig {\n placeholder?: string\n filterable?: boolean\n clearable?: boolean\n textEllipsis?: boolean\n multiple?: boolean\n lazy?: boolean\n size?: ControlSize\n}\n\nexport const dropdownSelectConfigDefaults: DropdownSelectConfig = {\n placeholder: 'Select...',\n filterable: true,\n clearable: true,\n textEllipsis: true,\n multiple: false,\n lazy: false,\n size: 'normal' as ControlSize\n}\n\nexport interface DropdownOption {\n icon?: string\n value?: string\n label: string\n callback?: () => void\n}\n\nexport interface DropdownSelectProps {\n modelValue?: 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 { debounce } from '@/utils/debounce'\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: string | string[] | 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<string[]>([])\nconst selection = ref<string[]>(toArray(props.modelValue))\n\nfunction toArray(val: string | string[] | null | undefined): string[] {\n if (val == null) return []\n return Array.isArray(val) ? [...val] : [val]\n}\n\nwatch(\n () => props.modelValue,\n (v) => {\n selection.value = toArray(v)\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 debouncedEmit(text)\n}\n\nconst 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 return props.options.find((o) => o.value === selection.value[0])?.label ?? null\n if (selection.value.length > 2) return `${selection.value.length} kiválasztva`\n return selection.value.map((v) => props.options.find((o) => o.value === v)?.label ?? v).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\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.includes(o.value))\n})\n\nfunction isSelected(value: string): boolean {\n return (cfg.value.lazy && isOpen.value ? buffer : selection).value.includes(value)\n}\n\nfunction toggleAllOptions() {\n const currentList = cfg.value.lazy && isOpen.value ? buffer : selection\n const selectableValues = selectableOptions.value.map((o) => o.value as string)\n\n if (allOptionsSelected.value) {\n currentList.value = currentList.value.filter((v) => !selectableValues.includes(v))\n } else {\n const toAdd = selectableValues.filter((v) => !currentList.value.includes(v))\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: string[], value: string): string[] {\n const idx = list.indexOf(value)\n return idx >= 0 ? list.filter((_, i) => i !== idx) : [...list, value]\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, value)\n } else {\n selection.value = toggleList(selection.value, value)\n emit('update:modelValue', selection.value.length > 0 ? [...selection.value] : null)\n }\n } else {\n selection.value = [value]\n emit('update:modelValue', value)\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 isOpen.value = !isOpen.value\n if (isOpen.value) filterText.value = ''\n}\n\nfunction clearInput() {\n selection.value = []\n emit('update:modelValue', null)\n isOpen.value = false\n}\n\nfunction focusAndOpen() {\n isOpen.value = true\n if (cfg.value.filterable) nextTick(() => filterInputRef.value?.focus())\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 }\"\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 placeholder=\"Filter...\"\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=\"filterText = ''\"\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\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 class=\"d-option__label\" :class=\"{ 'c-truncate': cfg.textEllipsis }\">{{\n 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 </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-components25.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":""}