@topvisor/ui 1.4.3-fixGroupSelector.1 → 1.4.3-fixGroupSelector.5

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 (29) hide show
  1. package/.chunks/{lazy-40pjr8cZ.es.js → lazy-BJRCrEiD.es.js} +5 -1
  2. package/.chunks/lazy-BJRCrEiD.es.js.map +1 -0
  3. package/.chunks/lazy-DZK9LT7a.amd.js +2 -0
  4. package/.chunks/lazy-DZK9LT7a.amd.js.map +1 -0
  5. package/.chunks/policy.vue_vue_type_style_index_0_lang-BFldQm5e.es.js +519 -0
  6. package/.chunks/policy.vue_vue_type_style_index_0_lang-BFldQm5e.es.js.map +1 -0
  7. package/.chunks/policy.vue_vue_type_style_index_0_lang-CR-aHxza.amd.js +2 -0
  8. package/.chunks/policy.vue_vue_type_style_index_0_lang-CR-aHxza.amd.js.map +1 -0
  9. package/api/index.amd.js +1 -1
  10. package/api/index.js +6 -6
  11. package/formsExt/formsExt.amd.js +1 -1
  12. package/formsExt/formsExt.js +1 -1
  13. package/package.json +2 -2
  14. package/project/project.amd.js +1 -1
  15. package/project/project.amd.js.map +1 -1
  16. package/project/project.js +4 -2
  17. package/project/project.js.map +1 -1
  18. package/src/components/formsExt/selector2/composables/useMenu.d.ts +1 -1
  19. package/src/components/formsExt/selector2/types.d.ts +6 -0
  20. package/src/components/project/groupSelector/groups/groups.vue.d.ts +3 -4
  21. package/src/components/project/project.d.ts +1 -0
  22. package/src/components/project/projectSelector/projectSelector.vue.d.ts +3 -4
  23. package/.chunks/lazy-40pjr8cZ.es.js.map +0 -1
  24. package/.chunks/lazy-DSFLxvj4.amd.js +0 -2
  25. package/.chunks/lazy-DSFLxvj4.amd.js.map +0 -1
  26. package/.chunks/policy.vue_vue_type_style_index_0_lang-BavS2pf9.es.js +0 -517
  27. package/.chunks/policy.vue_vue_type_style_index_0_lang-BavS2pf9.es.js.map +0 -1
  28. package/.chunks/policy.vue_vue_type_style_index_0_lang-gH1s78kS.amd.js +0 -2
  29. package/.chunks/policy.vue_vue_type_style_index_0_lang-gH1s78kS.amd.js.map +0 -1
