@topvisor/ui 1.4.3-fixGroupSelector.0 → 1.4.3-fixGroupSelector.2
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/.chunks/policy.vue_vue_type_style_index_0_lang-BFldQm5e.es.js +519 -0
- package/.chunks/policy.vue_vue_type_style_index_0_lang-BFldQm5e.es.js.map +1 -0
- package/.chunks/policy.vue_vue_type_style_index_0_lang-CR-aHxza.amd.js +2 -0
- package/.chunks/policy.vue_vue_type_style_index_0_lang-CR-aHxza.amd.js.map +1 -0
- package/formsExt/formsExt.amd.js +1 -1
- package/formsExt/formsExt.js +1 -1
- package/icomoon/Topvisor icons.json +285 -229
- package/icomoon/demo.html +29 -1
- package/icomoon/fonts/Topvisor-2.eot +0 -0
- package/icomoon/fonts/Topvisor-2.svg +2 -0
- package/icomoon/fonts/Topvisor-2.ttf +0 -0
- package/icomoon/fonts/Topvisor-2.woff +0 -0
- package/icomoon/selection.json +1 -1
- package/icomoon/style.css +11 -5
- package/package.json +1 -1
- package/project/project.amd.js +1 -1
- package/project/project.amd.js.map +1 -1
- package/project/project.js +192 -177
- package/project/project.js.map +1 -1
- package/src/components/formsExt/selector2/composables/useMenu.d.ts +1 -1
- package/src/components/formsExt/selector2/types.d.ts +6 -0
- package/src/components/project/groupSelector/groups/groups.vue.d.ts +1 -0
- package/src/components/project/groupSelector/groups/utils.d.ts +6 -2
- package/src/components/project/groupSelector/utils.d.ts +10 -4
- package/src/components/project/project.d.ts +1 -0
- package/src/components/project/projectSelector/projectSelector.vue.d.ts +1 -0
- package/.chunks/policy.vue_vue_type_style_index_0_lang-BavS2pf9.es.js +0 -517
- package/.chunks/policy.vue_vue_type_style_index_0_lang-BavS2pf9.es.js.map +0 -1
- package/.chunks/policy.vue_vue_type_style_index_0_lang-gH1s78kS.amd.js +0 -2
- package/.chunks/policy.vue_vue_type_style_index_0_lang-gH1s78kS.amd.js.map +0 -1
|
@@ -5,7 +5,7 @@ import { ITEM_ID_NEW } from '../utils';
|
|
|
5
5
|
/**
|
|
6
6
|
* Функционал поиска
|
|
7
7
|
*/
|
|
8
|
-
export declare const useMenu: (model: Ref<Props["modelValue"]>, emits: ReturnType<typeof defineEmits>, items: Ref<Props["items"]>, multiselect: Props["multiselect"], useAllItem: Ref<Props["useAllItem"]>, appendSearchToResult: Ref<Props["appendSearchToResult"]>, appendSearchToResultCond: Ref<Props["appendSearchToResultCond"]>, appendWithoutSelect: Ref<Props["appendWithoutSelect"]>, searchFields: Ref<Props["searchFields"]>, searchType: Ref<Props["searchType"]>, minLength: number, api: API) => {
|
|
8
|
+
export declare const useMenu: (model: Ref<Props["modelValue"]>, emits: ReturnType<typeof defineEmits>, items: Ref<Props["items"]>, multiselect: Props["multiselect"], useAllItem: Ref<Props["useAllItem"]>, appendSearchToResult: Ref<Props["appendSearchToResult"]>, appendSearchAllowDuplicate: Ref<Props["appendSearchAllowDuplicate"]>, appendSearchToResultCond: Ref<Props["appendSearchToResultCond"]>, appendWithoutSelect: Ref<Props["appendWithoutSelect"]>, searchFields: Ref<Props["searchFields"]>, searchType: Ref<Props["searchType"]>, minLength: number, api: API) => {
|
|
9
9
|
searchText: Ref<string, string>;
|
|
10
10
|
resetSearch: () => void;
|
|
11
11
|
genIsShort: () => boolean;
|
|
@@ -101,6 +101,12 @@ export interface Props {
|
|
|
101
101
|
* При добавлении элемента будет вызван emit `appendItem(item)`
|
|
102
102
|
*/
|
|
103
103
|
appendSearchToResult?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Разрешить добавлять элемент, даже если в списке уже есть точное совпадение по имени
|
|
106
|
+
*
|
|
107
|
+
* Работает только вместе с `appendSearchToResult = true`
|
|
108
|
+
*/
|
|
109
|
+
appendSearchAllowDuplicate?: boolean;
|
|
104
110
|
/**
|
|
105
111
|
* Условие отображения пункта «добавить введённое значение» `item = {id:null, name:search}`
|
|
106
112
|
*
|
|
@@ -45,6 +45,7 @@ declare const _default: DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, Compo
|
|
|
45
45
|
readonly minLength?: number | undefined;
|
|
46
46
|
readonly useCache?: boolean | undefined;
|
|
47
47
|
readonly appendSearchToResult?: boolean | undefined;
|
|
48
|
+
readonly appendSearchAllowDuplicate?: boolean | undefined;
|
|
48
49
|
readonly appendSearchToResultCond?: ((search: string) => boolean) | undefined;
|
|
49
50
|
readonly appendWithoutSelect?: boolean | undefined;
|
|
50
51
|
readonly multiselect?: boolean | undefined;
|
|
@@ -81,7 +81,9 @@ export declare const genApiGetGroups: (client: Api.Client<Api.TV.Paths, true>, s
|
|
|
81
81
|
hash_id?: number | null;
|
|
82
82
|
hash?: number | null;
|
|
83
83
|
} | {
|
|
84
|
-
subdomain?: components["schemas"]
|
|
84
|
+
subdomain?: components["schemas"] /**
|
|
85
|
+
* Элемент для выбора всех групп
|
|
86
|
+
*/["TV.API.Types.Topvisor.Subdomain"];
|
|
85
87
|
text: string;
|
|
86
88
|
page_url?: string | null;
|
|
87
89
|
reply_id?: number | null;
|
|
@@ -458,7 +460,9 @@ export declare const genApiAddGroup: (client: Api.Client<Api.TV.Paths, true>, se
|
|
|
458
460
|
hash_id?: number | null;
|
|
459
461
|
hash?: number | null;
|
|
460
462
|
} | {
|
|
461
|
-
subdomain?: components["schemas"]
|
|
463
|
+
subdomain?: components["schemas"] /**
|
|
464
|
+
* Элемент для выбора всех групп
|
|
465
|
+
*/["TV.API.Types.Topvisor.Subdomain"];
|
|
462
466
|
text: string;
|
|
463
467
|
page_url?: string | null;
|
|
464
468
|
reply_id?: number | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Props } from './groups/types';
|
|
2
2
|
import { Folder } from './folders/types';
|
|
3
3
|
import { ListItemProps } from '../../popup/popup/types';
|
|
4
|
-
import { ITEM_ID_NEW } from '../../formsExt/formsExt';
|
|
4
|
+
import { ITEM_ID_ALL, ITEM_ID_NEW } from '../../formsExt/formsExt';
|
|
5
5
|
/**
|
|
6
6
|
* Генерировать отформатированную папку
|
|
7
7
|
*/
|
|
@@ -20,10 +20,16 @@ export declare const genFormatedFolder: (folder: Folder) => {
|
|
|
20
20
|
/**
|
|
21
21
|
* Генерировать отформатированную группу
|
|
22
22
|
*/
|
|
23
|
-
export declare const genFormatedGroup: (group:
|
|
23
|
+
export declare const genFormatedGroup: (group: Props["group"]) => {
|
|
24
|
+
name: string;
|
|
25
|
+
id: ITEM_ID_ALL;
|
|
26
|
+
} | {
|
|
27
|
+
name: string;
|
|
28
|
+
id: ITEM_ID_NEW;
|
|
29
|
+
} | {
|
|
24
30
|
name: string;
|
|
25
|
-
folder_path: string;
|
|
26
31
|
folder_id: number;
|
|
32
|
+
folder_path: string;
|
|
27
33
|
on?: 0 | 1;
|
|
28
34
|
status?: 0 | 1;
|
|
29
35
|
id: number | ITEM_ID_NEW;
|
|
@@ -4,6 +4,7 @@ export { default as TopRegionSelector } from './regionSelector/regionSelector.vu
|
|
|
4
4
|
export { findRegion, genSearcherByKey, dialogRegionSelector } from './regionSelector/utils/utils';
|
|
5
5
|
export { default as TopGroupSelector } from './groupSelector/groupSelector.vue';
|
|
6
6
|
export { default as TopProjectSelector } from './projectSelector/projectSelector.vue';
|
|
7
|
+
export { clearCache } from './projectSelector/cache';
|
|
7
8
|
export type { Emits as TopTagSelectorEmits, Tag, TagId, TagIdExclude } from './tagSelector/types';
|
|
8
9
|
export { genElPopupOpener as genElTopTagSelectorPopupOpener, renderElPopupOpener as renderElTopTagSelectorPopupOpener, } from './tagSelector/utils/el';
|
|
9
10
|
export { default as TopTagSelector } from './tagSelector/tagSelector.vue';
|
|
@@ -37,6 +37,7 @@ declare const _default: DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, Compo
|
|
|
37
37
|
readonly minLength?: number | undefined;
|
|
38
38
|
readonly useCache?: boolean | undefined;
|
|
39
39
|
readonly appendSearchToResult?: boolean | undefined;
|
|
40
|
+
readonly appendSearchAllowDuplicate?: boolean | undefined;
|
|
40
41
|
readonly appendSearchToResultCond?: ((search: string) => boolean) | undefined;
|
|
41
42
|
readonly appendWithoutSelect?: boolean | undefined;
|
|
42
43
|
readonly multiselect?: boolean | undefined;
|
|
@@ -1,517 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { Core as _autoloadCSSCore } from '../core/app.js';
|
|
3
|
-
const fileNames = ['../assets/policy.css'].map(fileName => import.meta.resolve(fileName));
|
|
4
|
-
_autoloadCSSCore.insertCSSLinkToPage(fileNames, true);
|
|
5
|
-
|
|
6
|
-
import { defineComponent as G, mergeModels as U, useModel as oe, ref as F, onMounted as de, onUpdated as fe, createElementBlock as T, openBlock as y, normalizeClass as pe, createCommentVNode as M, Fragment as R, renderList as H, createBlock as b, mergeProps as W, createSlots as Y, withCtx as B, createTextVNode as V, toDisplayString as P, createVNode as re, createElementVNode as ie, withModifiers as ve, computed as q, watch as j, toRef as E, resolveComponent as ee, resolveDirective as te, unref as c, renderSlot as me, withDirectives as le, resolveDynamicComponent as he } from "vue";
|
|
7
|
-
import { e as ae, b as ye, C as J, d as ge, u as Ae, s as Ie } from "./forms-BpbQYyEQ.es.js";
|
|
8
|
-
import { _ as Ce, b as se } from "./popupHint.vue_vue_type_style_index_0_lang-if4Qli-k.es.js";
|
|
9
|
-
import { _ as Te } from "./widgetInput.vue_vue_type_script_setup_true_lang-Dy8jWadl.es.js";
|
|
10
|
-
import { invertKeyboardLayout as ke } from "../utils/keyboard.js";
|
|
11
|
-
import { g as Le } from "./field-CyyFzM-Y.es.js";
|
|
12
|
-
const Se = {
|
|
13
|
-
key: 0,
|
|
14
|
-
class: "top-menu_selectAll"
|
|
15
|
-
}, Ue = /* @__PURE__ */ G({
|
|
16
|
-
__name: "menu",
|
|
17
|
-
props: /* @__PURE__ */ U({
|
|
18
|
-
modelValue: {},
|
|
19
|
-
items: {},
|
|
20
|
-
isMultiple: { type: Boolean },
|
|
21
|
-
canBeEmptyMultiple: { type: Boolean },
|
|
22
|
-
styling: { default: "default" },
|
|
23
|
-
selectAllItem: {}
|
|
24
|
-
}, {
|
|
25
|
-
modelValue: {
|
|
26
|
-
required: !0
|
|
27
|
-
},
|
|
28
|
-
modelModifiers: {}
|
|
29
|
-
}),
|
|
30
|
-
emits: ["update:modelValue"],
|
|
31
|
-
setup(e) {
|
|
32
|
-
const a = e, l = oe(e, "modelValue"), t = F();
|
|
33
|
-
!a.isMultiple && typeof l.value != "string" && typeof l.value != "number" && console.warn('Type check failed for prop "modelValue". Expected String: ' + typeof l.value), a.isMultiple && !Array.isArray(l.value) && console.warn('Type check failed for prop "modelValue". Expected Array: ' + typeof l.value), a.isMultiple && !a.canBeEmptyMultiple && Array.isArray(l.value) && !l.value.length && a.items[0] && (l.value = [a.items[0]?.href ?? a.items[0]?.value]);
|
|
34
|
-
const u = (d) => Array.isArray(l.value) ? l.value.includes(d.value) : d.value === l.value, k = (d, g = !1) => {
|
|
35
|
-
if (Array.isArray(l.value)) {
|
|
36
|
-
let n = l.value.slice();
|
|
37
|
-
if (g) {
|
|
38
|
-
n.length || (n = a.items.map((h) => h.value));
|
|
39
|
-
const m = n.indexOf(d.value);
|
|
40
|
-
m === -1 ? n.push(d.value) : n.splice(m, 1);
|
|
41
|
-
} else
|
|
42
|
-
n.length === 1 && n[0] === d.value ? n = [] : n = [d.value];
|
|
43
|
-
!a.canBeEmptyMultiple && !n.length && (n = [d.value]), l.value = n;
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
l.value = d.value;
|
|
47
|
-
}, p = (d) => {
|
|
48
|
-
if (t.value.scrollWidth <= t.value.offsetWidth || d.shiftKey || Math.abs(d.deltaY) < 50) return;
|
|
49
|
-
d.preventDefault();
|
|
50
|
-
const g = d.deltaY > 0 ? 30 : -30;
|
|
51
|
-
t.value.scrollLeft = t.value.scrollLeft + g;
|
|
52
|
-
}, i = (d = !0) => {
|
|
53
|
-
const g = t.value.querySelector(".top-active");
|
|
54
|
-
if (!g) return;
|
|
55
|
-
const n = 24, m = g.offsetLeft - t.value.offsetLeft - n, h = g.offsetLeft - t.value.offsetLeft + g.clientWidth + n, A = t.value.scrollLeft, w = t.value.clientWidth + t.value.scrollLeft;
|
|
56
|
-
let C;
|
|
57
|
-
m < A && (C = m), h > w && (C = h - t.value.clientWidth), C !== void 0 && (ye() ? J.$?.(t.value).animate({ scrollLeft: C }, d ? 200 : 0) : t.value.scrollTo({ left: C, behavior: d ? "smooth" : "auto" }));
|
|
58
|
-
}, s = () => {
|
|
59
|
-
if (Array.isArray(l.value)) {
|
|
60
|
-
if (l.value.length === a.items.length) {
|
|
61
|
-
l.value = [a.items[0].href ?? a.items[0].value];
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
l.value = a.items.map((d) => d.href ?? d.value);
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
return de(() => i(!1)), fe(() => i(!0)), (d, g) => (y(), T("div", {
|
|
68
|
-
ref_key: "el",
|
|
69
|
-
ref: t,
|
|
70
|
-
class: pe({
|
|
71
|
-
"top-menu": !0,
|
|
72
|
-
["top-style_" + e.styling]: !0
|
|
73
|
-
// ['top-unwrap-x']: styling === 'default',
|
|
74
|
-
}),
|
|
75
|
-
onWheel: p
|
|
76
|
-
}, [
|
|
77
|
-
(y(!0), T(R, null, H(e.items, (n) => (y(), b(ae, W({ ref_for: !0 }, n, {
|
|
78
|
-
class: "top-menu_item",
|
|
79
|
-
color: "theme",
|
|
80
|
-
onClick: (m) => k(n, m.ctrlKey || m.metaKey),
|
|
81
|
-
isActive: u(n)
|
|
82
|
-
}), Y({ _: 2 }, [
|
|
83
|
-
n.content ? {
|
|
84
|
-
name: "default",
|
|
85
|
-
fn: B(() => [
|
|
86
|
-
V(P(n.content), 1)
|
|
87
|
-
]),
|
|
88
|
-
key: "0"
|
|
89
|
-
} : void 0
|
|
90
|
-
]), 1040, ["onClick", "isActive"]))), 256)),
|
|
91
|
-
Array.isArray(l.value) && e.selectAllItem ? (y(), T("div", Se, [
|
|
92
|
-
re(ae, W(e.selectAllItem, {
|
|
93
|
-
class: "top-menu_item",
|
|
94
|
-
color: "theme",
|
|
95
|
-
styling: "",
|
|
96
|
-
onClick: g[0] || (g[0] = (n) => s()),
|
|
97
|
-
isActive: l.value.length === e.items.length
|
|
98
|
-
}), Y({ _: 2 }, [
|
|
99
|
-
e.selectAllItem.content ? {
|
|
100
|
-
name: "default",
|
|
101
|
-
fn: B(() => [
|
|
102
|
-
V(P(e.selectAllItem.content), 1)
|
|
103
|
-
]),
|
|
104
|
-
key: "0"
|
|
105
|
-
} : void 0
|
|
106
|
-
]), 1040, ["isActive"])
|
|
107
|
-
])) : M("", !0)
|
|
108
|
-
], 34));
|
|
109
|
-
}
|
|
110
|
-
}), be = { class: "top-selector2_itemMulti top-ellipsis" }, Be = /* @__PURE__ */ G({
|
|
111
|
-
__name: "itemMulti",
|
|
112
|
-
props: {
|
|
113
|
-
id: {},
|
|
114
|
-
name: {}
|
|
115
|
-
},
|
|
116
|
-
emits: ["delete"],
|
|
117
|
-
setup(e) {
|
|
118
|
-
return (a, l) => (y(), T("div", be, [
|
|
119
|
-
V(P(e.name) + " ", 1),
|
|
120
|
-
ie("span", {
|
|
121
|
-
class: "top-selector2_itemMultiDelete",
|
|
122
|
-
"data-top-icon": "",
|
|
123
|
-
onClick: l[0] || (l[0] = (t) => a.$emit("delete", { id: e.id, name: e.name })),
|
|
124
|
-
onMousedown: l[1] || (l[1] = ve(() => {
|
|
125
|
-
}, ["stop"]))
|
|
126
|
-
}, null, 32)
|
|
127
|
-
]));
|
|
128
|
-
}
|
|
129
|
-
}), K = /* @__PURE__ */ new Map(), we = (e) => {
|
|
130
|
-
K.get(e)?.clear();
|
|
131
|
-
}, xe = (e) => {
|
|
132
|
-
const a = window.mo?.user?.id;
|
|
133
|
-
return JSON.stringify(e.params) + ":" + e.url + ":" + a;
|
|
134
|
-
}, Me = (e, a) => K.get(a)?.get(e), Pe = (e, a, l) => {
|
|
135
|
-
K.has(a) || K.set(a, /* @__PURE__ */ new Map()), K.get(a)?.set(e, l);
|
|
136
|
-
}, $e = (e, a, l, t) => {
|
|
137
|
-
const u = F([]), k = F(!1), p = F(0);
|
|
138
|
-
let i = "", s;
|
|
139
|
-
e && !e.params.limit && (e.params.limit = 100);
|
|
140
|
-
const d = async () => {
|
|
141
|
-
if (!e) return;
|
|
142
|
-
const h = t ? xe(e) : void 0;
|
|
143
|
-
if (h) {
|
|
144
|
-
const C = Me(h, e.path);
|
|
145
|
-
if (C)
|
|
146
|
-
return e.abortByFingerprint(), C;
|
|
147
|
-
}
|
|
148
|
-
const A = await e.call();
|
|
149
|
-
if (A.errors) return;
|
|
150
|
-
if (!Array.isArray(A.result)) {
|
|
151
|
-
console.warn("Array expected in `res.result`");
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
const w = A.result.findIndex((C) => C.id === void 0 || C.name === void 0);
|
|
155
|
-
if (w !== -1) {
|
|
156
|
-
console.warn(`В result[${w}] нет id или name`);
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
return h && Pe(h, e.path, A), A;
|
|
160
|
-
}, g = async (h) => {
|
|
161
|
-
if (!e) return;
|
|
162
|
-
if (h) {
|
|
163
|
-
if (!s || k.value) return;
|
|
164
|
-
e.params.offset = s;
|
|
165
|
-
} else
|
|
166
|
-
e.params.offset = 0;
|
|
167
|
-
a?.(e, i), k.value = !0;
|
|
168
|
-
const A = await d();
|
|
169
|
-
k.value = !1, p.value++, A && (s = A.nextOffset, h ? u.value = u.value.concat(A.result) : u.value = A.result);
|
|
170
|
-
}, n = ge(() => g(!1), 200);
|
|
171
|
-
return {
|
|
172
|
-
apiRequest: e,
|
|
173
|
-
items: u,
|
|
174
|
-
isLoading: k,
|
|
175
|
-
countLoading: p,
|
|
176
|
-
load: g,
|
|
177
|
-
setSearchTextAndLoad: (h, A = !0) => {
|
|
178
|
-
if (e) {
|
|
179
|
-
if (h.length < l) {
|
|
180
|
-
e.abortByFingerprint(), u.value = [];
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
h === i && u.value.length || (i = h, A ? n() : g(!1));
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
};
|
|
187
|
-
}, ue = 0, O = null, ne = (e, a, l = !0) => l && a.id === O ? Array.isArray(e) ? e.some((t) => t.id === a.id && t.name === a.name) : a.name === e.name : Array.isArray(e) ? e.some((t) => t.id === a.id) : a.id === e.id, He = (e, a, l) => {
|
|
188
|
-
let t = e.params.filters ?? [];
|
|
189
|
-
t = t.filter((u) => u.name !== l), a && t.push(Le(l, "CONTAINS", [a])), e.changeParams({ filters: t });
|
|
190
|
-
}, Fe = (e, a, l, t, u, k, p, i, s, d, g, n) => {
|
|
191
|
-
const m = F(""), h = {
|
|
192
|
-
id: ue,
|
|
193
|
-
name: Ae().Common.All
|
|
194
|
-
}, A = () => {
|
|
195
|
-
m.value = "";
|
|
196
|
-
}, w = () => !(!n.apiRequest || m.value.length >= g), C = q(() => {
|
|
197
|
-
const o = [];
|
|
198
|
-
return !t && u.value && (typeof u.value == "string" && (h.name = u.value), o.push(h)), l.value?.forEach((r) => o.push({ ...r })), o;
|
|
199
|
-
}), N = F([]), f = () => {
|
|
200
|
-
N.value = v();
|
|
201
|
-
}, v = () => {
|
|
202
|
-
const o = m.value.toLowerCase(), r = ke(o);
|
|
203
|
-
let L = [], $;
|
|
204
|
-
const S = [], X = () => {
|
|
205
|
-
S.at(-1)?.listItemProps?.type === "delimiter" && S.pop(), S.length && ($ && L.push($), L.push(...S), S.length = 0);
|
|
206
|
-
};
|
|
207
|
-
for (const I of C.value)
|
|
208
|
-
switch (I.listItemProps?.type) {
|
|
209
|
-
case "title":
|
|
210
|
-
X(), $ = I;
|
|
211
|
-
break;
|
|
212
|
-
case "delimiter":
|
|
213
|
-
if (S.length) {
|
|
214
|
-
let x = S.length;
|
|
215
|
-
S.at(-1)?.listItemProps?.type === "delimiter" && x--, S[x] = I;
|
|
216
|
-
}
|
|
217
|
-
break;
|
|
218
|
-
default:
|
|
219
|
-
const ce = s.value?.includes("id"), Z = I.name.toLowerCase(), _ = s.value?.filter((x) => x !== "id").map((x) => typeof I[x] == "string" || typeof I[x] == "number" ? I[x] : "").join("☼").toLowerCase();
|
|
220
|
-
(ce && I.id === Number(o) || _?.includes(o) || _?.includes(r)) && (Z === o || Z === r ? S.unshift(I) : S.push(I));
|
|
221
|
-
}
|
|
222
|
-
if (X(), L.push(...n.items.value), k.value && m.value && (!p.value || p.value(o)) && // результаты могут быть найдены, но не точные, тогда предложить добавить элемент
|
|
223
|
-
!L.find((I) => I.name.toLowerCase() === o)) {
|
|
224
|
-
const I = {
|
|
225
|
-
id: O,
|
|
226
|
-
name: m.value
|
|
227
|
-
};
|
|
228
|
-
i.value && (I.listItemProps = { closeByClick: !1 }), L.push(I);
|
|
229
|
-
}
|
|
230
|
-
return t && (L = L.filter((I) => !ne(e.value, I))), L;
|
|
231
|
-
}, D = (o) => {
|
|
232
|
-
o.listItemProps?.type === "title" || o.listItemProps?.type === "delimiter" || o.id === O && (a("appendItem", o), i.value) || (t && Array.isArray(e.value) ? ne(e.value, o) || (e.value = [...e.value, o]) : e.value = o, setTimeout(() => {
|
|
233
|
-
A();
|
|
234
|
-
}));
|
|
235
|
-
};
|
|
236
|
-
if (n.apiRequest) {
|
|
237
|
-
const o = [l, n.items];
|
|
238
|
-
t && o.push(e), j(o, () => {
|
|
239
|
-
f();
|
|
240
|
-
});
|
|
241
|
-
} else
|
|
242
|
-
j([e, l, m], () => {
|
|
243
|
-
f();
|
|
244
|
-
}, {
|
|
245
|
-
immediate: !0,
|
|
246
|
-
// слежение за изменениями `items`
|
|
247
|
-
deep: 2
|
|
248
|
-
});
|
|
249
|
-
return {
|
|
250
|
-
searchText: m,
|
|
251
|
-
resetSearch: A,
|
|
252
|
-
genIsShort: w,
|
|
253
|
-
itemsForShow: N,
|
|
254
|
-
selectItem: D,
|
|
255
|
-
selectNextItem: () => {
|
|
256
|
-
if (Array.isArray(e.value)) return;
|
|
257
|
-
const o = N.value.filter(($) => !["title", "delimiter"].includes($.listItemProps?.type ?? "")), L = (o.findIndex(($) => $.id === e.value.id) + 1) % o.length;
|
|
258
|
-
e.value = { ...o[L] };
|
|
259
|
-
},
|
|
260
|
-
deleteItemByItem: async (o) => {
|
|
261
|
-
Array.isArray(e.value) && (e.value = e.value.filter((r) => r.id !== o.id || r.name !== o.name));
|
|
262
|
-
}
|
|
263
|
-
};
|
|
264
|
-
}, De = {
|
|
265
|
-
key: 0,
|
|
266
|
-
class: "top-selector2_activeItems"
|
|
267
|
-
}, Ee = {
|
|
268
|
-
key: 1,
|
|
269
|
-
class: "top-selector2_activeName top-ellipsis"
|
|
270
|
-
}, Ve = {
|
|
271
|
-
key: 2,
|
|
272
|
-
class: "top-selector2_placeholder top-ellipsis"
|
|
273
|
-
}, Ne = { class: "top-selector2_searchWidget" }, Ye = /* @__PURE__ */ G({
|
|
274
|
-
__name: "selector2",
|
|
275
|
-
props: /* @__PURE__ */ U({
|
|
276
|
-
modelValue: {},
|
|
277
|
-
items: { default: () => [] },
|
|
278
|
-
title: {},
|
|
279
|
-
disabled: { type: Boolean },
|
|
280
|
-
icon: {},
|
|
281
|
-
modificator: {},
|
|
282
|
-
size: { default: "s" },
|
|
283
|
-
isError: { type: Boolean },
|
|
284
|
-
openByFocusInput: { type: Boolean, default: void 0 },
|
|
285
|
-
searchType: { default: "popup" },
|
|
286
|
-
searchFields: { default: () => ["id", "name"] },
|
|
287
|
-
placeholder: {},
|
|
288
|
-
hasCloserBtn: { type: Boolean },
|
|
289
|
-
api: {},
|
|
290
|
-
apiSetSearchParams: {},
|
|
291
|
-
minLength: { default: 0 },
|
|
292
|
-
useCache: { type: Boolean },
|
|
293
|
-
appendSearchToResult: { type: Boolean },
|
|
294
|
-
appendSearchToResultCond: {},
|
|
295
|
-
appendWithoutSelect: { type: Boolean },
|
|
296
|
-
multiselect: { type: Boolean },
|
|
297
|
-
useAllItem: { type: [Boolean, String] },
|
|
298
|
-
addChanger: { type: Boolean },
|
|
299
|
-
buttonProps: {},
|
|
300
|
-
selectedAsPlaceholder: { type: Boolean },
|
|
301
|
-
openerShortcut: {}
|
|
302
|
-
}, {
|
|
303
|
-
modelValue: { required: !0 },
|
|
304
|
-
modelModifiers: {}
|
|
305
|
-
}),
|
|
306
|
-
emits: /* @__PURE__ */ U(["appendItem", "open"], ["update:modelValue"]),
|
|
307
|
-
setup(e, { expose: a, emit: l }) {
|
|
308
|
-
const t = e, u = oe(e, "modelValue"), k = l;
|
|
309
|
-
a({
|
|
310
|
-
/**
|
|
311
|
-
* Сброс локального кеша и кеша api
|
|
312
|
-
*
|
|
313
|
-
* @param resetAPICache - Сбросить API кеш, по умолчанию не сбрасывается. Для случаев, когда загруженные данные становятся неактуальными
|
|
314
|
-
*/
|
|
315
|
-
resetCache: (f = !1) => {
|
|
316
|
-
i.apiRequest && (f && we(i.apiRequest.path), i.items.value = [], i.countLoading.value = 0, i.apiRequest.params.offset = 0, requestAnimationFrame(() => {
|
|
317
|
-
s.itemsForShow.value = [];
|
|
318
|
-
}), n()?.elPopup && i.setSearchTextAndLoad(s.searchText.value));
|
|
319
|
-
}
|
|
320
|
-
});
|
|
321
|
-
const p = q(() => t.searchType === "inline" && t.multiselect || t.searchType === "inline" && J.state.isMobile ? "popup" : t.searchType), i = $e(t.api, t.apiSetSearchParams, t.minLength, t.useCache), s = Fe(
|
|
322
|
-
u,
|
|
323
|
-
k,
|
|
324
|
-
E(t, "items"),
|
|
325
|
-
t.multiselect,
|
|
326
|
-
E(t, "useAllItem"),
|
|
327
|
-
E(t, "appendSearchToResult"),
|
|
328
|
-
E(t, "appendSearchToResultCond"),
|
|
329
|
-
E(t, "appendWithoutSelect"),
|
|
330
|
-
E(t, "searchFields"),
|
|
331
|
-
p,
|
|
332
|
-
t.minLength,
|
|
333
|
-
i
|
|
334
|
-
), d = q(() => t.buttonProps ? "TopButton" : p.value === "inline" ? "TopInput" : "div"), g = F(null), n = () => g.value?.popup;
|
|
335
|
-
i.apiRequest && j(s.searchText, () => {
|
|
336
|
-
i.setSearchTextAndLoad(s.searchText.value);
|
|
337
|
-
});
|
|
338
|
-
const m = q(() => Array.isArray(u.value) || t.multiselect || !t.selectedAsPlaceholder && p.value !== "inline" ? t.placeholder : u.value?.name || t.placeholder), h = (f) => {
|
|
339
|
-
let v = !1;
|
|
340
|
-
switch (f.key) {
|
|
341
|
-
case "Delete":
|
|
342
|
-
case "Backspace":
|
|
343
|
-
Array.isArray(u.value) && (f.preventDefault(), f.stopPropagation(), u.value.pop());
|
|
344
|
-
break;
|
|
345
|
-
case "ArrowUp":
|
|
346
|
-
case "ArrowRight":
|
|
347
|
-
case "ArrowDown":
|
|
348
|
-
case "ArrowLeft":
|
|
349
|
-
case "Enter":
|
|
350
|
-
case " ":
|
|
351
|
-
v = !0;
|
|
352
|
-
break;
|
|
353
|
-
case "Escape":
|
|
354
|
-
p.value === "inline" && s.resetSearch();
|
|
355
|
-
break;
|
|
356
|
-
}
|
|
357
|
-
const D = f.key.length === 1 && !f.ctrlKey && !f.metaKey;
|
|
358
|
-
(p.value === "popup" || p.value === "inline") && D && (v = !0), n()?.elPopup && (v = !1), v && (p.value === "popup" && (f.preventDefault(), f.stopPropagation(), D && (s.searchText.value || (s.searchText.value = f.key))), f.currentTarget?.click());
|
|
359
|
-
}, A = (f) => {
|
|
360
|
-
f.preventDefault(), s.selectNextItem();
|
|
361
|
-
}, w = () => {
|
|
362
|
-
i.apiRequest && i.setSearchTextAndLoad(s.searchText.value, !1), k("open");
|
|
363
|
-
}, C = () => {
|
|
364
|
-
p.value === "popup" && s.searchText.value && s.resetSearch();
|
|
365
|
-
}, N = (f) => {
|
|
366
|
-
const v = f.target;
|
|
367
|
-
v.scrollTop / (v.scrollHeight - v.offsetHeight) > 0.8 && i.load(!0);
|
|
368
|
-
};
|
|
369
|
-
return (f, v) => {
|
|
370
|
-
const D = ee("TopButton"), Q = ee("TopLoadbar"), z = te("top-focus"), o = te("top-shortcut");
|
|
371
|
-
return y(), b(c(Ce), {
|
|
372
|
-
ref_key: "popupRef",
|
|
373
|
-
ref: g,
|
|
374
|
-
onOpen: v[3] || (v[3] = (r) => w()),
|
|
375
|
-
onClose: v[4] || (v[4] = (r) => C()),
|
|
376
|
-
onScrollContentList: v[5] || (v[5] = (r) => c(i) ? N(r) : void 0),
|
|
377
|
-
notch: !1,
|
|
378
|
-
transitionDuration: 0,
|
|
379
|
-
openByFocusInput: p.value === "inline" && (e.openByFocusInput ?? !0),
|
|
380
|
-
disabled: p.value === "inline" && c(s).genIsShort()
|
|
381
|
-
}, Y({
|
|
382
|
-
opener: B(() => [
|
|
383
|
-
le((y(), b(he(d.value), W(e.buttonProps, {
|
|
384
|
-
class: {
|
|
385
|
-
"top-selector2": !0,
|
|
386
|
-
"top-selector2-multiselect": e.multiselect,
|
|
387
|
-
["top-selector2-" + e.modificator]: !!e.modificator,
|
|
388
|
-
"top-as-input": !e.buttonProps && p.value !== "inline",
|
|
389
|
-
"top-as-selector": !0,
|
|
390
|
-
["top-size_" + e.size]: !0,
|
|
391
|
-
"top-disabled": e.disabled,
|
|
392
|
-
"top-forms-focusable": !e.disabled,
|
|
393
|
-
"top-error": e.isError
|
|
394
|
-
},
|
|
395
|
-
icon: e.icon,
|
|
396
|
-
tabindex: "0",
|
|
397
|
-
onKeydown: h,
|
|
398
|
-
onBlur: v[0] || (v[0] = (r) => p.value === "inline" && c(s).resetSearch()),
|
|
399
|
-
placeholder: m.value,
|
|
400
|
-
title: e.title,
|
|
401
|
-
captionType: p.value === "inline" && e.title !== void 0 ? "top" : void 0,
|
|
402
|
-
modelValue: c(s).searchText.value,
|
|
403
|
-
"onUpdate:modelValue": v[1] || (v[1] = (r) => c(s).searchText.value = r)
|
|
404
|
-
}), {
|
|
405
|
-
default: B(() => [
|
|
406
|
-
e.multiselect ? (y(), T("div", De, [
|
|
407
|
-
(y(!0), T(R, null, H(u.value, (r) => (y(), b(Be, {
|
|
408
|
-
id: r.id,
|
|
409
|
-
name: r.name,
|
|
410
|
-
onDelete: c(s).deleteItemByItem
|
|
411
|
-
}, null, 8, ["id", "name", "onDelete"]))), 256))
|
|
412
|
-
])) : M("", !0),
|
|
413
|
-
p.value !== "inline" && !e.multiselect ? (y(), T("span", Ee, P(Array.isArray(u.value) ? "" : u.value.name), 1)) : M("", !0),
|
|
414
|
-
e.multiselect && !u.value.length ? (y(), T("span", Ve, P(m.value), 1)) : M("", !0),
|
|
415
|
-
e.addChanger && !e.buttonProps && !e.multiselect && c(s).itemsForShow.value.length > 1 && !e.disabled ? (y(), T("span", {
|
|
416
|
-
key: 3,
|
|
417
|
-
class: "top-changer top-changer-selector",
|
|
418
|
-
"data-top-popup-disabled": "true",
|
|
419
|
-
onClick: A
|
|
420
|
-
})) : M("", !0)
|
|
421
|
-
]),
|
|
422
|
-
_: 1
|
|
423
|
-
}, 16, ["class", "icon", "placeholder", "title", "captionType", "modelValue"])), [
|
|
424
|
-
[
|
|
425
|
-
z,
|
|
426
|
-
e.isError,
|
|
427
|
-
void 0,
|
|
428
|
-
{ onupdate: !0 }
|
|
429
|
-
],
|
|
430
|
-
[o, e.openerShortcut]
|
|
431
|
-
])
|
|
432
|
-
]),
|
|
433
|
-
contentList: B(() => [
|
|
434
|
-
(y(!0), T(R, null, H(c(s).itemsForShow.value, (r) => (y(), b(c(se), W({
|
|
435
|
-
key: r.id ?? void 0,
|
|
436
|
-
class: {
|
|
437
|
-
"top-active": !Array.isArray(u.value) && !e.multiselect && u.value.id === r.id && u.value.name === r.name,
|
|
438
|
-
"top-selector2_item-all": r.id === c(ue),
|
|
439
|
-
"top-selector2_item-new": r.id === c(O)
|
|
440
|
-
},
|
|
441
|
-
closeByClick: !e.multiselect || c(J).state.isMobile
|
|
442
|
-
}, { ref_for: !0 }, r.listItemProps, {
|
|
443
|
-
onClick: (L) => c(s).selectItem(r)
|
|
444
|
-
}), {
|
|
445
|
-
default: B(() => [
|
|
446
|
-
f.$slots.item ? me(f.$slots, "item", {
|
|
447
|
-
key: 0,
|
|
448
|
-
item: r
|
|
449
|
-
}) : (y(), T(R, { key: 1 }, [
|
|
450
|
-
V(P(r.name), 1)
|
|
451
|
-
], 64))
|
|
452
|
-
]),
|
|
453
|
-
_: 2
|
|
454
|
-
}, 1040, ["class", "closeByClick", "onClick"]))), 128)),
|
|
455
|
-
!c(s).itemsForShow.value.length && !c(s).genIsShort() ? (y(), b(c(se), {
|
|
456
|
-
key: 0,
|
|
457
|
-
type: "regular"
|
|
458
|
-
}, {
|
|
459
|
-
default: B(() => [
|
|
460
|
-
!c(i).isLoading.value || c(i).countLoading.value ? (y(), T(R, { key: 0 }, [
|
|
461
|
-
V(P(f.$i18n.Common.No_results), 1)
|
|
462
|
-
], 64)) : (y(), b(c(Ie), {
|
|
463
|
-
key: 1,
|
|
464
|
-
type: "circles"
|
|
465
|
-
}))
|
|
466
|
-
]),
|
|
467
|
-
_: 1
|
|
468
|
-
})) : M("", !0),
|
|
469
|
-
c(i).countLoading.value && c(i).isLoading.value && p.value === "inline" ? (y(), b(Q, { key: 1 })) : M("", !0)
|
|
470
|
-
]),
|
|
471
|
-
_: 2
|
|
472
|
-
}, [
|
|
473
|
-
p.value === "popup" ? {
|
|
474
|
-
name: "widget",
|
|
475
|
-
fn: B(() => [
|
|
476
|
-
ie("div", Ne, [
|
|
477
|
-
le(re(c(Te), {
|
|
478
|
-
title: "Поиск",
|
|
479
|
-
icon: "",
|
|
480
|
-
modelValue: c(s).searchText.value,
|
|
481
|
-
"onUpdate:modelValue": v[2] || (v[2] = (r) => c(s).searchText.value = r),
|
|
482
|
-
isLoading: !!c(i).countLoading.value && c(i).isLoading.value,
|
|
483
|
-
placeholder: m.value
|
|
484
|
-
}, null, 8, ["modelValue", "isLoading", "placeholder"]), [
|
|
485
|
-
[
|
|
486
|
-
z,
|
|
487
|
-
u.value,
|
|
488
|
-
void 0,
|
|
489
|
-
{ onupdate: !0 }
|
|
490
|
-
]
|
|
491
|
-
]),
|
|
492
|
-
e.hasCloserBtn && !f.$core.state.isMobile ? (y(), b(D, {
|
|
493
|
-
key: 0,
|
|
494
|
-
class: "closer",
|
|
495
|
-
color: "theme"
|
|
496
|
-
}, {
|
|
497
|
-
default: B(() => [
|
|
498
|
-
V(P(f.$i18n.Common.Cancel), 1)
|
|
499
|
-
]),
|
|
500
|
-
_: 1
|
|
501
|
-
})) : M("", !0)
|
|
502
|
-
])
|
|
503
|
-
]),
|
|
504
|
-
key: "0"
|
|
505
|
-
} : void 0
|
|
506
|
-
]), 1032, ["openByFocusInput", "disabled"]);
|
|
507
|
-
};
|
|
508
|
-
}
|
|
509
|
-
});
|
|
510
|
-
export {
|
|
511
|
-
O as I,
|
|
512
|
-
Ye as _,
|
|
513
|
-
Ue as a,
|
|
514
|
-
He as b,
|
|
515
|
-
ue as c
|
|
516
|
-
};
|
|
517
|
-
//# sourceMappingURL=policy.vue_vue_type_style_index_0_lang-BavS2pf9.es.js.map
|