@topvisor/ui 1.4.3-fixSelector2.0 → 1.4.3-fixTabsView.0
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/{core-Baaq63Be.es.js → core-Dgj_YGWh.es.js} +94 -87
- package/.chunks/{core-Baaq63Be.es.js.map → core-Dgj_YGWh.es.js.map} +1 -1
- package/.chunks/{core-DCw0zLc3.amd.js → core-DzDFXOdI.amd.js} +2 -2
- package/.chunks/{core-DCw0zLc3.amd.js.map → core-DzDFXOdI.amd.js.map} +1 -1
- package/.chunks/{datepicker-DPgavbKe.es.js → datepicker-qToxk2nN.es.js} +2 -2
- package/.chunks/{datepicker-DPgavbKe.es.js.map → datepicker-qToxk2nN.es.js.map} +1 -1
- package/.chunks/{dialog_regionSelectorRegions-D7x41iZu.es.js → dialog_regionSelectorRegions-qDW2Ejsv.es.js} +5 -5
- package/.chunks/{dialog_regionSelectorRegions-D7x41iZu.es.js.map → dialog_regionSelectorRegions-qDW2Ejsv.es.js.map} +1 -1
- package/.chunks/{dialogs.vue_vue_type_script_setup_true_lang-D8WYUfXI.es.js → dialogs.vue_vue_type_script_setup_true_lang-CJ97l1ST.es.js} +3 -3
- package/.chunks/{dialogs.vue_vue_type_script_setup_true_lang-D8WYUfXI.es.js.map → dialogs.vue_vue_type_script_setup_true_lang-CJ97l1ST.es.js.map} +1 -1
- package/.chunks/{forms-BpbQYyEQ.es.js → forms-DtC-EKJL.es.js} +24 -24
- package/.chunks/{forms-BpbQYyEQ.es.js.map → forms-DtC-EKJL.es.js.map} +1 -1
- package/.chunks/lazy-DDNqYkXn.amd.js +2 -0
- package/.chunks/lazy-DDNqYkXn.amd.js.map +1 -0
- package/.chunks/{lazy-40pjr8cZ.es.js → lazy-HKSyLh72.es.js} +23 -19
- package/.chunks/lazy-HKSyLh72.es.js.map +1 -0
- package/.chunks/{notice-Ckc8r96E.es.js → notice-BvQl911b.es.js} +3 -3
- package/.chunks/{notice-Ckc8r96E.es.js.map → notice-BvQl911b.es.js.map} +1 -1
- package/.chunks/{page.vue_vue_type_script_setup_true_lang-D3_o-DIM.es.js → page.vue_vue_type_script_setup_true_lang-Dd5-B4Ss.es.js} +9 -9
- package/.chunks/{page.vue_vue_type_script_setup_true_lang-D3_o-DIM.es.js.map → page.vue_vue_type_script_setup_true_lang-Dd5-B4Ss.es.js.map} +1 -1
- package/.chunks/policy.vue_vue_type_style_index_0_lang-Bv3LwNDC.es.js +519 -0
- package/.chunks/policy.vue_vue_type_style_index_0_lang-Bv3LwNDC.es.js.map +1 -0
- package/.chunks/policy.vue_vue_type_style_index_0_lang-Da7rztT5.amd.js +2 -0
- package/.chunks/policy.vue_vue_type_style_index_0_lang-Da7rztT5.amd.js.map +1 -0
- package/.chunks/{popup-DpyyE2Cs.es.js → popup-OuDglAOF.es.js} +2 -2
- package/.chunks/{popup-DpyyE2Cs.es.js.map → popup-OuDglAOF.es.js.map} +1 -1
- package/.chunks/{popupHint.vue_vue_type_style_index_0_lang-CdQostog.amd.js → popupHint.vue_vue_type_style_index_0_lang-Bu_HvFoW.amd.js} +2 -2
- package/.chunks/{popupHint.vue_vue_type_style_index_0_lang-CdQostog.amd.js.map → popupHint.vue_vue_type_style_index_0_lang-Bu_HvFoW.amd.js.map} +1 -1
- package/.chunks/{popupHint.vue_vue_type_style_index_0_lang-if4Qli-k.es.js → popupHint.vue_vue_type_style_index_0_lang-DAQIAxvu.es.js} +5 -5
- package/.chunks/{popupHint.vue_vue_type_style_index_0_lang-if4Qli-k.es.js.map → popupHint.vue_vue_type_style_index_0_lang-DAQIAxvu.es.js.map} +1 -1
- package/.chunks/{utils-MzIaxkRQ.es.js → utils-BNzP9anP.es.js} +2 -2
- package/.chunks/{utils-MzIaxkRQ.es.js.map → utils-BNzP9anP.es.js.map} +1 -1
- package/.chunks/{utils-CyE38wuQ.es.js → utils-Dma85ehT.es.js} +3 -3
- package/.chunks/{utils-CyE38wuQ.es.js.map → utils-Dma85ehT.es.js.map} +1 -1
- package/.chunks/{widgetInput.vue_vue_type_script_setup_true_lang-Dy8jWadl.es.js → widgetInput.vue_vue_type_script_setup_true_lang-CX_BOcVY.es.js} +6 -6
- package/.chunks/{widgetInput.vue_vue_type_script_setup_true_lang-Dy8jWadl.es.js.map → widgetInput.vue_vue_type_script_setup_true_lang-CX_BOcVY.es.js.map} +1 -1
- package/api/index.amd.js +1 -1
- package/api/index.js +6 -6
- package/assets/policy.css +1 -1
- package/assets/project.css +1 -1
- package/assets/tabsView.css +1 -1
- package/charts/charts.js +14 -14
- package/core/app.amd.js +1 -1
- package/core/app.js +15 -15
- package/dialog/dialog.js +6 -6
- package/extra/extra.js +2 -2
- package/forms/forms.js +1 -1
- package/formsExt/formsExt.amd.js +1 -1
- package/formsExt/formsExt.js +21 -21
- 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/layout/layout.js +7 -7
- package/package.json +2 -2
- package/popup/popup.amd.js +1 -1
- package/popup/popup.js +9 -9
- package/popup/worker.js +2 -2
- package/project/project.amd.js +1 -1
- package/project/project.amd.js.map +1 -1
- package/project/project.js +1008 -629
- package/project/project.js.map +1 -1
- package/src/components/formsExt/selector2/composables/useMenu.d.ts +1 -1
- package/src/components/formsExt/selector2/selector2.vue.d.ts +2 -0
- package/src/components/formsExt/selector2/types.d.ts +35 -1
- package/src/components/formsExt/selector2/utils.d.ts +2 -0
- package/src/components/project/groupSelector/folders/utils.d.ts +6 -26
- package/src/components/project/groupSelector/groupSelector.vue.d.ts +1 -1
- package/src/components/project/groupSelector/groups/groups.vue.d.ts +13 -6
- package/src/components/project/groupSelector/groups/utils.d.ts +18 -53
- package/src/components/project/groupSelector/utils.d.ts +37 -0
- package/src/components/project/project.d.ts +2 -0
- package/src/components/project/projectSelector/cache.d.ts +29 -0
- package/src/components/project/projectSelector/projectSelector.vue.d.ts +128 -0
- package/src/components/project/projectSelector/submenu/submenu.vue.d.ts +4 -0
- package/src/components/project/projectSelector/submenu/types.d.ts +17 -0
- package/src/components/project/projectSelector/types.d.ts +48 -0
- package/src/components/project/projectSelector/utils.d.ts +240 -0
- package/src/components/tabsView/tabsView/menu.vue.d.ts +2 -6
- package/src/core/directives/tooltip.d.ts +2 -6
- package/tabs/tabs.js +5 -5
- package/tabsView/tabsView.amd.js +1 -1
- package/tabsView/tabsView.amd.js.map +1 -1
- package/tabsView/tabsView.js +93 -104
- package/tabsView/tabsView.js.map +1 -1
- package/utils/clipboard.js +1 -1
- package/utils/date.js +1 -1
- package/utils/device.js +1 -1
- package/utils/lodash.js +1 -1
- package/utils/price.js +1 -1
- package/utils/searchers.amd.js +1 -1
- package/utils/searchers.js +3 -3
- package/utils/string.js +1 -1
- package/.chunks/lazy-40pjr8cZ.es.js.map +0 -1
- package/.chunks/lazy-DSFLxvj4.amd.js +0 -2
- package/.chunks/lazy-DSFLxvj4.amd.js.map +0 -1
- package/.chunks/policy.vue_vue_type_style_index_0_lang-BDyhjT5Y.amd.js +0 -2
- package/.chunks/policy.vue_vue_type_style_index_0_lang-BDyhjT5Y.amd.js.map +0 -1
- package/.chunks/policy.vue_vue_type_style_index_0_lang-DVl9DBpl.es.js +0 -498
- package/.chunks/policy.vue_vue_type_style_index_0_lang-DVl9DBpl.es.js.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
define(["require","exports"],(function(y,s){"use strict";if(typeof l>"u")var l=window.Vue;const p="__empty_arrays",u=async(a,t,r)=>{const n=document.createElement("form");n.target=r,n.action=a,n.method="post",d(n,t),document.body.appendChild(n),n.submit(),n.remove()},d=(a,t)=>{const r=f(t);for(const[n,e]of r.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,r)=>{for(const[n,e]of Object.entries(a)){if(e==null)continue;const o=r?`${r}[${n}]`:n;switch(!0){case e instanceof File:t.append(o,e,e.name);break;case e instanceof FileList:for(let i=0;i<e.length;i++){const c=e.item(i);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(p+"[]",o);break}e.forEach((i,c)=>{f({[o+"["+c+"]"]:i},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},m=a=>{const t=new URLSearchParams,r=(n,e)=>{if(e!=null){if(Array.isArray(e)){for(const[o,i]of Object.entries(e))r(`${n}[${o}]`,i);return}if(typeof e=="object"){for(const[o,i]of Object.entries(e))r(`${n}[${o}]`,i);return}t.append(n,String(e))}};for(const[n,e]of Object.entries(a))r(n,e);return t.toString()};s.dataToForm=d,s.formDataSerializer=f,s.postInWindow=u,s.querySerializer=m,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})}));
|
|
2
|
+
//# sourceMappingURL=lazy-DDNqYkXn.amd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazy-DDNqYkXn.amd.js","sources":["../../src/api/api/utils/lazy.ts"],"sourcesContent":["/**\n * Общие утилиты, которые должны грузиться в отложенном режиме\n *\n * Все такие утилиты являются асинхронными\n */\n\nconst EMPTY_ARRAYS_FIELD_NAME = '__empty_arrays';\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(EMPTY_ARRAYS_FIELD_NAME + '[]', 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","key2","item","querySerializer","searchParams","appendParam","path","currentValue"],"mappings":"mHAcOA,EAAA,MAAAC,EAAAC,EAAAC,IAAA,wCAENC,EAAA,OAAAD,EACAC,EAAA,OAAAH,EACAG,EAAA,OAAA,OAEAC,EAAAD,EAAAF,CAAA,EAEA,SAAA,KAAA,YAAAE,CAAA,uBAGD,EAKOC,EAAA,CAAAC,EAAAJ,IAAA,CACN,MAAAK,EAAAC,EAAAN,CAAA,EAEA,SAAA,CAAAO,EAAAC,CAAA,IAAAH,EAAA,QAAA,EAAA,CACC,GAAAG,aAAA,KACC,MAAA,IAAA,MAAA,kDAAA,0CAKDC,EAAA,KAAAF,EACAE,EAAA,MAAA,OAAAD,CAAA,EACAJ,EAAA,YAAAK,CAAA,EAEF,EAOOH,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
|
-
},
|
|
3
|
+
n.target = r, n.action = i, n.method = "post", p(n, t), document.body.appendChild(n), n.submit(), n.remove();
|
|
4
|
+
}, p = (i, t) => {
|
|
5
5
|
const r = c(t);
|
|
6
6
|
for (const [n, e] of r.entries()) {
|
|
7
7
|
if (e instanceof File)
|
|
8
8
|
throw new Error("Files can not be manual set in `HTMLFormElement`");
|
|
9
9
|
const o = document.createElement("input");
|
|
10
|
-
o.name = n, o.value = String(e),
|
|
10
|
+
o.name = n, o.value = String(e), i.appendChild(o);
|
|
11
11
|
}
|
|
12
|
-
}, c = (
|
|
13
|
-
for (const [n, e] of Object.entries(
|
|
12
|
+
}, c = (i, t = new FormData(), r) => {
|
|
13
|
+
for (const [n, e] of Object.entries(i)) {
|
|
14
14
|
if (e == null) continue;
|
|
15
15
|
const o = r ? `${r}[${n}]` : n;
|
|
16
16
|
switch (!0) {
|
|
@@ -18,8 +18,8 @@ const l = async (a, t, r) => {
|
|
|
18
18
|
t.append(o, e, e.name);
|
|
19
19
|
break;
|
|
20
20
|
case e instanceof FileList:
|
|
21
|
-
for (let
|
|
22
|
-
const s = e.item(
|
|
21
|
+
for (let a = 0; a < e.length; a++) {
|
|
22
|
+
const s = e.item(a);
|
|
23
23
|
s && t.append(o + "[]", s, s.name);
|
|
24
24
|
}
|
|
25
25
|
break;
|
|
@@ -27,8 +27,12 @@ const l = async (a, t, r) => {
|
|
|
27
27
|
t.append(o, e);
|
|
28
28
|
break;
|
|
29
29
|
case Array.isArray(e):
|
|
30
|
-
e.
|
|
31
|
-
|
|
30
|
+
if (e.length === 0) {
|
|
31
|
+
t.append(f + "[]", o);
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
e.forEach((a, s) => {
|
|
35
|
+
c({ [o + "[" + s + "]"]: a }, t);
|
|
32
36
|
});
|
|
33
37
|
break;
|
|
34
38
|
case e instanceof Date:
|
|
@@ -42,30 +46,30 @@ const l = async (a, t, r) => {
|
|
|
42
46
|
}
|
|
43
47
|
}
|
|
44
48
|
return t;
|
|
45
|
-
},
|
|
49
|
+
}, d = (i) => {
|
|
46
50
|
const t = new URLSearchParams(), r = (n, e) => {
|
|
47
51
|
if (e != null) {
|
|
48
52
|
if (Array.isArray(e)) {
|
|
49
|
-
for (const [o,
|
|
50
|
-
r(`${n}[${o}]`,
|
|
53
|
+
for (const [o, a] of Object.entries(e))
|
|
54
|
+
r(`${n}[${o}]`, a);
|
|
51
55
|
return;
|
|
52
56
|
}
|
|
53
57
|
if (typeof e == "object") {
|
|
54
|
-
for (const [o,
|
|
55
|
-
r(`${n}[${o}]`,
|
|
58
|
+
for (const [o, a] of Object.entries(e))
|
|
59
|
+
r(`${n}[${o}]`, a);
|
|
56
60
|
return;
|
|
57
61
|
}
|
|
58
62
|
t.append(n, String(e));
|
|
59
63
|
}
|
|
60
64
|
};
|
|
61
|
-
for (const [n, e] of Object.entries(
|
|
65
|
+
for (const [n, e] of Object.entries(i))
|
|
62
66
|
r(n, e);
|
|
63
67
|
return t.toString();
|
|
64
68
|
};
|
|
65
69
|
export {
|
|
66
|
-
|
|
70
|
+
p as dataToForm,
|
|
67
71
|
c as formDataSerializer,
|
|
68
72
|
l as postInWindow,
|
|
69
|
-
|
|
73
|
+
d as querySerializer
|
|
70
74
|
};
|
|
71
|
-
//# sourceMappingURL=lazy-
|
|
75
|
+
//# sourceMappingURL=lazy-HKSyLh72.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazy-HKSyLh72.es.js","sources":["../../src/api/api/utils/lazy.ts"],"sourcesContent":["/**\n * Общие утилиты, которые должны грузиться в отложенном режиме\n *\n * Все такие утилиты являются асинхронными\n */\n\nconst EMPTY_ARRAYS_FIELD_NAME = '__empty_arrays';\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(EMPTY_ARRAYS_FIELD_NAME + '[]', 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":["EMPTY_ARRAYS_FIELD_NAME","postInWindow","url","data","target","form","dataToForm","elForm","formData","formDataSerializer","key","value","input","parentKey","fieldKey","i","file","item","querySerializer","searchParams","appendParam","path","currentValue"],"mappings":"AAMA,MAAMA,IAA0B,kBAQnBC,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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EAAS,OAAOM,GAAUH,EAAM,YAAA,CAAa;AAE7C;AAAA,MACD,KAAK,OAAOA,KAAU;AACrB,QAAAF,EAAmBE,GAAOH,GAAUM,CAAQ;AAE5C;AAAA,MACD;AACC,QAAAN,EAAS,OAAOM,GAAU,OAAOH,CAAK,CAAC;AAAA,IAAA;AAAA,EAE1C;AAEA,SAAOH;AACR,GAKaU,IAAkB,CAACf,MAA0C;AACzE,QAAMgB,IAAe,IAAI,gBAAA,GAEnBC,IAAc,CAACC,GAAcC,MAAgC;AAClE,QAAIA,KAAgB,MAEpB;AAAA,UAAI,MAAM,QAAQA,CAAY,GAAG;AAChC,mBAAW,CAACZ,GAAKC,CAAK,KAAK,OAAO,QAAQW,CAAY;AACrD,UAAAF,EAAY,GAAGC,CAAI,IAAIX,CAAG,KAAKC,CAAK;AAErC;AAAA,MACD;AAEA,UAAI,OAAOW,KAAiB,UAAU;AACrC,mBAAW,CAACZ,GAAKC,CAAK,KAAK,OAAO,QAAQW,CAAuC;AAChF,UAAAF,EAAY,GAAGC,CAAI,IAAIX,CAAG,KAAKC,CAAK;AAErC;AAAA,MACD;AAEA,MAAAQ,EAAa,OAAOE,GAAM,OAAOC,CAAY,CAAC;AAAA;AAAA,EAC/C;AAEA,aAAW,CAACZ,GAAKC,CAAK,KAAK,OAAO,QAAQR,CAAI;AAC7C,IAAAiB,EAAYV,GAAKC,CAAK;AAGvB,SAAOQ,EAAa,SAAA;AACrB;"}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
const fileNames = ['../assets/notice.css'].map(fileName => import.meta.resolve(fileName));
|
|
4
4
|
_autoloadCSSCore.insertCSSLinkToPage(fileNames, true);
|
|
5
5
|
|
|
6
|
-
import { reactive as N, defineComponent as B, ref as _, computed as H, resolveComponent as z, withDirectives as D,
|
|
7
|
-
import { C as h } from "./forms-
|
|
6
|
+
import { reactive as N, defineComponent as B, ref as _, computed as H, resolveComponent as z, withDirectives as D, openBlock as l, createElementBlock as a, normalizeClass as E, createElementVNode as M, createCommentVNode as T, createBlock as C, mergeProps as L, Fragment as S, renderList as x, Teleport as j, unref as O, normalizeStyle as V } from "vue";
|
|
7
|
+
import { C as h } from "./forms-DtC-EKJL.es.js";
|
|
8
8
|
import { genIntHash as A, nl2br as F } from "../utils/string.js";
|
|
9
9
|
const y = 300, u = N(/* @__PURE__ */ new Map()), J = (e, i, t) => "top-notice_" + A(e + i + JSON.stringify(t)), oe = (e, i = "info", t) => {
|
|
10
10
|
let d = "";
|
|
@@ -188,4 +188,4 @@ export {
|
|
|
188
188
|
ne as default,
|
|
189
189
|
oe as show
|
|
190
190
|
};
|
|
191
|
-
//# sourceMappingURL=notice-
|
|
191
|
+
//# sourceMappingURL=notice-BvQl911b.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notice-Ckc8r96E.es.js","sources":["../../src/components/core/notice/utils.ts","../../src/components/core/notice/item/item.vue","../../src/components/core/notice/notice.vue"],"sourcesContent":["import { reactive } from 'vue';\nimport type { Props as ItemProps, Props, Style } from '@/components/core/notice/item/types';\nimport Core from '@/core/core/core';\nimport { genIntHash } from '@/core/utils/string';\n\nexport const transitionDuration = 300;\n\nexport type Item = Props & { onClose?: Function };\n\nexport const itemById = reactive(new Map<string, Item>());\n\nconst genItemId = (text: ItemProps['text'], style: ItemProps['style'], options?: Options) => {\n\treturn 'top-notice_' + genIntHash(text + style + JSON.stringify(options));\n};\n\nexport type Options = {\n\ttitle?: ItemProps['title'],\n\tmetaText?: ItemProps['metaText'],\n\tbuttonProps?: ItemProps['buttonProps'],\n\tbuttonsProps?: ItemProps['buttonsProps'],\n\tisSafeHTML?: ItemProps['isSafeHTML'],\n\tselectToClose?: ItemProps['selectToClose'],\n\tonClose?: Function\n}\n\n/**\n * Показать сообщением в стиле push уведомления\n *\n * title будет получен из первой строки text\n *\n * Если в options указан title, он будет взят оттуда\n */\nexport const show = (text: string, style: Style = 'info', options?: Options) => {\n\tlet title = '';\n\n\ttext = String(text);\n\n\tconst id = genItemId(text, style, options);\n\n\tif (options?.title) {\n\t\ttitle = options.title;\n\t} else {\n\t\tconst chunks = text.split('\\n');\n\n\t\tif (chunks.length) {\n\t\t\ttitle = String(chunks.shift());\n\t\t\ttext = chunks.join('\\n');\n\t\t}\n\t}\n\n\tconst itemExists = itemById.get(id);\n\tif (itemExists) {\n\t\thightlight(itemExists);\n\n\t\treturn;\n\t}\n\n\tconst item: Item = {\n\t\tid,\n\t\ttitle,\n\t\ttext,\n\t\tstyle,\n\t\tbuttonProps: options?.buttonProps,\n\t\tbuttonsProps: options?.buttonsProps,\n\t\tmetaText: options?.metaText,\n\t\tisSafeHTML: options?.isSafeHTML,\n\t\tselectToClose: options?.selectToClose,\n\t\tonClose: options?.onClose,\n\t};\n\n\titemById.set(item.id, item);\n\n\tif (itemById.size > 5) {\n\t\tconst [_firstId, firstItem] = [...itemById].at(0) || [];\n\t\tif (firstItem) close(firstItem);\n\t}\n\n\t/**\n\t * Автозакрытие ошибок форм\n\t *\n\t * Добавляет\n\t */\n\tif (Core.state.isMobile) {\n\t\t$('input').one('click', () => close(item));\n\t}\n};\n\nconst hightlight = (item: Item) => {\n\titem.hightlight = true;\n\n\tsetTimeout(() => item.hightlight = false, transitionDuration);\n};\n\nconst close = (item: Item) => {\n\titem.forceClosed = true;\n\n\tsetTimeout(() => {\n\t\titem.onClose?.();\n\n\t\titemById.delete(item.id);\n\t}, transitionDuration);\n};\n\n/**\n * Убрать подозрительный html код\n */\nexport const prepareText = (text: string) => {\n\tconst textNoSafety = 'hacking was detected';\n\n\ttext = text.replace(/<script/g, textNoSafety);\n\ttext = text.replace(/<img/g, textNoSafety);\n\ttext = text.replace(/<iframe/g, textNoSafety);\n\ttext = text.replace(/javascript:/g, textNoSafety);\n\ttext = text.replace(/<[^>]+ (@|on)\\w+=[^>]+>?/g, textNoSafety);\n\n\treturn text;\n};\n","<script setup lang=\"ts\">\nimport { computed, ref, withDefaults } from 'vue';\n\nimport Core from '@/core/core/core';\nimport { nl2br } from '@/core/utils/string';\n\nimport type { Emits, Props } from './types';\nimport { prepareText, transitionDuration } from '@/components/core/notice/utils';\n\nconst props = withDefaults(defineProps<Props>(), {\n\tselectToClose: true,\n});\n\nconst emit = defineEmits<Emits>();\n\n// анимация появления\nconst showed = ref(false);\nsetTimeout(() => showed.value = true, 10);\n\n// анимация закрытия\nconst closed = ref(false);\nconst closedDirection = ref<'top' | 'right' | 'bottom' | 'left'>('right');\n\nconst title = computed(() => {\n\tlet res = props.title.replace(/ {2}/g, ' ');\n\n\tif (!props.isSafeHTML) res = prepareText(res);\n\n\treturn res;\n});\n\nconst text = computed(() => {\n\tlet res = nl2br(props.text);\n\n\tres = res.replace(/ {2}/g, ' ');\n\n\tif (!props.isSafeHTML) res = prepareText(res);\n\n\treturn res;\n});\n\nconst close = (direction?: typeof closedDirection.value) => {\n\tclosed.value = true;\n\n\tif (direction) {\n\t\tclosedDirection.value = direction;\n\t}\n\n\tsetTimeout(() => emit('close'), transitionDuration);\n};\n\nconst onClick = (e: MouseEvent) => {\n\tif (!props.selectToClose) return;\n\n\tconst { tagName } = e.target as HTMLElement;\n\n\tif (tagName === 'A') close();\n\tif (tagName === 'BUTTON') close();\n};\n\nconst vSwipe = {\n\tmounted: (el: HTMLElement) => {\n\t\tif (!Core.state.isMobile) return;\n\n\t\tif (!Core.$ || !Core.$.ui['draggable']) return;\n\n\t\tlet direction: typeof closedDirection.value = 'right';\n\n\t\tlet axis = 'x';\n\t\t// if (getOS() === 'iOS') axis = 'y';\n\n\t\tCore.$(el).draggable({\n\t\t\trevert: false,\n\t\t\taxis,\n\t\t\tdrag: (_e, ui) => {\n\t\t\t\tif (axis == 'x') {\n\t\t\t\t\tdirection = ui.position.left > 0 ? 'right' : 'left';\n\t\t\t\t} else {\n\t\t\t\t\tdirection = ui.position.top > 0 ? 'bottom' : 'top';\n\t\t\t\t}\n\t\t\t},\n\t\t\tstop: (_e, _ui) => {\n\t\t\t\tclose(direction);\n\t\t\t},\n\t\t});\n\t},\n};\n\n// const vSwipe = {\n// \tmounted: (el: HTMLElement) => {\n// \t\tconst { distanceX, direction } = usePointerSwipe(el, {\n// \t\t\tdisableTextSelect: true,\n// \t\t\tonSwipe(e: PointerEvent) {\n// \t\t\t\tleft.value = -distanceX.value + 'px';\n// \t\t\t},\n// \t\t\tonSwipeEnd: (_e, direction) => {\n// \t\t\t\tclose(direction);\n// \t\t\t},\n// \t\t});\n// \t},\n// };\n</script>\n\n<template>\n\t<div\n\t\tclass=\"top-notice_item\"\n\t\t:class=\"{\n\t\t\t['top-notice_item-' + style]: true,\n\t\t\t'top-notice_item-hightlight': hightlight,\n\t\t\t'top-notice_item-showed': showed,\n\t\t\t'top-notice_item-closed': closed || forceClosed,\n\t\t\t['top-notice_item-closed_' + closedDirection]: closed,\n\t\t}\"\n\t\t@click=\"onClick\"\n\t\tv-swipe\n\t>\n\t\t<div class=\"top-notice_itemTextWrapper\">\n\t\t\t<div v-if=\"title\" class=\"top-notice_itemTitle\" v-html=\"title\"></div>\n\t\t\t<div v-if=\"text\" class=\"top-notice_itemText\" v-html=\"text\"></div>\n\t\t</div>\n\n\t\t<TopButton\n\t\t\tv-if=\"buttonProps\"\n\t\t\tclass=\"top-notice_itemButton\"\n\t\t\tsize=\"s\"\n\t\t\t:=\"buttonProps\"\n\t\t\t:title=\"buttonProps.title\"\n\t\t\tv-html=\"buttonProps.default\"\n\t\t\t@click=\"close()\"\n\t\t/>\n\n\t\t<div\n\t\t\tv-if=\"buttonsProps?.length\"\n\t\t\tclass=\"top-notice_itemButtons\"\n\t\t>\n\t\t\t<TopButton\n\t\t\t\tv-for=\"buttonProps in buttonsProps\"\n\t\t\t\tclass=\"top-notice_itemButton\"\n\t\t\t\tsize=\"s\"\n\t\t\t\t:=\"buttonProps\"\n\t\t\t\t:title=\"buttonProps.title\"\n\t\t\t\tv-html=\"buttonProps.default\"\n\t\t\t\t@click=\"close()\"\n\t\t\t/>\n\t\t</div>\n\n\t\t<div v-if=\"metaText\" class=\"top-notice_itemMetaText\" v-html=\"metaText\"></div>\n\n\t\t<div\n\t\t\tclass=\"top-notice_itemClose\"\n\t\t\tdata-top-icon=\"\"\n\t\t\t:title=\"$i18n.Common.Close\"\n\t\t\t@click=\"() => close()\"\n\t\t></div>\n\t</div>\n</template>\n\n<style>\n@import \"style.css\";\n</style>\n","<!-- performance all in one file component, для Core.notice() -->\n<script lang=\"ts\">\nexport { show } from './utils';\n</script>\n\n<script setup lang=\"ts\">\nimport type { Item } from './utils';\nimport { itemById } from './utils';\n\nimport type { Props } from './types';\nimport TopNoticeItem from './item/item.vue';\n\ndefineProps<Props>();\n\nconst onCloseItem = (item: Item) => {\n\titem.onClose?.();\n\n\titemById.delete(item.id);\n};\n</script>\n\n<template>\n\t<teleport to=\"body\">\n\t\t<div class=\"top-notice\">\n\t\t\t<TopNoticeItem\n\t\t\t\tv-for=\"[_index, item] in itemById\"\n\t\t\t\t:key=\"item.id\"\n\t\t\t\t:id=\"item.id\"\n\t\t\t\t:title=\"item.title\"\n\t\t\t\t:text=\"item.text\"\n\t\t\t\t:style=\"item.style\"\n\t\t\t\t:buttonProps=\"item.buttonProps\"\n\t\t\t\t:buttonsProps=\"item.buttonsProps\"\n\t\t\t\t:metaText=\"item.metaText\"\n\t\t\t\t:isSafeHTML=\"item.isSafeHTML\"\n\t\t\t\t:forceClosed=\"item.forceClosed\"\n\t\t\t\t:hightlight=\"item.hightlight\"\n\t\t\t\t@close=\"onCloseItem(item)\"\n\t\t\t/>\n\t\t</div>\n\t</teleport>\n</template>\n\n<style>\n:root {\n\t--top-notice-top: var(--top-padding-4);\n\t--top-notice-right: var(--top-padding-4);\n}\n\n.top-notice {\n\twidth: 400px;\n\tfont-size: 14px;\n\tposition: fixed; top: var(--top-notice-top); right: var(--top-notice-right);\n\tz-index: 1000010;\n\tdisplay: flex; flex-direction: column-reverse; gap: var(--top-gap-2);\n}\n\n.top-notice ul {\n\tpadding: 0 0 0 var(--top-padding-5);\n}\n\n@media only screen and (max-width: 600px) {\n\t:root {\n\t\t--top-notice-top: var(--top-padding-4);\n\t\t--top-notice-right: var(--top-padding-4);\n\t}\n\n\t.top-notice { width: auto; left: var(--top-notice-right); }\n}\n</style>\n"],"names":["transitionDuration","itemById","reactive","genItemId","text","style","options","genIntHash","show","title","id","chunks","itemExists","hightlight","item","_firstId","firstItem","Core","close","prepareText","textNoSafety","props","__props","emit","__emit","showed","ref","closed","closedDirection","computed","res","nl2br","direction","onClick","e","tagName","vSwipe","el","_e","ui","_ui","_createElementBlock","_createElementVNode","_hoisted_1","_openBlock","_createBlock","_component_TopButton","_mergeProps","_hoisted_4","_Fragment","_renderList","buttonProps","$i18n","onCloseItem","_Teleport","_unref","_index","TopNoticeItem","_normalizeStyle","$event"],"mappings":";;;AAKO,MAAMA,IAAqB,KAIrBC,IAAWC,EAAS,oBAAI,KAAmB,GAElDC,IAAY,CAACC,GAAyBC,GAA2BC,MAC/D,gBAAgBC,EAAWH,IAAOC,IAAQ,KAAK,UAAUC,CAAO,CAAC,GAoB5DE,KAAO,CAACJ,GAAcC,IAAe,QAAQC,MAAsB;AAC/E,MAAIG,IAAQ;AAEZ,EAAAL,IAAO,OAAOA,CAAI;AAElB,QAAMM,IAAKP,EAAUC,GAAMC,GAAOC,CAAO;AAEzC,MAAIA,GAAS;AACZ,IAAAG,IAAQH,EAAQ;AAAA,OACV;AACN,UAAMK,IAASP,EAAK,MAAM;AAAA,CAAI;AAE9B,IAAIO,EAAO,WACVF,IAAQ,OAAOE,EAAO,OAAO,GAC7BP,IAAOO,EAAO,KAAK;AAAA,CAAI;AAAA,EAEzB;AAEA,QAAMC,IAAaX,EAAS,IAAIS,CAAE;AAClC,MAAIE,GAAY;AACf,IAAAC,EAAWD,CAAU;AAErB;AAAA,EACD;AAEA,QAAME,IAAa;AAAA,IAClB,IAAAJ;AAAA,IACA,OAAAD;AAAA,IACA,MAAAL;AAAA,IACA,OAAAC;AAAA,IACA,aAAaC,GAAS;AAAA,IACtB,cAAcA,GAAS;AA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,GAgBM;AAAA,SAfLC,EAAA,EAAA,GAAAH,EAcEQ,GAAA,MAAAC,EAbwBK,EAAAtD,CAAA,GAAQ,CAAA,CAAzBuD,GAAQ1C,CAAI,YADrB+B,EAcEY,GAAA;AAAA,UAZA,KAAK3C,EAAK;AAAA,UACV,IAAIA,EAAK;AAAA,UACT,OAAOA,EAAK;AAAA,UACZ,MAAMA,EAAK;AAAA,UACX,OAAK4C,EAAE5C,EAAK,KAAK;AAAA,UACjB,aAAaA,EAAK;AAAA,UAClB,cAAcA,EAAK;AAAA,UACnB,UAAUA,EAAK;AAAA,UACf,YAAYA,EAAK;AAAA,UACjB,aAAaA,EAAK;AAAA,UAClB,YAAYA,EAAK;AAAA,UACjB,SAAK,CAAA6C,MAAEN,EAAYvC,CAAI;AAAA,QAAA;;;;;"}
|
|
1
|
+
{"version":3,"file":"notice-BvQl911b.es.js","sources":["../../src/components/core/notice/utils.ts","../../src/components/core/notice/item/item.vue","../../src/components/core/notice/notice.vue"],"sourcesContent":["import { reactive } from 'vue';\nimport type { Props as ItemProps, Props, Style } from '@/components/core/notice/item/types';\nimport Core from '@/core/core/core';\nimport { genIntHash } from '@/core/utils/string';\n\nexport const transitionDuration = 300;\n\nexport type Item = Props & { onClose?: Function };\n\nexport const itemById = reactive(new Map<string, Item>());\n\nconst genItemId = (text: ItemProps['text'], style: ItemProps['style'], options?: Options) => {\n\treturn 'top-notice_' + genIntHash(text + style + JSON.stringify(options));\n};\n\nexport type Options = {\n\ttitle?: ItemProps['title'],\n\tmetaText?: ItemProps['metaText'],\n\tbuttonProps?: ItemProps['buttonProps'],\n\tbuttonsProps?: ItemProps['buttonsProps'],\n\tisSafeHTML?: ItemProps['isSafeHTML'],\n\tselectToClose?: ItemProps['selectToClose'],\n\tonClose?: Function\n}\n\n/**\n * Показать сообщением в стиле push уведомления\n *\n * title будет получен из первой строки text\n *\n * Если в options указан title, он будет взят оттуда\n */\nexport const show = (text: string, style: Style = 'info', options?: Options) => {\n\tlet title = '';\n\n\ttext = String(text);\n\n\tconst id = genItemId(text, style, options);\n\n\tif (options?.title) {\n\t\ttitle = options.title;\n\t} else {\n\t\tconst chunks = text.split('\\n');\n\n\t\tif (chunks.length) {\n\t\t\ttitle = String(chunks.shift());\n\t\t\ttext = chunks.join('\\n');\n\t\t}\n\t}\n\n\tconst itemExists = itemById.get(id);\n\tif (itemExists) {\n\t\thightlight(itemExists);\n\n\t\treturn;\n\t}\n\n\tconst item: Item = {\n\t\tid,\n\t\ttitle,\n\t\ttext,\n\t\tstyle,\n\t\tbuttonProps: options?.buttonProps,\n\t\tbuttonsProps: options?.buttonsProps,\n\t\tmetaText: options?.metaText,\n\t\tisSafeHTML: options?.isSafeHTML,\n\t\tselectToClose: options?.selectToClose,\n\t\tonClose: options?.onClose,\n\t};\n\n\titemById.set(item.id, item);\n\n\tif (itemById.size > 5) {\n\t\tconst [_firstId, firstItem] = [...itemById].at(0) || [];\n\t\tif (firstItem) close(firstItem);\n\t}\n\n\t/**\n\t * Автозакрытие ошибок форм\n\t *\n\t * Добавляет\n\t */\n\tif (Core.state.isMobile) {\n\t\t$('input').one('click', () => close(item));\n\t}\n};\n\nconst hightlight = (item: Item) => {\n\titem.hightlight = true;\n\n\tsetTimeout(() => item.hightlight = false, transitionDuration);\n};\n\nconst close = (item: Item) => {\n\titem.forceClosed = true;\n\n\tsetTimeout(() => {\n\t\titem.onClose?.();\n\n\t\titemById.delete(item.id);\n\t}, transitionDuration);\n};\n\n/**\n * Убрать подозрительный html код\n */\nexport const prepareText = (text: string) => {\n\tconst textNoSafety = 'hacking was detected';\n\n\ttext = text.replace(/<script/g, textNoSafety);\n\ttext = text.replace(/<img/g, textNoSafety);\n\ttext = text.replace(/<iframe/g, textNoSafety);\n\ttext = text.replace(/javascript:/g, textNoSafety);\n\ttext = text.replace(/<[^>]+ (@|on)\\w+=[^>]+>?/g, textNoSafety);\n\n\treturn text;\n};\n","<script setup lang=\"ts\">\nimport { computed, ref, withDefaults } from 'vue';\n\nimport Core from '@/core/core/core';\nimport { nl2br } from '@/core/utils/string';\n\nimport type { Emits, Props } from './types';\nimport { prepareText, transitionDuration } from '@/components/core/notice/utils';\n\nconst props = withDefaults(defineProps<Props>(), {\n\tselectToClose: true,\n});\n\nconst emit = defineEmits<Emits>();\n\n// анимация появления\nconst showed = ref(false);\nsetTimeout(() => showed.value = true, 10);\n\n// анимация закрытия\nconst closed = ref(false);\nconst closedDirection = ref<'top' | 'right' | 'bottom' | 'left'>('right');\n\nconst title = computed(() => {\n\tlet res = props.title.replace(/ {2}/g, ' ');\n\n\tif (!props.isSafeHTML) res = prepareText(res);\n\n\treturn res;\n});\n\nconst text = computed(() => {\n\tlet res = nl2br(props.text);\n\n\tres = res.replace(/ {2}/g, ' ');\n\n\tif (!props.isSafeHTML) res = prepareText(res);\n\n\treturn res;\n});\n\nconst close = (direction?: typeof closedDirection.value) => {\n\tclosed.value = true;\n\n\tif (direction) {\n\t\tclosedDirection.value = direction;\n\t}\n\n\tsetTimeout(() => emit('close'), transitionDuration);\n};\n\nconst onClick = (e: MouseEvent) => {\n\tif (!props.selectToClose) return;\n\n\tconst { tagName } = e.target as HTMLElement;\n\n\tif (tagName === 'A') close();\n\tif (tagName === 'BUTTON') close();\n};\n\nconst vSwipe = {\n\tmounted: (el: HTMLElement) => {\n\t\tif (!Core.state.isMobile) return;\n\n\t\tif (!Core.$ || !Core.$.ui['draggable']) return;\n\n\t\tlet direction: typeof closedDirection.value = 'right';\n\n\t\tlet axis = 'x';\n\t\t// if (getOS() === 'iOS') axis = 'y';\n\n\t\tCore.$(el).draggable({\n\t\t\trevert: false,\n\t\t\taxis,\n\t\t\tdrag: (_e, ui) => {\n\t\t\t\tif (axis == 'x') {\n\t\t\t\t\tdirection = ui.position.left > 0 ? 'right' : 'left';\n\t\t\t\t} else {\n\t\t\t\t\tdirection = ui.position.top > 0 ? 'bottom' : 'top';\n\t\t\t\t}\n\t\t\t},\n\t\t\tstop: (_e, _ui) => {\n\t\t\t\tclose(direction);\n\t\t\t},\n\t\t});\n\t},\n};\n\n// const vSwipe = {\n// \tmounted: (el: HTMLElement) => {\n// \t\tconst { distanceX, direction } = usePointerSwipe(el, {\n// \t\t\tdisableTextSelect: true,\n// \t\t\tonSwipe(e: PointerEvent) {\n// \t\t\t\tleft.value = -distanceX.value + 'px';\n// \t\t\t},\n// \t\t\tonSwipeEnd: (_e, direction) => {\n// \t\t\t\tclose(direction);\n// \t\t\t},\n// \t\t});\n// \t},\n// };\n</script>\n\n<template>\n\t<div\n\t\tclass=\"top-notice_item\"\n\t\t:class=\"{\n\t\t\t['top-notice_item-' + style]: true,\n\t\t\t'top-notice_item-hightlight': hightlight,\n\t\t\t'top-notice_item-showed': showed,\n\t\t\t'top-notice_item-closed': closed || forceClosed,\n\t\t\t['top-notice_item-closed_' + closedDirection]: closed,\n\t\t}\"\n\t\t@click=\"onClick\"\n\t\tv-swipe\n\t>\n\t\t<div class=\"top-notice_itemTextWrapper\">\n\t\t\t<div v-if=\"title\" class=\"top-notice_itemTitle\" v-html=\"title\"></div>\n\t\t\t<div v-if=\"text\" class=\"top-notice_itemText\" v-html=\"text\"></div>\n\t\t</div>\n\n\t\t<TopButton\n\t\t\tv-if=\"buttonProps\"\n\t\t\tclass=\"top-notice_itemButton\"\n\t\t\tsize=\"s\"\n\t\t\t:=\"buttonProps\"\n\t\t\t:title=\"buttonProps.title\"\n\t\t\tv-html=\"buttonProps.default\"\n\t\t\t@click=\"close()\"\n\t\t/>\n\n\t\t<div\n\t\t\tv-if=\"buttonsProps?.length\"\n\t\t\tclass=\"top-notice_itemButtons\"\n\t\t>\n\t\t\t<TopButton\n\t\t\t\tv-for=\"buttonProps in buttonsProps\"\n\t\t\t\tclass=\"top-notice_itemButton\"\n\t\t\t\tsize=\"s\"\n\t\t\t\t:=\"buttonProps\"\n\t\t\t\t:title=\"buttonProps.title\"\n\t\t\t\tv-html=\"buttonProps.default\"\n\t\t\t\t@click=\"close()\"\n\t\t\t/>\n\t\t</div>\n\n\t\t<div v-if=\"metaText\" class=\"top-notice_itemMetaText\" v-html=\"metaText\"></div>\n\n\t\t<div\n\t\t\tclass=\"top-notice_itemClose\"\n\t\t\tdata-top-icon=\"\"\n\t\t\t:title=\"$i18n.Common.Close\"\n\t\t\t@click=\"() => close()\"\n\t\t></div>\n\t</div>\n</template>\n\n<style>\n@import \"style.css\";\n</style>\n","<!-- performance all in one file component, для Core.notice() -->\n<script lang=\"ts\">\nexport { show } from './utils';\n</script>\n\n<script setup lang=\"ts\">\nimport type { Item } from './utils';\nimport { itemById } from './utils';\n\nimport type { Props } from './types';\nimport TopNoticeItem from './item/item.vue';\n\ndefineProps<Props>();\n\nconst onCloseItem = (item: Item) => {\n\titem.onClose?.();\n\n\titemById.delete(item.id);\n};\n</script>\n\n<template>\n\t<teleport to=\"body\">\n\t\t<div class=\"top-notice\">\n\t\t\t<TopNoticeItem\n\t\t\t\tv-for=\"[_index, item] in itemById\"\n\t\t\t\t:key=\"item.id\"\n\t\t\t\t:id=\"item.id\"\n\t\t\t\t:title=\"item.title\"\n\t\t\t\t:text=\"item.text\"\n\t\t\t\t:style=\"item.style\"\n\t\t\t\t:buttonProps=\"item.buttonProps\"\n\t\t\t\t:buttonsProps=\"item.buttonsProps\"\n\t\t\t\t:metaText=\"item.metaText\"\n\t\t\t\t:isSafeHTML=\"item.isSafeHTML\"\n\t\t\t\t:forceClosed=\"item.forceClosed\"\n\t\t\t\t:hightlight=\"item.hightlight\"\n\t\t\t\t@close=\"onCloseItem(item)\"\n\t\t\t/>\n\t\t</div>\n\t</teleport>\n</template>\n\n<style>\n:root {\n\t--top-notice-top: var(--top-padding-4);\n\t--top-notice-right: var(--top-padding-4);\n}\n\n.top-notice {\n\twidth: 400px;\n\tfont-size: 14px;\n\tposition: fixed; top: var(--top-notice-top); right: var(--top-notice-right);\n\tz-index: 1000010;\n\tdisplay: flex; flex-direction: column-reverse; gap: var(--top-gap-2);\n}\n\n.top-notice ul {\n\tpadding: 0 0 0 var(--top-padding-5);\n}\n\n@media only screen and (max-width: 600px) {\n\t:root {\n\t\t--top-notice-top: var(--top-padding-4);\n\t\t--top-notice-right: var(--top-padding-4);\n\t}\n\n\t.top-notice { width: auto; left: var(--top-notice-right); }\n}\n</style>\n"],"names":["transitionDuration","itemById","reactive","genItemId","text","style","options","genIntHash","show","title","id","chunks","itemExists","hightlight","item","_firstId","firstItem","Core","close","prepareText","textNoSafety","props","__props","emit","__emit","showed","ref","closed","closedDirection","computed","res","nl2br","direction","onClick","e","tagName","vSwipe","el","_e","ui","_ui","_createElementBlock","_createElementVNode","_hoisted_1","_openBlock","_createBlock","_component_TopButton","_mergeProps","_hoisted_4","_Fragment","_renderList","buttonProps","$i18n","onCloseItem","_Teleport","_unref","_index","TopNoticeItem","_normalizeStyle","$event"],"mappings":";;;AAKO,MAAMA,IAAqB,KAIrBC,IAAWC,EAAS,oBAAI,KAAmB,GAElDC,IAAY,CAACC,GAAyBC,GAA2BC,MAC/D,gBAAgBC,EAAWH,IAAOC,IAAQ,KAAK,UAAUC,CAAO,CAAC,GAoB5DE,KAAO,CAACJ,GAAcC,IAAe,QAAQC,MAAsB;AAC/E,MAAIG,IAAQ;AAEZ,EAAAL,IAAO,OAAOA,CAAI;AAElB,QAAMM,IAAKP,EAAUC,GAAMC,GAAOC,CAAO;AAEzC,MAAIA,GAAS;AACZ,IAAAG,IAAQH,EAAQ;AAAA,OACV;AACN,UAAMK,IAASP,EAAK,MAAM;AAAA,CAAI;AAE9B,IAAIO,EAAO,WACVF,IAAQ,OAAOE,EAAO,OAAO,GAC7BP,IAAOO,EAAO,KAAK;AAAA,CAAI;AAAA,EAEzB;AAEA,QAAMC,IAAaX,EAAS,IAAIS,CAAE;AAClC,MAAIE,GAAY;AACf,IAAAC,EAAWD,CAAU;AAErB;AAAA,EACD;AAEA,QAAME,IAAa;AAAA,IAClB,IAAAJ;AAAA,IACA,OAAAD;AAAA,IACA,MAAAL;AAAA,IACA,OAAAC;AAAA,IACA,aAAaC,GAAS;AAAA,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AClBZ,EAgBM,OAhBNC,GAgBM;AAAA,SAfLC,EAAA,EAAA,GAAAH,EAcEQ,GAAA,MAAAC,EAbwBK,EAAAtD,CAAA,GAAQ,CAAA,CAAzBuD,GAAQ1C,CAAI,YADrB+B,EAcEY,GAAA;AAAA,UAZA,KAAK3C,EAAK;AAAA,UACV,IAAIA,EAAK;AAAA,UACT,OAAOA,EAAK;AAAA,UACZ,MAAMA,EAAK;AAAA,UACX,OAAK4C,EAAE5C,EAAK,KAAK;AAAA,UACjB,aAAaA,EAAK;AAAA,UAClB,cAAcA,EAAK;AAAA,UACnB,UAAUA,EAAK;AAAA,UACf,YAAYA,EAAK;AAAA,UACjB,aAAaA,EAAK;AAAA,UAClB,YAAYA,EAAK;AAAA,UACjB,SAAK,CAAA6C,MAAEN,EAAYvC,CAAI;AAAA,QAAA;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as v, provide as f, onMounted as w, getCurrentInstance as b, watch as D,
|
|
2
|
-
import { g as T } from "./dialogs.vue_vue_type_script_setup_true_lang-
|
|
3
|
-
import { C as A } from "./forms-
|
|
4
|
-
import { b as B } from "./utils-
|
|
1
|
+
import { defineComponent as v, provide as f, onMounted as w, getCurrentInstance as b, watch as D, openBlock as i, createElementBlock as d, unref as a, normalizeStyle as m, normalizeClass as r, createElementVNode as s, renderSlot as n, computed as C, resolveDirective as $, createBlock as p, Teleport as h, withDirectives as k, createCommentVNode as g } from "vue";
|
|
2
|
+
import { g as T } from "./dialogs.vue_vue_type_script_setup_true_lang-CJ97l1ST.es.js";
|
|
3
|
+
import { C as A } from "./forms-DtC-EKJL.es.js";
|
|
4
|
+
import { b as B } from "./utils-BNzP9anP.es.js";
|
|
5
5
|
const W = ["id", "data-view-page-active", "data-modal", "data-position"], G = /* @__PURE__ */ v({
|
|
6
6
|
__name: "dialog",
|
|
7
7
|
props: {
|
|
@@ -71,7 +71,7 @@ const W = ["id", "data-view-page-active", "data-modal", "data-position"], G = /*
|
|
|
71
71
|
return (t, u) => {
|
|
72
72
|
const y = $("top-scroll-shadow");
|
|
73
73
|
return a(o).isReady.value ? (i(), d("div", E, [
|
|
74
|
-
(i(), h
|
|
74
|
+
(i(), p(h, {
|
|
75
75
|
to: "#" + a(o).idAttr + " .modal-layer-header",
|
|
76
76
|
disabled: !a(o).needShowPage(e.name)
|
|
77
77
|
}, [
|
|
@@ -103,7 +103,7 @@ const W = ["id", "data-view-page-active", "data-modal", "data-position"], G = /*
|
|
|
103
103
|
])
|
|
104
104
|
], 10, N)
|
|
105
105
|
], 8, ["to", "disabled"])),
|
|
106
|
-
(i(), h
|
|
106
|
+
(i(), p(h, {
|
|
107
107
|
to: "#" + a(o).idAttr + " .modal-layer-body",
|
|
108
108
|
disabled: !a(o).needShowPage(e.name)
|
|
109
109
|
}, [
|
|
@@ -125,10 +125,10 @@ const W = ["id", "data-view-page-active", "data-modal", "data-position"], G = /*
|
|
|
125
125
|
}])
|
|
126
126
|
}, [
|
|
127
127
|
n(t.$slots, "footer")
|
|
128
|
-
], 2)) :
|
|
128
|
+
], 2)) : g("", !0)
|
|
129
129
|
], 14, F)
|
|
130
130
|
], 8, ["to", "disabled"]))
|
|
131
|
-
])) :
|
|
131
|
+
])) : g("", !0);
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
134
|
});
|
|
@@ -136,4 +136,4 @@ export {
|
|
|
136
136
|
G as _,
|
|
137
137
|
H as a
|
|
138
138
|
};
|
|
139
|
-
//# sourceMappingURL=page.vue_vue_type_script_setup_true_lang-
|
|
139
|
+
//# sourceMappingURL=page.vue_vue_type_script_setup_true_lang-Dd5-B4Ss.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
{"version":3,"file":"page.vue_vue_type_script_setup_true_lang-Dd5-B4Ss.es.js","sources":["../../src/components/dialog/dialog/dialog.vue","../../src/components/dialog/dialog/page/page.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { ComponentInternalInstance } from 'vue';\nimport { getCurrentInstance, onMounted, provide, watch } from 'vue';\nimport { getDialogWorker } from './dialogs/dialogs.vue';\nimport type { Emits, Props, Slots } from './types';\n\nconst props = withDefaults(defineProps<Props>(), {\n\twidth: '600px',\n\theight: 'auto',\n\tmodal: true,\n\thistoryType: 'push',\n});\n\ndefineEmits<Emits>();\n\ndefineSlots<Slots>();\n\nconst dialog = getDialogWorker(props.id);\nif (!dialog) {\n\tthrow new Error('TopDialog cannot be used in a template, use useTopDialog() / useAsyncTopDialog()');\n}\n\n/**\n * Для useTopDialogSelf()\n */\nprovide('dialogWorker', dialog);\n\n/**\n * Инициализация начального состояния TopDialogHandle\n */\nonMounted(() => {\n\tconst topDialogBaseComponent = getCurrentInstance() as ComponentInternalInstance;\n\tconst topDialogComponent = topDialogBaseComponent.parent;\n\n\tif (topDialogComponent?.parent?.type.name !== 'DialogWrapper') {\n\t\tthrow new Error('TopDialog cannot be used in a template, use useTopDialog()');\n\t}\n\n\tif (Array.isArray(topDialogComponent.subTree.children) && topDialogComponent.subTree.children.length !== 1) {\n\t\tthrow new Error('TopDialog can has only one root element');\n\t}\n\n\tdialog.onMounted(topDialogComponent, topDialogBaseComponent);\n});\n\nwatch(dialog.isOpened, () => {\n\tdialog.isReady.value = true;\n}, {\n\tflush: 'post',\n\tonce: true,\n});\n</script>\n\n<template>\n\t<div\n\t\t:id=\"dialog.idAttr\"\n\t\tclass=\"top-dialog\"\n\t\t:class=\"classes\"\n\t\t:style=\"{\n\t\t\t'--top-dialog-width': width,\n\t\t\t'--top-dialog-height': height,\n\t\t}\"\n\t\ttabindex=\"-1\"\n\t\t:data-view-page-active=\"dialog.pageActive.value\"\n\t\t:data-modal=\"modal\"\n\t\t:data-position=\"position\"\n\t>\n\t\t<div class=\"modal-layer modal-layer-header\"></div>\n\n\t\t<div class=\"modal-layer modal-layer-body\" :style=\"{'min-height': height + 'px'}\"></div>\n\n\t\t<slot name=\"default\"></slot>\n\t</div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport Core from '@/core/core/core';\nimport { useTopDialogSelf } from '@/components/dialog/dialog/composables/utils';\nimport type { Props, Slots } from './types';\n\nconst props = withDefaults(defineProps<Props>(), {\n\torder: 0,\n});\n\ndefineSlots<Slots>();\n\nconst dialog = useTopDialogSelf();\n\nconst classes = computed(() => {\n\treturn {\n\t\tactive: dialog.pageActive?.value === props.name,\n\t\t'i-load-data': props.isLoading || dialog.isLoadingPage.value,\n\t};\n});\n</script>\n\n<template>\n\t<div\n\t\tstyle=\"display: none\"\n\t\tv-if=\"dialog.isReady.value\"\n\t>\n\t\t<Teleport :to=\"'#' + dialog.idAttr + ' .modal-layer-header'\" :disabled=\"!dialog.needShowPage(name)\">\n\t\t\t<div\n\t\t\t\t:data-order=\"order\"\n\t\t\t\t:data-view-page=\"name\"\n\t\t\t\t:class=\"classes\"\n\t\t\t>\n\t\t\t\t<div class=\"modal-header\">\n\t\t\t\t\t<div class=\"top-title\">\n\t\t\t\t\t\t<slot name=\"header\"></slot>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div class=\"buttons\">\n\t\t\t\t\t\t<slot name=\"headerButtons\"></slot>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div\n\t\t\t\t\t\tv-if=\"Core.state.isMobile && prevName\"\n\t\t\t\t\t\tclass=\"close\"\n\t\t\t\t\t\t:title=\"$i18n.Common.Back\"\n\t\t\t\t\t\tdata-top-icon=\"\"\n\t\t\t\t\t\t@click=\"dialog.open(prevName)\"\n\t\t\t\t\t></div>\n\n\t\t\t\t\t<div\n\t\t\t\t\t\tv-else\n\t\t\t\t\t\tclass=\"close\"\n\t\t\t\t\t\t:title=\"$i18n.Common.Close\"\n\t\t\t\t\t\tdata-top-icon=\"\"\n\t\t\t\t\t\tdata-action=\"top-dialog-close\"\n\t\t\t\t\t></div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</Teleport>\n\n\t\t<Teleport :to=\"'#' + dialog.idAttr + ' .modal-layer-body'\" :disabled=\"!dialog.needShowPage(name)\">\n\t\t\t<div\n\t\t\t\t:data-order=\"order\"\n\t\t\t\t:data-view-page=\"name\"\n\t\t\t\tclass=\"has_scroll_container\"\n\t\t\t\t:class=\"classes\"\n\t\t\t\t:style=\"{'--top-dialog-footer-height': $slots.footer ? undefined : '0px'}\"\n\t\t\t>\n\t\t\t\t<div class=\"modal-body\" v-top-scroll-shadow>\n\t\t\t\t\t<slot name=\"body\"></slot>\n\t\t\t\t</div>\n\n\t\t\t\t<div\n\t\t\t\t\tclass=\"modal-footer\"\n\t\t\t\t\t:class=\"{\n\t\t\t\t\t\t'modal-footer-fullWith': footerFullWith\n\t\t\t\t\t}\"\n\t\t\t\t\tv-if=\"$slots.footer\"\n\t\t\t\t>\n\t\t\t\t\t<slot name=\"footer\"></slot>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</Teleport>\n\t</div>\n</template>\n"],"names":["dialog","getDialogWorker","__props","provide","onMounted","topDialogBaseComponent","getCurrentInstance","topDialogComponent","watch","_createElementBlock","_unref","_normalizeClass","_normalizeStyle","_createElementVNode","_renderSlot","_ctx","props","useTopDialogSelf","classes","computed","_openBlock","_hoisted_1","_createBlock","_Teleport","_hoisted_3","_hoisted_4","_hoisted_5","Core","$i18n","_cache","$event","$slots","_withDirectives","_hoisted_9"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,UAAMA,IAASC,EAXDC,EAWuB,EAAE;AACvC,QAAI,CAACF;AACJ,YAAM,IAAI,MAAM,kFAAkF;AAMnG,WAAAG,EAAQ,gBAAgBH,CAAM,GAK9BI,EAAU,MAAM;AACf,YAAMC,IAAyBC,EAAA,GACzBC,IAAqBF,EAAuB;AAElD,UAAIE,GAAoB,QAAQ,KAAK,SAAS;AAC7C,cAAM,IAAI,MAAM,4DAA4D;AAG7E,UAAI,MAAM,QAAQA,EAAmB,QAAQ,QAAQ,KAAKA,EAAmB,QAAQ,SAAS,WAAW;AACxG,cAA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