@@ -27,6 +27,10 @@ const l = async (a, t, r) => {
27
27
  t.append(o, e);
28
28
  break;
29
29
  case Array.isArray(e):
30
+ if (e.length === 0) {
31
+ t.append(o + "[]", "");
32
+ break;
33
+ }
30
34
  e.forEach((i, s) => {
31
35
  c({ [o + "[" + s + "]"]: i }, t);
32
36
  });
@@ -68,4 +72,4 @@ export {
68
72
  l as postInWindow,
69
73
  p as querySerializer
70
74
  };
71
- //# sourceMappingURL=lazy-40pjr8cZ.es.js.map
75
+ //# sourceMappingURL=lazy-BJRCrEiD.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lazy-BJRCrEiD.es.js","sources":["../../src/api/api/utils/lazy.ts"],"sourcesContent":["/**\n * Общие утилиты, которые должны грузиться в отложенном режиме\n *\n * Все такие утилиты являются асинхронными\n */\n\n/**\n * Выполнить post запрос в окне браузера\n *\n * @see Api.ClientRequest.callInNewWindow\n * @see Api.ClientRequest.callInSelfWindow\n */\nexport const postInWindow = async (url: string, data: Record<string, any>, target: '_blank' | '_self'): Promise<void> => {\n\tconst form = document.createElement('form');\n\tform.target = target;\n\tform.action = url;\n\tform.method = 'post';\n\n\tdataToForm(form, data);\n\n\tdocument.body.appendChild(form);\n\tform.submit();\n\tform.remove();\n};\n\n/**\n * Вставляет данные в HTML форму\n */\nexport const dataToForm = (elForm: HTMLFormElement, data: Record<string, any>): void => {\n\tconst formData = formDataSerializer(data);\n\n\tfor (const [key, value] of formData.entries()) {\n\t\tif (value instanceof File) {\n\t\t\tthrow new Error('Files can not be manual set in `HTMLFormElement`');\n\t\t}\n\n\t\tconst input = document.createElement('input');\n\t\t// input.type = 'hidden';\n\t\tinput.name = key;\n\t\tinput.value = String(value);\n\t\telForm.appendChild(input);\n\t}\n};\n\n/**\n * Сериализация данных в объект FormData\n *\n * Для отправки файлов или генерации форм\n */\nexport const formDataSerializer = (data: Record<string, any>, formData: FormData = new FormData(), parentKey?: string): FormData => {\n\tfor (const [key, value] of Object.entries(data)) {\n\t\tif (value === undefined || value === null) continue;\n\n\t\tconst fieldKey = parentKey ? `${parentKey}[${key}]` : key;\n\n\t\tswitch (true) {\n\t\t\tcase value instanceof File:\n\t\t\t\tformData.append(fieldKey, value, value.name);\n\n\t\t\t\tbreak;\n\t\t\tcase value instanceof FileList:\n\t\t\t\tfor (let i = 0; i < value.length; i++) {\n\t\t\t\t\tconst file = value.item(i);\n\t\t\t\t\tif (file) {\n\t\t\t\t\t\tformData.append(fieldKey + '[]', file, file.name);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\tcase value instanceof Blob:\n\t\t\t\tformData.append(fieldKey, value);\n\n\t\t\t\tbreak;\n\t\t\tcase Array.isArray(value):\n\t\t\t\tif (value.length === 0) {\n\t\t\t\t\tformData.append(fieldKey + '[]', '');\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tvalue.forEach((item, key) => {\n\t\t\t\t\tformDataSerializer({ [fieldKey + '[' + key + ']']: item }, formData);\n\t\t\t\t});\n\n\t\t\t\tbreak;\n\t\t\tcase value instanceof Date:\n\t\t\t\t// для совместимости с JSON.stringify();\n\t\t\t\tformData.append(fieldKey, value.toISOString());\n\n\t\t\t\tbreak;\n\t\t\tcase typeof value === 'object':\n\t\t\t\tformDataSerializer(value, formData, fieldKey);\n\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tformData.append(fieldKey, String(value));\n\t\t}\n\t}\n\n\treturn formData;\n};\n\n/**\n * Сериализация данных для вставки в виде параметров в url\n */\nexport const querySerializer = (data: Record<string, unknown>): string => {\n\tconst searchParams = new URLSearchParams();\n\n\tconst appendParam = (path: string, currentValue: unknown): void => {\n\t\tif (currentValue == null) return;\n\n\t\tif (Array.isArray(currentValue)) {\n\t\t\tfor (const [key, value] of Object.entries(currentValue)) {\n\t\t\t\tappendParam(`${path}[${key}]`, value);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif (typeof currentValue === 'object') {\n\t\t\tfor (const [key, value] of Object.entries(currentValue as Record<string, unknown>)) {\n\t\t\t\tappendParam(`${path}[${key}]`, value);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tsearchParams.append(path, String(currentValue));\n\t};\n\n\tfor (const [key, value] of Object.entries(data)) {\n\t\tappendParam(key, value);\n\t}\n\n\treturn searchParams.toString();\n};\n"],"names":["postInWindow","url","data","target","form","dataToForm","elForm","formData","formDataSerializer","key","value","input","parentKey","fieldKey","file","item","querySerializer","searchParams","appendParam","path","currentValue"],"mappings":"AAYO,MAAMA,IAAe,OAAOC,GAAaC,GAA2BC,MAA8C;AACxH,QAAMC,IAAO,SAAS,cAAc,MAAM;AAC1C,EAAAA,EAAK,SAASD,GACdC,EAAK,SAASH,GACdG,EAAK,SAAS,QAEdC,EAAWD,GAAMF,CAAI,GAErB,SAAS,KAAK,YAAYE,CAAI,GAC9BA,EAAK,OAAA,GACLA,EAAK,OAAA;AACN,GAKaC,IAAa,CAACC,GAAyBJ,MAAoC;AACvF,QAAMK,IAAWC,EAAmBN,CAAI;AAExC,aAAW,CAACO,GAAKC,CAAK,KAAKH,EAAS,WAAW;AAC9C,QAAIG,aAAiB;AACpB,YAAM,IAAI,MAAM,kDAAkD;AAGnE,UAAMC,IAAQ,SAAS,cAAc,OAAO;AAE5C,IAAAA,EAAM,OAAOF,GACbE,EAAM,QAAQ,OAAOD,CAAK,GAC1BJ,EAAO,YAAYK,CAAK;AAAA,EACzB;AACD,GAOaH,IAAqB,CAACN,GAA2BK,IAAqB,IAAI,SAAA,GAAYK,MAAiC;AACnI,aAAW,CAACH,GAAKC,CAAK,KAAK,OAAO,QAAQR,CAAI,GAAG;AAChD,QAA2BQ,KAAU,KAAM;AAE3C,UAAMG,IAAWD,IAAY,GAAGA,CAAS,IAAIH,CAAG,MAAMA;AAEtD,YAAQ,IAAA;AAAA,M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U;AACrC,mBAAW,CAACX,GAAKC,CAAK,KAAK,OAAO,QAAQU,CAAuC;AAChF,UAAAF,EAAY,GAAGC,CAAI,IAAIV,CAAG,KAAKC,CAAK;AAErC;AAAA,MACD;AAEA,MAAAO,EAAa,OAAOE,GAAM,OAAOC,CAAY,CAAC;AAAA;AAAA,EAC/C;AAEA,aAAW,CAACX,GAAKC,CAAK,KAAK,OAAO,QAAQR,CAAI;AAC7C,IAAAgB,EAAYT,GAAKC,CAAK;AAGvB,SAAOO,EAAa,SAAA;AACrB;"}
@@ -0,0 +1,2 @@
1
+ define(["require","exports"],(function(b,s){"use strict";if(typeof l>"u")var l=window.Vue;const u=async(a,t,i)=>{const n=document.createElement("form");n.target=i,n.action=a,n.method="post",d(n,t),document.body.appendChild(n),n.submit(),n.remove()},d=(a,t)=>{const i=f(t);for(const[n,e]of i.entries()){if(e instanceof File)throw new Error("Files can not be manual set in `HTMLFormElement`");const o=document.createElement("input");o.name=n,o.value=String(e),a.appendChild(o)}},f=(a,t=new FormData,i)=>{for(const[n,e]of Object.entries(a)){if(e==null)continue;const o=i?`${i}[${n}]`:n;switch(!0){case e instanceof File:t.append(o,e,e.name);break;case e instanceof FileList:for(let r=0;r<e.length;r++){const c=e.item(r);c&&t.append(o+"[]",c,c.name)}break;case e instanceof Blob:t.append(o,e);break;case Array.isArray(e):if(e.length===0){t.append(o+"[]","");break}e.forEach((r,c)=>{f({[o+"["+c+"]"]:r},t)});break;case e instanceof Date:t.append(o,e.toISOString());break;case typeof e=="object":f(e,t,o);break;default:t.append(o,String(e))}}return t},p=a=>{const t=new URLSearchParams,i=(n,e)=>{if(e!=null){if(Array.isArray(e)){for(const[o,r]of Object.entries(e))i(`${n}[${o}]`,r);return}if(typeof e=="object"){for(const[o,r]of Object.entries(e))i(`${n}[${o}]`,r);return}t.append(n,String(e))}};for(const[n,e]of Object.entries(a))i(n,e);return t.toString()};s.dataToForm=d,s.formDataSerializer=f,s.postInWindow=u,s.querySerializer=p,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})}));
2
+ //# sourceMappingURL=lazy-DZK9LT7a.amd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lazy-DZK9LT7a.amd.js","sources":["../../src/api/api/utils/lazy.ts"],"sourcesContent":["/**\n * Общие утилиты, которые должны грузиться в отложенном режиме\n *\n * Все такие утилиты являются асинхронными\n */\n\n/**\n * Выполнить post запрос в окне браузера\n *\n * @see Api.ClientRequest.callInNewWindow\n * @see Api.ClientRequest.callInSelfWindow\n */\nexport const postInWindow = async (url: string, data: Record<string, any>, target: '_blank' | '_self'): Promise<void> => {\n\tconst form = document.createElement('form');\n\tform.target = target;\n\tform.action = url;\n\tform.method = 'post';\n\n\tdataToForm(form, data);\n\n\tdocument.body.appendChild(form);\n\tform.submit();\n\tform.remove();\n};\n\n/**\n * Вставляет данные в HTML форму\n */\nexport const dataToForm = (elForm: HTMLFormElement, data: Record<string, any>): void => {\n\tconst formData = formDataSerializer(data);\n\n\tfor (const [key, value] of formData.entries()) {\n\t\tif (value instanceof File) {\n\t\t\tthrow new Error('Files can not be manual set in `HTMLFormElement`');\n\t\t}\n\n\t\tconst input = document.createElement('input');\n\t\t// input.type = 'hidden';\n\t\tinput.name = key;\n\t\tinput.value = String(value);\n\t\telForm.appendChild(input);\n\t}\n};\n\n/**\n * Сериализация данных в объект FormData\n *\n * Для отправки файлов или генерации форм\n */\nexport const formDataSerializer = (data: Record<string, any>, formData: FormData = new FormData(), parentKey?: string): FormData => {\n\tfor (const [key, value] of Object.entries(data)) {\n\t\tif (value === undefined || value === null) continue;\n\n\t\tconst fieldKey = parentKey ? `${parentKey}[${key}]` : key;\n\n\t\tswitch (true) {\n\t\t\tcase value instanceof File:\n\t\t\t\tformData.append(fieldKey, value, value.name);\n\n\t\t\t\tbreak;\n\t\t\tcase value instanceof FileList:\n\t\t\t\tfor (let i = 0; i < value.length; i++) {\n\t\t\t\t\tconst file = value.item(i);\n\t\t\t\t\tif (file) {\n\t\t\t\t\t\tformData.append(fieldKey + '[]', file, file.name);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\tcase value instanceof Blob:\n\t\t\t\tformData.append(fieldKey, value);\n\n\t\t\t\tbreak;\n\t\t\tcase Array.isArray(value):\n\t\t\t\tif (value.length === 0) {\n\t\t\t\t\tformData.append(fieldKey + '[]', '');\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tvalue.forEach((item, key) => {\n\t\t\t\t\tformDataSerializer({ [fieldKey + '[' + key + ']']: item }, formData);\n\t\t\t\t});\n\n\t\t\t\tbreak;\n\t\t\tcase value instanceof Date:\n\t\t\t\t// для совместимости с JSON.stringify();\n\t\t\t\tformData.append(fieldKey, value.toISOString());\n\n\t\t\t\tbreak;\n\t\t\tcase typeof value === 'object':\n\t\t\t\tformDataSerializer(value, formData, fieldKey);\n\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tformData.append(fieldKey, String(value));\n\t\t}\n\t}\n\n\treturn formData;\n};\n\n/**\n * Сериализация данных для вставки в виде параметров в url\n */\nexport const querySerializer = (data: Record<string, unknown>): string => {\n\tconst searchParams = new URLSearchParams();\n\n\tconst appendParam = (path: string, currentValue: unknown): void => {\n\t\tif (currentValue == null) return;\n\n\t\tif (Array.isArray(currentValue)) {\n\t\t\tfor (const [key, value] of Object.entries(currentValue)) {\n\t\t\t\tappendParam(`${path}[${key}]`, value);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif (typeof currentValue === 'object') {\n\t\t\tfor (const [key, value] of Object.entries(currentValue as Record<string, unknown>)) {\n\t\t\t\tappendParam(`${path}[${key}]`, value);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tsearchParams.append(path, String(currentValue));\n\t};\n\n\tfor (const [key, value] of Object.entries(data)) {\n\t\tappendParam(key, value);\n\t}\n\n\treturn searchParams.toString();\n};\n"],"names":["postInWindow","url","data","target","form","dataToForm","elForm","formData","formDataSerializer","key","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b,EAAAC,CAAA,IAAA,OAAA,QAAAY,CAAA,EACCF,EAAA,GAAAC,CAAA,IAAAZ,CAAA,IAAAC,CAAA,SAKF,GAAA,OAAAY,GAAA,SAAA,CACC,SAAA,CAAAb,EAAAC,CAAA,IAAA,OAAA,QAAAY,CAAA,EACCF,EAAA,GAAAC,CAAA,IAAAZ,CAAA,IAAAC,CAAA,+BAK4C,EAG/C,SAAA,CAAAD,EAAAC,CAAA,IAAA,OAAA,QAAAR,CAAA,EACCkB,EAAAX,EAAAC,CAAA,EAGD,OAAAS,EAAA,SAAA,CACD"}
@@ -0,0 +1,519 @@
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 Q, mergeModels as H, useModel as re, ref as D, onMounted as fe, onUpdated as pe, createElementBlock as C, openBlock as m, normalizeClass as ve, createCommentVNode as M, Fragment as N, renderList as Y, createBlock as B, mergeProps as q, createSlots as j, withCtx as w, createTextVNode as V, toDisplayString as P, createVNode as ie, createElementVNode as ue, withModifiers as me, computed as K, watch as J, toRef as F, resolveComponent as te, resolveDirective as le, unref as c, renderSlot as he, withDirectives as ae, resolveDynamicComponent as ye } from "vue";
7
+ import { e as se, b as ge, C as G, d as Ae, u as Ie, s as Ce } from "./forms-BpbQYyEQ.es.js";
8
+ import { _ as Te, b as ne } from "./popupHint.vue_vue_type_style_index_0_lang-if4Qli-k.es.js";
9
+ import { _ as ke } from "./widgetInput.vue_vue_type_script_setup_true_lang-Dy8jWadl.es.js";
10
+ import { invertKeyboardLayout as Se } from "../utils/keyboard.js";
11
+ import { g as Le } from "./field-CyyFzM-Y.es.js";
12
+ const be = {
13
+ key: 0,
14
+ class: "top-menu_selectAll"
15
+ }, He = /* @__PURE__ */ Q({
16
+ __name: "menu",
17
+ props: /* @__PURE__ */ H({
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 s = e, a = re(e, "modelValue"), t = D();
33
+ !s.isMultiple && typeof a.value != "string" && typeof a.value != "number" && console.warn('Type check failed for prop "modelValue". Expected String: ' + typeof a.value), s.isMultiple && !Array.isArray(a.value) && console.warn('Type check failed for prop "modelValue". Expected Array: ' + typeof a.value), s.isMultiple && !s.canBeEmptyMultiple && Array.isArray(a.value) && !a.value.length && s.items[0] && (a.value = [s.items[0]?.href ?? s.items[0]?.value]);
34
+ const i = (u) => Array.isArray(a.value) ? a.value.includes(u.value) : u.value === a.value, T = (u, h = !1) => {
35
+ if (Array.isArray(a.value)) {
36
+ let r = a.value.slice();
37
+ if (h) {
38
+ r.length || (r = s.items.map((d) => d.value));
39
+ const g = r.indexOf(u.value);
40
+ g === -1 ? r.push(u.value) : r.splice(g, 1);
41
+ } else
42
+ r.length === 1 && r[0] === u.value ? r = [] : r = [u.value];
43
+ !s.canBeEmptyMultiple && !r.length && (r = [u.value]), a.value = r;
44
+ return;
45
+ }
46
+ a.value = u.value;
47
+ }, v = (u) => {
48
+ if (t.value.scrollWidth <= t.value.offsetWidth || u.shiftKey || Math.abs(u.deltaY) < 50) return;
49
+ u.preventDefault();
50
+ const h = u.deltaY > 0 ? 30 : -30;
51
+ t.value.scrollLeft = t.value.scrollLeft + h;
52
+ }, o = (u = !0) => {
53
+ const h = t.value.querySelector(".top-active");
54
+ if (!h) return;
55
+ const r = 24, g = h.offsetLeft - t.value.offsetLeft - r, d = h.offsetLeft - t.value.offsetLeft + h.clientWidth + r, y = t.value.scrollLeft, L = t.value.clientWidth + t.value.scrollLeft;
56
+ let I;
57
+ g < y && (I = g), d > L && (I = d - t.value.clientWidth), I !== void 0 && (ge() ? G.$?.(t.value).animate({ scrollLeft: I }, u ? 200 : 0) : t.value.scrollTo({ left: I, behavior: u ? "smooth" : "auto" }));
58
+ }, n = () => {
59
+ if (Array.isArray(a.value)) {
60
+ if (a.value.length === s.items.length) {
61
+ a.value = [s.items[0].href ?? s.items[0].value];
62
+ return;
63
+ }
64
+ a.value = s.items.map((u) => u.href ?? u.value);
65
+ }
66
+ };
67
+ return fe(() => o(!1)), pe(() => o(!0)), (u, h) => (m(), C("div", {
68
+ ref_key: "el",
69
+ ref: t,
70
+ class: ve({
71
+ "top-menu": !0,
72
+ ["top-style_" + e.styling]: !0
73
+ // ['top-unwrap-x']: styling === 'default',
74
+ }),
75
+ onWheel: v
76
+ }, [
77
+ (m(!0), C(N, null, Y(e.items, (r) => (m(), B(se, q({ ref_for: !0 }, r, {
78
+ class: "top-menu_item",
79
+ color: "theme",
80
+ onClick: (g) => T(r, g.ctrlKey || g.metaKey),
81
+ isActive: i(r)
82
+ }), j({ _: 2 }, [
83
+ r.content ? {
84
+ name: "default",
85
+ fn: w(() => [
86
+ V(P(r.content), 1)
87
+ ]),
88
+ key: "0"
89
+ } : void 0
90
+ ]), 1040, ["onClick", "isActive"]))), 256)),
91
+ Array.isArray(a.value) && e.selectAllItem ? (m(), C("div", be, [
92
+ ie(se, q(e.selectAllItem, {
93
+ class: "top-menu_item",
94
+ color: "theme",
95
+ styling: "",
96
+ onClick: h[0] || (h[0] = (r) => n()),
97
+ isActive: a.value.length === e.items.length
98
+ }), j({ _: 2 }, [
99
+ e.selectAllItem.content ? {
100
+ name: "default",
101
+ fn: w(() => [
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" }, we = /* @__PURE__ */ Q({
111
+ __name: "itemMulti",
112
+ props: {
113
+ id: {},
114
+ name: {}
115
+ },
116
+ emits: ["delete"],
117
+ setup(e) {
118
+ return (s, a) => (m(), C("div", Be, [
119
+ V(P(e.name) + " ", 1),
120
+ ue("span", {
121
+ class: "top-selector2_itemMultiDelete",
122
+ "data-top-icon": "",
123
+ onClick: a[0] || (a[0] = (t) => s.$emit("delete", { id: e.id, name: e.name })),
124
+ onMousedown: a[1] || (a[1] = me(() => {
125
+ }, ["stop"]))
126
+ }, null, 32)
127
+ ]));
128
+ }
129
+ }), R = /* @__PURE__ */ new Map(), xe = (e) => {
130
+ R.get(e)?.clear();
131
+ }, Me = (e) => {
132
+ const s = window.mo?.user?.id;
133
+ return JSON.stringify(e.params) + ":" + e.url + ":" + s;
134
+ }, Pe = (e, s) => R.get(s)?.get(e), $e = (e, s, a) => {
135
+ R.has(s) || R.set(s, /* @__PURE__ */ new Map()), R.get(s)?.set(e, a);
136
+ }, Fe = (e, s, a, t) => {
137
+ const i = D([]), T = D(!1), v = D(0);
138
+ let o = "", n;
139
+ e && !e.params.limit && (e.params.limit = 100);
140
+ const u = async () => {
141
+ if (!e) return;
142
+ const d = t ? Me(e) : void 0;
143
+ if (d) {
144
+ const I = Pe(d, e.path);
145
+ if (I)
146
+ return e.abortByFingerprint(), I;
147
+ }
148
+ const y = await e.call();
149
+ if (y.errors) return;
150
+ if (!Array.isArray(y.result)) {
151
+ console.warn("Array expected in `res.result`");
152
+ return;
153
+ }
154
+ const L = y.result.findIndex((I) => I.id === void 0 || I.name === void 0);
155
+ if (L !== -1) {
156
+ console.warn(`В result[${L}] нет id или name`);
157
+ return;
158
+ }
159
+ return d && $e(d, e.path, y), y;
160
+ }, h = async (d) => {
161
+ if (!e) return;
162
+ if (d) {
163
+ if (!n || T.value) return;
164
+ e.params.offset = n;
165
+ } else
166
+ e.params.offset = 0;
167
+ s?.(e, o), T.value = !0;
168
+ const y = await u();
169
+ T.value = !1, v.value++, y && (n = y.nextOffset, d ? i.value = i.value.concat(y.result) : i.value = y.result);
170
+ }, r = Ae(() => h(!1), 200);
171
+ return {
172
+ apiRequest: e,
173
+ items: i,
174
+ isLoading: T,
175
+ countLoading: v,
176
+ load: h,
177
+ setSearchTextAndLoad: (d, y = !0) => {
178
+ if (e) {
179
+ if (d.length < a) {
180
+ e.abortByFingerprint(), i.value = [];
181
+ return;
182
+ }
183
+ d === o && i.value.length || (o = d, y ? r() : h(!1));
184
+ }
185
+ }
186
+ };
187
+ }, ce = 0, W = null, oe = (e, s, a = !0) => a && s.id === W ? Array.isArray(e) ? e.some((t) => t.id === s.id && t.name === s.name) : s.name === e.name : Array.isArray(e) ? e.some((t) => t.id === s.id) : s.id === e.id, Ye = (e, s, a) => {
188
+ let t = e.params.filters ?? [];
189
+ t = t.filter((i) => i.name !== a), s && t.push(Le(a, "CONTAINS", [s])), e.changeParams({ filters: t });
190
+ }, De = (e, s, a, t, i, T, v, o, n, u, h, r, g) => {
191
+ const d = D(""), y = {
192
+ id: ce,
193
+ name: Ie().Common.All
194
+ }, L = () => {
195
+ d.value = "";
196
+ }, I = () => !(!g.apiRequest || d.value.length >= r), O = K(() => {
197
+ const l = [];
198
+ return !t && i.value && (typeof i.value == "string" && (y.name = i.value), l.push(y)), a.value?.forEach((b) => l.push({ ...b })), l;
199
+ }), f = D([]), p = () => {
200
+ f.value = E();
201
+ }, E = () => {
202
+ const l = d.value.toLowerCase(), b = Se(l);
203
+ let S = [], $;
204
+ const k = [], Z = () => {
205
+ k.at(-1)?.listItemProps?.type === "delimiter" && k.pop(), k.length && ($ && S.push($), S.push(...k), k.length = 0);
206
+ };
207
+ for (const A of O.value)
208
+ switch (A.listItemProps?.type) {
209
+ case "title":
210
+ Z(), $ = A;
211
+ break;
212
+ case "delimiter":
213
+ if (k.length) {
214
+ let x = k.length;
215
+ k.at(-1)?.listItemProps?.type === "delimiter" && x--, k[x] = A;
216
+ }
217
+ break;
218
+ default:
219
+ const de = u.value?.includes("id"), _ = A.name.toLowerCase(), ee = u.value?.filter((x) => x !== "id").map((x) => typeof A[x] == "string" || typeof A[x] == "number" ? A[x] : "").join("☼").toLowerCase();
220
+ (de && A.id === Number(l) || ee?.includes(l) || ee?.includes(b)) && (_ === l || _ === b ? k.unshift(A) : k.push(A));
221
+ }
222
+ if (Z(), S.push(...g.items.value), T.value && d.value && (!o.value || o.value(l)) && // предложить добавить элемент, если нет точного совпадения или разрешены дубликаты
223
+ (v.value || !S.find((A) => A.name.toLowerCase() === l))) {
224
+ const A = {
225
+ id: W,
226
+ name: d.value
227
+ };
228
+ n.value && (A.listItemProps = { closeByClick: !1 }), S.push(A);
229
+ }
230
+ return t && (S = S.filter((A) => !oe(e.value, A))), S;
231
+ }, z = (l) => {
232
+ l.listItemProps?.type === "title" || l.listItemProps?.type === "delimiter" || l.id === W && (s("appendItem", l), n.value) || (t && Array.isArray(e.value) ? oe(e.value, l) || (e.value = [...e.value, l]) : e.value = l, setTimeout(() => {
233
+ L();
234
+ }));
235
+ };
236
+ if (g.apiRequest) {
237
+ const l = [a, g.items];
238
+ t && l.push(e), J(l, () => {
239
+ p();
240
+ });
241
+ } else
242
+ J([e, a, d], () => {
243
+ p();
244
+ }, {
245
+ immediate: !0,
246
+ // слежение за изменениями `items`
247
+ deep: 2
248
+ });
249
+ return {
250
+ searchText: d,
251
+ resetSearch: L,
252
+ genIsShort: I,
253
+ itemsForShow: f,
254
+ selectItem: z,
255
+ selectNextItem: () => {
256
+ if (Array.isArray(e.value)) return;
257
+ const l = f.value.filter(($) => !["title", "delimiter"].includes($.listItemProps?.type ?? "")), S = (l.findIndex(($) => $.id === e.value.id) + 1) % l.length;
258
+ e.value = { ...l[S] };
259
+ },
260
+ deleteItemByItem: async (l) => {
261
+ Array.isArray(e.value) && (e.value = e.value.filter((b) => b.id !== l.id || b.name !== l.name));
262
+ }
263
+ };
264
+ }, Ee = {
265
+ key: 0,
266
+ class: "top-selector2_activeItems"
267
+ }, Ve = {
268
+ key: 1,
269
+ class: "top-selector2_activeName top-ellipsis"
270
+ }, Ne = {
271
+ key: 2,
272
+ class: "top-selector2_placeholder top-ellipsis"
273
+ }, Re = { class: "top-selector2_searchWidget" }, je = /* @__PURE__ */ Q({
274
+ __name: "selector2",
275
+ props: /* @__PURE__ */ H({
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
+ appendSearchAllowDuplicate: { type: Boolean },
295
+ appendSearchToResultCond: {},
296
+ appendWithoutSelect: { type: Boolean },
297
+ multiselect: { type: Boolean },
298
+ useAllItem: { type: [Boolean, String] },
299
+ addChanger: { type: Boolean },
300
+ buttonProps: {},
301
+ selectedAsPlaceholder: { type: Boolean },
302
+ openerShortcut: {}
303
+ }, {
304
+ modelValue: { required: !0 },
305
+ modelModifiers: {}
306
+ }),
307
+ emits: /* @__PURE__ */ H(["appendItem", "open"], ["update:modelValue"]),
308
+ setup(e, { expose: s, emit: a }) {
309
+ const t = e, i = re(e, "modelValue"), T = a;
310
+ s({
311
+ /**
312
+ * Сброс локального кеша и кеша api
313
+ *
314
+ * @param resetAPICache - Сбросить API кеш, по умолчанию не сбрасывается. Для случаев, когда загруженные данные становятся неактуальными
315
+ */
316
+ resetCache: (f = !1) => {
317
+ o.apiRequest && (f && xe(o.apiRequest.path), o.items.value = [], o.countLoading.value = 0, o.apiRequest.params.offset = 0, requestAnimationFrame(() => {
318
+ n.itemsForShow.value = [];
319
+ }), r()?.elPopup && o.setSearchTextAndLoad(n.searchText.value));
320
+ }
321
+ });
322
+ const v = K(() => t.searchType === "inline" && t.multiselect || t.searchType === "inline" && G.state.isMobile ? "popup" : t.searchType), o = Fe(t.api, t.apiSetSearchParams, t.minLength, t.useCache), n = De(
323
+ i,
324
+ T,
325
+ F(t, "items"),
326
+ t.multiselect,
327
+ F(t, "useAllItem"),
328
+ F(t, "appendSearchToResult"),
329
+ F(t, "appendSearchAllowDuplicate"),
330
+ F(t, "appendSearchToResultCond"),
331
+ F(t, "appendWithoutSelect"),
332
+ F(t, "searchFields"),
333
+ v,
334
+ t.minLength,
335
+ o
336
+ ), u = K(() => t.buttonProps ? "TopButton" : v.value === "inline" ? "TopInput" : "div"), h = D(null), r = () => h.value?.popup;
337
+ o.apiRequest && J(n.searchText, () => {
338
+ o.setSearchTextAndLoad(n.searchText.value);
339
+ });
340
+ const g = K(() => Array.isArray(i.value) || t.multiselect || !t.selectedAsPlaceholder && v.value !== "inline" ? t.placeholder : i.value?.name || t.placeholder), d = (f) => {
341
+ let p = !1;
342
+ switch (f.key) {
343
+ case "Delete":
344
+ case "Backspace":
345
+ Array.isArray(i.value) && (f.preventDefault(), f.stopPropagation(), i.value.pop());
346
+ break;
347
+ case "ArrowUp":
348
+ case "ArrowRight":
349
+ case "ArrowDown":
350
+ case "ArrowLeft":
351
+ case "Enter":
352
+ case " ":
353
+ p = !0;
354
+ break;
355
+ case "Escape":
356
+ v.value === "inline" && n.resetSearch();
357
+ break;
358
+ }
359
+ const E = f.key.length === 1 && !f.ctrlKey && !f.metaKey;
360
+ (v.value === "popup" || v.value === "inline") && E && (p = !0), r()?.elPopup && (p = !1), p && (v.value === "popup" && (f.preventDefault(), f.stopPropagation(), E && (n.searchText.value || (n.searchText.value = f.key))), f.currentTarget?.click());
361
+ }, y = (f) => {
362
+ f.preventDefault(), n.selectNextItem();
363
+ }, L = () => {
364
+ o.apiRequest && o.setSearchTextAndLoad(n.searchText.value, !1), T("open");
365
+ }, I = () => {
366
+ v.value === "popup" && n.searchText.value && n.resetSearch();
367
+ }, O = (f) => {
368
+ const p = f.target;
369
+ p.scrollTop / (p.scrollHeight - p.offsetHeight) > 0.8 && o.load(!0);
370
+ };
371
+ return (f, p) => {
372
+ const E = te("TopButton"), z = te("TopLoadbar"), U = le("top-focus"), X = le("top-shortcut");
373
+ return m(), B(c(Te), {
374
+ ref_key: "popupRef",
375
+ ref: h,
376
+ onOpen: p[3] || (p[3] = (l) => L()),
377
+ onClose: p[4] || (p[4] = (l) => I()),
378
+ onScrollContentList: p[5] || (p[5] = (l) => c(o) ? O(l) : void 0),
379
+ notch: !1,
380
+ transitionDuration: 0,
381
+ openByFocusInput: v.value === "inline" && (e.openByFocusInput ?? !0),
382
+ disabled: v.value === "inline" && c(n).genIsShort()
383
+ }, j({
384
+ opener: w(() => [
385
+ ae((m(), B(ye(u.value), q(e.buttonProps, {
386
+ class: {
387
+ "top-selector2": !0,
388
+ "top-selector2-multiselect": e.multiselect,
389
+ ["top-selector2-" + e.modificator]: !!e.modificator,
390
+ "top-as-input": !e.buttonProps && v.value !== "inline",
391
+ "top-as-selector": !0,
392
+ ["top-size_" + e.size]: !0,
393
+ "top-disabled": e.disabled,
394
+ "top-forms-focusable": !e.disabled,
395
+ "top-error": e.isError
396
+ },
397
+ icon: e.icon,
398
+ tabindex: "0",
399
+ onKeydown: d,
400
+ onBlur: p[0] || (p[0] = (l) => v.value === "inline" && c(n).resetSearch()),
401
+ placeholder: g.value,
402
+ title: e.title,
403
+ captionType: v.value === "inline" && e.title !== void 0 ? "top" : void 0,
404
+ modelValue: c(n).searchText.value,
405
+ "onUpdate:modelValue": p[1] || (p[1] = (l) => c(n).searchText.value = l)
406
+ }), {
407
+ default: w(() => [
408
+ e.multiselect ? (m(), C("div", Ee, [
409
+ (m(!0), C(N, null, Y(i.value, (l) => (m(), B(we, {
410
+ id: l.id,
411
+ name: l.name,
412
+ onDelete: c(n).deleteItemByItem
413
+ }, null, 8, ["id", "name", "onDelete"]))), 256))
414
+ ])) : M("", !0),
415
+ v.value !== "inline" && !e.multiselect ? (m(), C("span", Ve, P(Array.isArray(i.value) ? "" : i.value.name), 1)) : M("", !0),
416
+ e.multiselect && !i.value.length ? (m(), C("span", Ne, P(g.value), 1)) : M("", !0),
417
+ e.addChanger && !e.buttonProps && !e.multiselect && c(n).itemsForShow.value.length > 1 && !e.disabled ? (m(), C("span", {
418
+ key: 3,
419
+ class: "top-changer top-changer-selector",
420
+ "data-top-popup-disabled": "true",
421
+ onClick: y
422
+ })) : M("", !0)
423
+ ]),
424
+ _: 1
425
+ }, 16, ["class", "icon", "placeholder", "title", "captionType", "modelValue"])), [
426
+ [
427
+ U,
428
+ e.isError,
429
+ void 0,
430
+ { onupdate: !0 }
431
+ ],
432
+ [X, e.openerShortcut]
433
+ ])
434
+ ]),
435
+ contentList: w(() => [
436
+ (m(!0), C(N, null, Y(c(n).itemsForShow.value, (l) => (m(), B(c(ne), q({
437
+ key: l.id ?? void 0,
438
+ class: {
439
+ "top-active": !Array.isArray(i.value) && !e.multiselect && i.value.id === l.id && i.value.name === l.name,
440
+ "top-selector2_item-all": l.id === c(ce),
441
+ "top-selector2_item-new": l.id === c(W)
442
+ },
443
+ closeByClick: !e.multiselect || c(G).state.isMobile
444
+ }, { ref_for: !0 }, l.listItemProps, {
445
+ onClick: (b) => c(n).selectItem(l)
446
+ }), {
447
+ default: w(() => [
448
+ f.$slots.item ? he(f.$slots, "item", {
449
+ key: 0,
450
+ item: l
451
+ }) : (m(), C(N, { key: 1 }, [
452
+ V(P(l.name), 1)
453
+ ], 64))
454
+ ]),
455
+ _: 2
456
+ }, 1040, ["class", "closeByClick", "onClick"]))), 128)),
457
+ !c(n).itemsForShow.value.length && !c(n).genIsShort() ? (m(), B(c(ne), {
458
+ key: 0,
459
+ type: "regular"
460
+ }, {
461
+ default: w(() => [
462
+ !c(o).isLoading.value || c(o).countLoading.value ? (m(), C(N, { key: 0 }, [
463
+ V(P(f.$i18n.Common.No_results), 1)
464
+ ], 64)) : (m(), B(c(Ce), {
465
+ key: 1,
466
+ type: "circles"
467
+ }))
468
+ ]),
469
+ _: 1
470
+ })) : M("", !0),
471
+ c(o).countLoading.value && c(o).isLoading.value && v.value === "inline" ? (m(), B(z, { key: 1 })) : M("", !0)
472
+ ]),
473
+ _: 2
474
+ }, [
475
+ v.value === "popup" ? {
476
+ name: "widget",
477
+ fn: w(() => [
478
+ ue("div", Re, [
479
+ ae(ie(c(ke), {
480
+ title: "Поиск",
481
+ icon: "",
482
+ modelValue: c(n).searchText.value,
483
+ "onUpdate:modelValue": p[2] || (p[2] = (l) => c(n).searchText.value = l),
484
+ isLoading: !!c(o).countLoading.value && c(o).isLoading.value,
485
+ placeholder: g.value
486
+ }, null, 8, ["modelValue", "isLoading", "placeholder"]), [
487
+ [
488
+ U,
489
+ i.value,
490
+ void 0,
491
+ { onupdate: !0 }
492
+ ]
493
+ ]),
494
+ e.hasCloserBtn && !f.$core.state.isMobile ? (m(), B(E, {
495
+ key: 0,
496
+ class: "closer",
497
+ color: "theme"
498
+ }, {
499
+ default: w(() => [
500
+ V(P(f.$i18n.Common.Cancel), 1)
501
+ ]),
502
+ _: 1
503
+ })) : M("", !0)
504
+ ])
505
+ ]),
506
+ key: "0"
507
+ } : void 0
508
+ ]), 1032, ["openByFocusInput", "disabled"]);
509
+ };
510
+ }
511
+ });
512
+ export {
513
+ W as I,
514
+ je as _,
515
+ He as a,
516
+ Ye as b,
517
+ ce as c
518
+ };
519
+ //# sourceMappingURL=policy.vue_vue_type_style_index_0_lang-BFldQm5e.es.js.map