@topvisor/ui 1.5.0-updates.1 → 1.5.0-updates.7
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/api-CawzY1Cw.amd.js +1 -1
- package/.chunks/api-CawzY1Cw.amd.js.map +1 -1
- package/.chunks/app-CCX-gNqz.amd.js +1 -1
- package/.chunks/app-CCX-gNqz.amd.js.map +1 -1
- package/.chunks/datepicker-BTkZOq7d.amd.js +1 -1
- package/.chunks/datepicker-BTkZOq7d.amd.js.map +1 -1
- package/.chunks/dialog-DeM4SApg.amd.js +1 -1
- package/.chunks/dialog-DeM4SApg.amd.js.map +1 -1
- package/.chunks/dialog_regionSelectorRegions-CYrmaDt3.amd.js +1 -1
- package/.chunks/dialog_regionSelectorRegions-CYrmaDt3.amd.js.map +1 -1
- package/.chunks/dialogs-CMrERMI7.amd.js +1 -1
- package/.chunks/dialogs-CMrERMI7.amd.js.map +1 -1
- package/.chunks/field-CjkpGeA7.amd.js +1 -1
- package/.chunks/field-CjkpGeA7.amd.js.map +1 -1
- package/.chunks/forms-CbUt-6Ff.amd.js +1 -1
- package/.chunks/forms-CbUt-6Ff.amd.js.map +1 -1
- package/.chunks/formsExt-CrTmBhja.amd.js +1 -1
- package/.chunks/formsExt-CrTmBhja.amd.js.map +1 -1
- package/.chunks/lazy-CGswTOPj.amd.js +1 -1
- package/.chunks/lazy-CGswTOPj.amd.js.map +1 -1
- package/.chunks/mocker-CwZe-g4N.amd.js +1 -1
- package/.chunks/mocker-CwZe-g4N.amd.js.map +1 -1
- package/.chunks/notice-CslVdVNm.amd.js +2 -2
- package/.chunks/notice-CslVdVNm.amd.js.map +1 -1
- package/.chunks/popup-DrByVU-k.amd.js +1 -1
- package/.chunks/popup-DrByVU-k.amd.js.map +1 -1
- package/.chunks/popup-dNrN-eKi.amd.js +1 -1
- package/.chunks/popup-dNrN-eKi.amd.js.map +1 -1
- package/.chunks/punycode.es6-B-5kB2YI.amd.js +1 -1
- package/.chunks/punycode.es6-B-5kB2YI.amd.js.map +1 -1
- package/.chunks/store-DuQpSSLL.amd.js +1 -1
- package/.chunks/store-DuQpSSLL.amd.js.map +1 -1
- package/.chunks/utils-BwiXsV0S.amd.js +1 -1
- package/.chunks/utils-BwiXsV0S.amd.js.map +1 -1
- package/.chunks/utils-Dd0MZgyw.amd.js +1 -1
- package/.chunks/utils-Dd0MZgyw.amd.js.map +1 -1
- package/.chunks/worker-Db8YrEHo.amd.js +1 -1
- package/.chunks/worker-Db8YrEHo.amd.js.map +1 -1
- package/api/additional.amd.js +1 -1
- package/api/additional.amd.js.map +1 -1
- package/api/index.amd.js +1 -1
- package/api/index.amd.js.map +1 -1
- package/charts/charts.amd.js +1 -1
- package/charts/charts.amd.js.map +1 -1
- package/core/app.amd.js +1 -1
- package/core/app.amd.js.map +1 -1
- package/dialog/dialog.amd.js +1 -1
- package/dialog/dialog.amd.js.map +1 -1
- package/extra/extra.amd.js +1 -1
- package/extra/extra.amd.js.map +1 -1
- package/forms/forms.amd.js +1 -1
- package/forms/forms.amd.js.map +1 -1
- package/forms/helpers.amd.js +1 -1
- package/forms/helpers.amd.js.map +1 -1
- package/formsExt/formsExt.amd.js +1 -1
- package/formsExt/formsExt.amd.js.map +1 -1
- package/icomoon/demo-files/demo.amd.js +1 -1
- package/icomoon/demo-files/demo.amd.js.map +1 -1
- package/icomoon/demo.amd.js +1 -1
- package/icomoon/demo.amd.js.map +1 -1
- package/layout/layout.amd.js +1 -1
- package/layout/layout.amd.js.map +1 -1
- package/package.json +1 -1
- package/popup/popup.amd.js +1 -1
- package/popup/popup.amd.js.map +1 -1
- package/popup/worker.amd.js +1 -1
- package/popup/worker.amd.js.map +1 -1
- package/project/project.amd.js +1 -1
- package/project/project.amd.js.map +1 -1
- package/project/project.js +166 -185
- package/project/project.js.map +1 -1
- package/src/src/components/project/groupSelector/folders/types.d.ts +1 -1
- package/src/src/components/project/groupSelector/folders/utils.d.ts +35 -400
- package/src/src/components/project/groupSelector/groupSelector.vue.d.ts +1 -1
- package/src/src/components/project/groupSelector/groups/types.d.ts +1 -1
- package/src/src/components/project/groupSelector/groups/utils.d.ts +44 -757
- package/src/src/components/project/projectSelector/utils.d.ts +40 -39
- package/tabs/tabs.amd.js +1 -1
- package/tabs/tabs.amd.js.map +1 -1
- package/tabsView/tabsView.amd.js +1 -1
- package/tabsView/tabsView.amd.js.map +1 -1
- package/utils/check.amd.js +1 -1
- package/utils/check.amd.js.map +1 -1
- package/utils/clipboard.amd.js +4 -4
- package/utils/clipboard.amd.js.map +1 -1
- package/utils/date.amd.js +1 -1
- package/utils/date.amd.js.map +1 -1
- package/utils/device.amd.js +1 -1
- package/utils/device.amd.js.map +1 -1
- package/utils/dom.amd.js +1 -1
- package/utils/dom.amd.js.map +1 -1
- package/utils/image.amd.js +1 -1
- package/utils/image.amd.js.map +1 -1
- package/utils/keyboard.amd.js +1 -1
- package/utils/keyboard.amd.js.map +1 -1
- package/utils/lodash.amd.js +1 -1
- package/utils/lodash.amd.js.map +1 -1
- package/utils/number.amd.js +1 -1
- package/utils/number.amd.js.map +1 -1
- package/utils/price.amd.js +1 -1
- package/utils/price.amd.js.map +1 -1
- package/utils/route.amd.js +1 -1
- package/utils/route.amd.js.map +1 -1
- package/utils/scroll.amd.js +1 -1
- package/utils/scroll.amd.js.map +1 -1
- package/utils/searchers.amd.js +1 -1
- package/utils/searchers.amd.js.map +1 -1
- package/utils/store.amd.js +1 -1
- package/utils/store.amd.js.map +1 -1
- package/utils/string.amd.js +1 -1
- package/utils/string.amd.js.map +1 -1
- package/utils/system.amd.js +1 -1
- package/utils/system.amd.js.map +1 -1
- package/utils/url.amd.js +2 -2
- package/utils/url.amd.js.map +1 -1
- package/src/src/components/project/groupSelector/utils.d.ts +0 -37
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
define([`require`,`exports`],function(e,t){"use strict";Object.defineProperty(t,`__esModule`,{value:!0}),t.querySerializer=t.postInWindow=t.formDataSerializer=t.dataToForm=void 0;var
|
|
1
|
+
define([`require`,`exports`],function(e,t){"use strict";if(n===void 0)var n=window.Vue;Object.defineProperty(t,`__esModule`,{value:!0}),t.querySerializer=t.postInWindow=t.formDataSerializer=t.dataToForm=void 0;var r=`__empty_arrays`,i=async(e,t,n)=>{let r=document.createElement(`form`);r.target=n,r.action=e,r.method=`post`,a(r,t),document.body.appendChild(r),r.submit(),r.remove()},a=(e,t)=>{let n=o(t);for(let[t,r]of n.entries()){if(r instanceof File)throw Error("Files can not be manual set in `HTMLFormElement`");let n=document.createElement(`input`);n.name=t,n.value=String(r),e.appendChild(n)}},o=(e,t=new FormData,n)=>{for(let[i,a]of Object.entries(e)){if(a==null)continue;let e=n?`${n}[${i}]`:i;switch(!0){case a instanceof File:t.append(e,a,a.name);break;case a instanceof FileList:for(let n=0;n<a.length;n++){let r=a.item(n);r&&t.append(e+`[]`,r,r.name)}break;case a instanceof Blob:t.append(e,a);break;case Array.isArray(a):if(a.length===0){t.append(r+`[]`,e);break}a.forEach((n,r)=>{o({[e+`[`+r+`]`]:n},t)});break;case a instanceof Date:t.append(e,a.toISOString());break;case typeof a==`object`:o(a,t,e);break;default:t.append(e,String(a))}}return t};t.postInWindow=i,t.dataToForm=a,t.formDataSerializer=o,t.querySerializer=e=>{let t=new URLSearchParams,n=(e,r)=>{if(r!=null){if(Array.isArray(r)){for(let[t,i]of Object.entries(r))n(`${e}[${t}]`,i);return}if(typeof r==`object`){for(let[t,i]of Object.entries(r))n(`${e}[${t}]`,i);return}t.append(e,String(r))}};for(let[t,r]of Object.entries(e))n(t,r);return t.toString()}});
|
|
2
2
|
//# sourceMappingURL=lazy-CGswTOPj.amd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[".chunks/lazy-CGswTOPj.esm.js","../../src/api/api/utils/lazy.ts"],"names":["exports","e","t","i","r","n","a"],"mappings":"AAAA,OAAO,CAAC,UAAW,UAAU,CAAE,SAAU,EAAS,EAAS,CCMrD,
|
|
1
|
+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function (require, exports) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n exports.querySerializer = exports.postInWindow = exports.formDataSerializer = exports.dataToForm = void 0;\n //#region src/api/api/utils/lazy.ts\n var e = \"__empty_arrays\", t = async (e, t, r) => {\n let i = document.createElement(\"form\");\n i.target = r, i.action = e, i.method = \"post\", n(i, t), document.body.appendChild(i), i.submit(), i.remove();\n }, n = (e, t) => {\n let n = r(t);\n for (let [t, r] of n.entries()) {\n if (r instanceof File)\n throw Error(\"Files can not be manual set in `HTMLFormElement`\");\n let n = document.createElement(\"input\");\n n.name = t, n.value = String(r), e.appendChild(n);\n }\n }, r = (t, n = new FormData(), i) => {\n for (let [a, o] of Object.entries(t)) {\n if (o == null)\n continue;\n let t = i ? `${i}[${a}]` : a;\n switch (!0) {\n case o instanceof File:\n n.append(t, o, o.name);\n break;\n case o instanceof FileList:\n for (let e = 0; e < o.length; e++) {\n let r = o.item(e);\n r && n.append(t + \"[]\", r, r.name);\n }\n break;\n case o instanceof Blob:\n n.append(t, o);\n break;\n case Array.isArray(o):\n if (o.length === 0) {\n n.append(e + \"[]\", t);\n break;\n }\n o.forEach((e, i) => {\n r({ [t + \"[\" + i + \"]\"]: e }, n);\n });\n break;\n case o instanceof Date:\n n.append(t, o.toISOString());\n break;\n case typeof o == \"object\":\n r(o, n, t);\n break;\n default: n.append(t, String(o));\n }\n }\n return n;\n }, i = (e) => {\n let t = new URLSearchParams(), n = (e, r) => {\n if (r != null) {\n if (Array.isArray(r)) {\n for (let [t, i] of Object.entries(r))\n n(`${e}[${t}]`, i);\n return;\n }\n if (typeof r == \"object\") {\n for (let [t, i] of Object.entries(r))\n n(`${e}[${t}]`, i);\n return;\n }\n t.append(e, String(r));\n }\n };\n for (let [t, r] of Object.entries(e))\n n(t, r);\n return t.toString();\n };\n exports.postInWindow = t;\n exports.dataToForm = n;\n exports.formDataSerializer = r;\n exports.querySerializer = i;\n});\n//# sourceMappingURL=lazy-CGswTOPj.esm.js.map\n","/**\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"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var __createBinding=this&&this.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,`default`,{enumerable:!0,value:t})}):function(e,t){e.default=t}),__importStar=this&&this.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},n(e)};return function(r){if(r&&r.__esModule)return r;var i={};if(r!=null)for(var a=n(r),o=0;o<a.length;o++)a[o]!==`default`&&__createBinding(i,r,a[o]);return __setModuleDefault(i,r),i}})();define([`require`,`exports`,`@faker-js/faker`],function(e,t,r){"use strict";Object.defineProperty(t,`__esModule`,{value:!0}),t.genMockResponse=void 0;var
|
|
1
|
+
var __createBinding=this&&this.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,`default`,{enumerable:!0,value:t})}):function(e,t){e.default=t}),__importStar=this&&this.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},n(e)};return function(r){if(r&&r.__esModule)return r;var i={};if(r!=null)for(var a=n(r),o=0;o<a.length;o++)a[o]!==`default`&&__createBinding(i,r,a[o]);return __setModuleDefault(i,r),i}})();define([`require`,`exports`,`@faker-js/faker`],function(e,t,r){"use strict";if(i===void 0)var i=window.Vue;Object.defineProperty(t,`__esModule`,{value:!0}),t.genMockResponse=void 0;var a=20,o=async(t,r,i,a)=>{if(t.delay){t.showLog&&console.log(`genMock pause`,t.delay);let{sleep:r}=await new Promise((t,n)=>{e([`../utils/system.amd`],t,n)}).then(__importStar),i=r(t.delay);a&&(i=Promise.race([i,new Promise((e,t)=>{a.addEventListener(`abort`,()=>{t(new DOMException(`The operation was aborted from API mocker.`,`AbortError`))})})])),await i}let o={result:s(t,r,i),errors:void 0,nextOffset:void 0,total:void 0};if(delete o.errors,delete o.nextOffset,delete o.total,Array.isArray(o.result)&&t.total&&i&&i.limit){t.useFilter&&(o.result=o.result.filter(e=>t.useFilter?.(e,i)));let e=i.offset??0;o.result.length>i.limit+e&&(o.nextOffset=i.limit+e,o.total=t.total),o.result=o.result.slice(e,e+i.limit)}return t.showLog&&console.log(`genMock complete`,o),o},s=(e,t,n)=>{let i=e.seed??0;if(i===-1&&(i=Math.random()),e.result instanceof Function)return r.faker.seed(i),l(e.result,0,t,n);if(Array.isArray(e.result)){let r=e.result[0],o=[],s=e.total??n?.limit??a;for(let e=0;e<s;e++)o.push(c(r,e,i,t,n));return o}return c(e.result,0,i,t,n)},c=(e,t,n,i,a)=>{let o={};for(let s in e){let c=e[s];i&&!i.includes(s)||(r.faker.seed(n+t),o[s]=l(c,t,i,a))}return o},l=(e,t=0,n,r)=>e(t,n,r);t.genMockResponse=o});
|
|
2
2
|
//# sourceMappingURL=mocker-CwZe-g4N.amd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[".chunks/mocker-CwZe-g4N.esm.js","../../src/api/api/mocker/index.ts"],"names":["k2","k","desc","m","o","v","\"default\"","ownKeys","ar","mod","result","i","exports","t","n","e","require","resolve_1","reject_1","a","r","s","faker_1","c"],"mappings":"AAAA,IAAI,gBAAmB,MAAQ,KAAK,kBAAqB,OAAO,QAAU,SAAS,EAAG,EAAG,EAAG,EAAI,CACxFA,IAAO,SAAW,EAAKC,GCCzB,IAAgBC,EAET,OAAkB,yBAK1BC,EAAAF,EAAA,EACQ,CAAAC,IAAO,QAAAA,EAAA,CAAAC,EA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B,EAAE,CACtD,GAAI,MAAM,QAAQU,EAAE,OAAO,CAAE,CACzB,IAAIC,EAAID,EAAE,OAAO,GAAIK,EAAI,EAAE,CAAE,EAAIL,EAAE,OAASV,GAAG,OAASS,EACxD,IAAK,IAAIA,EAAI,EAAGA,EAAI,EAAG,IACnBM,EAAE,KAAKR,EAAEI,EAAGF,EAAGQ,EAAGD,EAAGhB,EAAE,CAAC,CAC5B,OAAOe,EAEX,OAAOR,EAAEG,EAAE,OAAQ,EAAGO,EAAGD,EAAGhB,EAAE,EAC/BO,GAAK,EAAG,EAAG,EAAG,EAAG,IAAM,CACtB,IAAIU,EAAI,EAAE,CACV,IAAK,IAAIE,KAAKV,EAAG,CACb,IAAI,EAAIA,EAAEU,GACV,GAAK,CAAC,EAAE,SAASA,EAAE,GAAKD,EAAQ,MAAM,KAAKF,EAAIN,EAAE,CAAE,EAAES,GAAKJ,EAAE,EAAGL,EAAG,EAAGV,EAAE,EAE3E,OAAOiB,GACRF,GAAK,EAAG,EAAI,EAAG,EAAG,IAAM,EAAE,EAAG,EAAG,EAAE,CACrC,EAAQ,gBAAkBL,GAC5B","sourcesContent":["var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || (function () {\n var ownKeys = function(o) {\n ownKeys = Object.getOwnPropertyNames || function (o) {\n var ar = [];\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\n return ar;\n };\n return ownKeys(o);\n };\n return function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\n __setModuleDefault(result, mod);\n return result;\n };\n})();\ndefine([\"require\", \"exports\", \"@faker-js/faker\"], function (require, exports, faker_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n exports.genMockResponse = void 0;\n //#region src/api/api/mocker/index.ts\n var t = 20, n = async (e, t, n, i) => {\n if (e.delay) {\n e.showLog && console.log(\"genMock pause\", e.delay);\n let { sleep: t } = await new Promise((resolve_1, reject_1) => { require([\"../utils/system.js\"], resolve_1, reject_1); }).then(__importStar), n = t(e.delay);\n i && (n = Promise.race([n, new Promise((e, t) => {\n i.addEventListener(\"abort\", () => {\n t(new DOMException(\"The operation was aborted from API mocker.\", \"AbortError\"));\n });\n })])), await n;\n }\n let a = {\n result: r(e, t, n),\n errors: void 0,\n nextOffset: void 0,\n total: void 0\n };\n if (delete a.errors, delete a.nextOffset, delete a.total, Array.isArray(a.result) && e.total && n && n.limit) {\n e.useFilter && (a.result = a.result.filter((t) => e.useFilter?.(t, n)));\n let t = n.offset ?? 0;\n a.result.length > n.limit + t && (a.nextOffset = n.limit + t, a.total = e.total), a.result = a.result.slice(t, t + n.limit);\n }\n return e.showLog && console.log(\"genMock complete\", a), a;\n }, r = (n, r, o) => {\n let s = n.seed ?? 0;\n if (s === -1 && (s = Math.random()), n.result instanceof Function)\n return faker_1.faker.seed(s), a(n.result, 0, r, o);\n if (Array.isArray(n.result)) {\n let e = n.result[0], a = [], c = n.total ?? o?.limit ?? t;\n for (let t = 0; t < c; t++)\n a.push(i(e, t, s, r, o));\n return a;\n }\n return i(n.result, 0, s, r, o);\n }, i = (t, n, r, i, o) => {\n let s = {};\n for (let c in t) {\n let l = t[c];\n i && !i.includes(c) || (faker_1.faker.seed(r + n), s[c] = a(l, n, i, o));\n }\n return s;\n }, a = (e, t = 0, n, r) => e(t, n, r);\n exports.genMockResponse = n;\n});\n//# sourceMappingURL=mocker-CwZe-g4N.esm.js.map\n","import { faker } from '@faker-js/faker';\n\nconst DEFAULT_LIMIT = 20;\n\nexport const genMockResponse = async (\n\toptions: Api.Mocker.Options<any, any>,\n\tfields?: readonly string[],\n\tparams?: Api.Mocker.Params,\n\trequestInitSignal?: ReturnType<Api.ClientRequest<any>['abortByFingerprint']>,\n) => {\n\tif (options.delay) {\n\t\tif (options.showLog) {\n\t\t\tconsole.log('genMock pause', options.delay);\n\t\t}\n\n\t\tconst { sleep } = await import('@/core/utils/system');\n\n\t\tlet promise = sleep(options.delay);\n\n\t\tif (requestInitSignal) {\n\t\t\tpromise = Promise.race<void>([\n\t\t\t\tpromise,\n\n\t\t\t\t// обработчик отмены\n\t\t\t\tnew Promise((_resolve, reject) => {\n\t\t\t\t\trequestInitSignal.addEventListener('abort', () => {\n\t\t\t\t\t\treject(new DOMException('The operation was aborted from API mocker.', 'AbortError'));\n\t\t\t\t\t});\n\t\t\t\t}),\n\t\t\t]);\n\t\t}\n\n\t\tawait promise;\n\t}\n\n\tconst res = {\n\t\tresult: genMockResult(options, fields, params),\n\t\terrors: undefined,\n\t\tnextOffset: undefined as number | undefined,\n\t\ttotal: undefined as number | undefined,\n\t};\n\n\tdelete res.errors;\n\tdelete res.nextOffset;\n\tdelete res.total;\n\n\t// реализация `limit` и `offset`\n\tif (Array.isArray(res.result) && options.total && params && params.limit) {\n\t\tif (options.useFilter) {\n\t\t\tres.result = res.result.filter((resultItem) => options.useFilter?.(resultItem, params));\n\t\t}\n\n\t\tconst offset = params.offset ?? 0;\n\n\t\tif (res.result.length > params.limit + offset) {\n\t\t\tres.nextOffset = params.limit + offset;\n\t\t\tres.total = options.total;\n\t\t}\n\n\t\tres.result = res.result.slice(offset, offset + params.limit);\n\t}\n\n\tif (options.showLog) {\n\t\tconsole.log('genMock complete', res);\n\t}\n\n\treturn res;\n};\n\nexport const genMockResult = <Options extends Api.Mocker.Options<any, any>>(\n\toptions: Options,\n\tfields?: readonly string[],\n\tparams?: Api.Mocker.Params,\n): Api.Mocker.ToMockResult<Options['result']> => {\n\tlet seed: number | undefined = options.seed ?? 0;\n\tif (seed === -1) seed = Math.random();\n\n\tif (options.result instanceof Function) {\n\t\tfaker.seed(seed);\n\n\t\treturn genMockValue(options.result, 0, fields, params);\n\t}\n\n\tif (Array.isArray(options.result)) {\n\t\tconst genItem = options.result[0];\n\n\t\tconst result = [] as Api.Mocker.ToMockResult<Options['result']>;\n\n\t\t// для работы `useFilter()` применять `params.limit` можно только после применения фильтра\n\t\tconst total = options.total ?? params?.limit ?? DEFAULT_LIMIT;\n\n\t\tfor (let i = 0; i < total; i++) {\n\t\t\tresult.push(genMockItem(genItem, i, seed, fields, params));\n\t\t}\n\n\t\treturn result;\n\t}\n\n\treturn genMockItem(options.result, 0, seed, fields, params) as Api.Mocker.ToMockResult<Options['result']>;\n};\n\nexport const genMockItem = <T extends Api.Mocker.Item>(\n\tgenItem: T,\n\tn: number,\n\tseed: number,\n\tfields?: readonly string[],\n\tparams?: Api.Mocker.Params,\n): Api.Mocker.ToMockItem<T> => {\n\tconst item = {} as Api.Mocker.ToMockItem<T>;\n\n\tfor (const key in genItem) {\n\t\tconst genValue = genItem[key];\n\n\t\tif (fields && !fields.includes(key)) continue;\n\n\t\t// seed для генерации одного объекта всегда одинаковый\n\t\tfaker.seed(seed + n);\n\n\t\titem[key] = genMockValue(genValue, n, fields, params);\n\t}\n\n\treturn item;\n};\n\nexport const genMockValue = <T extends Api.Mocker.Value>(\n\tgenValue: T,\n\tn: number = 0,\n\tfields?: readonly string[],\n\tparams?: Api.Mocker.Params,\n): Api.Mocker.ToMockValue<T> => {\n\treturn genValue(n, fields, params);\n};\n"]}
|
|
1
|
+
{"version":3,"sources":[".chunks/mocker-CwZe-g4N.esm.js","../../src/api/api/mocker/index.ts"],"names":["k2","k","desc","m","o","v","\"default\"","ownKe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AE,OAAO,MAAMN,EAAGA,EAAIC,EAAE,MAAM,CAE/H,OAAOC,EAAE,SAAW,QAAQ,IAAI,mBAAoBI,EAAE,CAAEA,GACzDC,GAAK,EAAG,EAAG,IAAM,CAChB,IAAIC,EAAIP,EAAE,MAAQ,EAClB,GAAIO,IAAM,KAAO,EAAI,KAAK,QAAQ,EAAGP,EAAE,kBAAkB,SACrD,OAAOQ,EAAQ,MAAM,KAAKD,EAAE,CAAEF,EAAEL,EAAE,OAAQ,EAAGM,EAAGjB,EAAE,CACtD,GAAI,MAAM,QAAQW,EAAE,OAAO,CAAE,CACzB,IAAIC,EAAID,EAAE,OAAO,GAAIK,EAAI,EAAE,CAAEI,EAAIT,EAAE,OAASX,GAAG,OAASU,EACxD,IAAK,IAAIA,EAAI,EAAGA,EAAIU,EAAG,IACnBJ,EAAE,KAAKT,EAAEK,EAAGF,EAAGQ,EAAGD,EAAGjB,EAAE,CAAC,CAC5B,OAAOgB,EAEX,OAAOT,EAAEI,EAAE,OAAQ,EAAGO,EAAGD,EAAGjB,EAAE,EAC/BO,GAAK,EAAG,EAAG,EAAG,EAAG,IAAM,CACtB,IAAIW,EAAI,EAAE,CACV,IAAK,IAAIE,KAAKV,EAAG,CACb,IAAIW,EAAIX,EAAEU,GACV,GAAK,CAAC,EAAE,SAASA,EAAE,GAAKD,EAAQ,MAAM,KAAKF,EAAIN,EAAE,CAAE,EAAES,GAAKJ,EAAEK,EAAGV,EAAG,EAAGX,EAAE,EAE3E,OAAOkB,GACRF,GAAK,EAAG,EAAI,EAAG,EAAG,IAAM,EAAE,EAAG,EAAG,EAAE,CACrC,EAAQ,gBAAkBL,GAC5B","sourcesContent":["var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || (function () {\n var ownKeys = function(o) {\n ownKeys = Object.getOwnPropertyNames || function (o) {\n var ar = [];\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\n return ar;\n };\n return ownKeys(o);\n };\n return function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\n __setModuleDefault(result, mod);\n return result;\n };\n})();\ndefine([\"require\", \"exports\", \"@faker-js/faker\"], function (require, exports, faker_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n exports.genMockResponse = void 0;\n //#region src/api/api/mocker/index.ts\n var t = 20, n = async (e, t, n, i) => {\n if (e.delay) {\n e.showLog && console.log(\"genMock pause\", e.delay);\n let { sleep: t } = await new Promise((resolve_1, reject_1) => { require([\"../utils/system.js\"], resolve_1, reject_1); }).then(__importStar), n = t(e.delay);\n i && (n = Promise.race([n, new Promise((e, t) => {\n i.addEventListener(\"abort\", () => {\n t(new DOMException(\"The operation was aborted from API mocker.\", \"AbortError\"));\n });\n })])), await n;\n }\n let a = {\n result: r(e, t, n),\n errors: void 0,\n nextOffset: void 0,\n total: void 0\n };\n if (delete a.errors, delete a.nextOffset, delete a.total, Array.isArray(a.result) && e.total && n && n.limit) {\n e.useFilter && (a.result = a.result.filter((t) => e.useFilter?.(t, n)));\n let t = n.offset ?? 0;\n a.result.length > n.limit + t && (a.nextOffset = n.limit + t, a.total = e.total), a.result = a.result.slice(t, t + n.limit);\n }\n return e.showLog && console.log(\"genMock complete\", a), a;\n }, r = (n, r, o) => {\n let s = n.seed ?? 0;\n if (s === -1 && (s = Math.random()), n.result instanceof Function)\n return faker_1.faker.seed(s), a(n.result, 0, r, o);\n if (Array.isArray(n.result)) {\n let e = n.result[0], a = [], c = n.total ?? o?.limit ?? t;\n for (let t = 0; t < c; t++)\n a.push(i(e, t, s, r, o));\n return a;\n }\n return i(n.result, 0, s, r, o);\n }, i = (t, n, r, i, o) => {\n let s = {};\n for (let c in t) {\n let l = t[c];\n i && !i.includes(c) || (faker_1.faker.seed(r + n), s[c] = a(l, n, i, o));\n }\n return s;\n }, a = (e, t = 0, n, r) => e(t, n, r);\n exports.genMockResponse = n;\n});\n//# sourceMappingURL=mocker-CwZe-g4N.esm.js.map\n","import { faker } from '@faker-js/faker';\n\nconst DEFAULT_LIMIT = 20;\n\nexport const genMockResponse = async (\n\toptions: Api.Mocker.Options<any, any>,\n\tfields?: readonly string[],\n\tparams?: Api.Mocker.Params,\n\trequestInitSignal?: ReturnType<Api.ClientRequest<any>['abortByFingerprint']>,\n) => {\n\tif (options.delay) {\n\t\tif (options.showLog) {\n\t\t\tconsole.log('genMock pause', options.delay);\n\t\t}\n\n\t\tconst { sleep } = await import('@/core/utils/system');\n\n\t\tlet promise = sleep(options.delay);\n\n\t\tif (requestInitSignal) {\n\t\t\tpromise = Promise.race<void>([\n\t\t\t\tpromise,\n\n\t\t\t\t// обработчик отмены\n\t\t\t\tnew Promise((_resolve, reject) => {\n\t\t\t\t\trequestInitSignal.addEventListener('abort', () => {\n\t\t\t\t\t\treject(new DOMException('The operation was aborted from API mocker.', 'AbortError'));\n\t\t\t\t\t});\n\t\t\t\t}),\n\t\t\t]);\n\t\t}\n\n\t\tawait promise;\n\t}\n\n\tconst res = {\n\t\tresult: genMockResult(options, fields, params),\n\t\terrors: undefined,\n\t\tnextOffset: undefined as number | undefined,\n\t\ttotal: undefined as number | undefined,\n\t};\n\n\tdelete res.errors;\n\tdelete res.nextOffset;\n\tdelete res.total;\n\n\t// реализация `limit` и `offset`\n\tif (Array.isArray(res.result) && options.total && params && params.limit) {\n\t\tif (options.useFilter) {\n\t\t\tres.result = res.result.filter((resultItem) => options.useFilter?.(resultItem, params));\n\t\t}\n\n\t\tconst offset = params.offset ?? 0;\n\n\t\tif (res.result.length > params.limit + offset) {\n\t\t\tres.nextOffset = params.limit + offset;\n\t\t\tres.total = options.total;\n\t\t}\n\n\t\tres.result = res.result.slice(offset, offset + params.limit);\n\t}\n\n\tif (options.showLog) {\n\t\tconsole.log('genMock complete', res);\n\t}\n\n\treturn res;\n};\n\nexport const genMockResult = <Options extends Api.Mocker.Options<any, any>>(\n\toptions: Options,\n\tfields?: readonly string[],\n\tparams?: Api.Mocker.Params,\n): Api.Mocker.ToMockResult<Options['result']> => {\n\tlet seed: number | undefined = options.seed ?? 0;\n\tif (seed === -1) seed = Math.random();\n\n\tif (options.result instanceof Function) {\n\t\tfaker.seed(seed);\n\n\t\treturn genMockValue(options.result, 0, fields, params);\n\t}\n\n\tif (Array.isArray(options.result)) {\n\t\tconst genItem = options.result[0];\n\n\t\tconst result = [] as Api.Mocker.ToMockResult<Options['result']>;\n\n\t\t// для работы `useFilter()` применять `params.limit` можно только после применения фильтра\n\t\tconst total = options.total ?? params?.limit ?? DEFAULT_LIMIT;\n\n\t\tfor (let i = 0; i < total; i++) {\n\t\t\tresult.push(genMockItem(genItem, i, seed, fields, params));\n\t\t}\n\n\t\treturn result;\n\t}\n\n\treturn genMockItem(options.result, 0, seed, fields, params) as Api.Mocker.ToMockResult<Options['result']>;\n};\n\nexport const genMockItem = <T extends Api.Mocker.Item>(\n\tgenItem: T,\n\tn: number,\n\tseed: number,\n\tfields?: readonly string[],\n\tparams?: Api.Mocker.Params,\n): Api.Mocker.ToMockItem<T> => {\n\tconst item = {} as Api.Mocker.ToMockItem<T>;\n\n\tfor (const key in genItem) {\n\t\tconst genValue = genItem[key];\n\n\t\tif (fields && !fields.includes(key)) continue;\n\n\t\t// seed для генерации одного объекта всегда одинаковый\n\t\tfaker.seed(seed + n);\n\n\t\titem[key] = genMockValue(genValue, n, fields, params);\n\t}\n\n\treturn item;\n};\n\nexport const genMockValue = <T extends Api.Mocker.Value>(\n\tgenValue: T,\n\tn: number = 0,\n\tfields?: readonly string[],\n\tparams?: Api.Mocker.Params,\n): Api.Mocker.ToMockValue<T> => {\n\treturn genValue(n, fields, params);\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
define([`require`,`exports`,`./forms-CbUt-6Ff.amd
|
|
1
|
+
define([`require`,`exports`,`./forms-CbUt-6Ff.amd`,`../utils/string.amd`,`vue`,`../require/css.amd!../assets/notice.css`],function(e,t,n,r,i){"use strict";if(a===void 0)var a=window.Vue;Object.defineProperty(t,`__esModule`,{value:!0}),t.show=t.default=void 0;var o=(0,i.reactive)(new Map),s=(e,t,n)=>`top-notice_`+(0,r.genIntHash)(e+t+JSON.stringify(n)),c=(e,t=`info`,r)=>{let i=``;e=String(e);let a=s(e,t,r);if(r?.title)i=r.title;else{let t=e.split(`
|
|
2
2
|
`);t.length&&(i=String(t.shift()),e=t.join(`
|
|
3
|
-
`))}let
|
|
3
|
+
`))}let c=o.get(a);if(c){l(c);return}let d={id:a,title:i,text:e,style:t,buttonProps:r?.buttonProps,buttonsProps:r?.buttonsProps,metaText:r?.metaText,isSafeHTML:r?.isSafeHTML,selectToClose:r?.selectToClose,onClose:r?.onClose};if(o.set(d.id,d),o.size>5){let[e,t]=[...o].at(0)||[];t&&u(t)}n.O.state.isMobile&&$(`input`).one(`click`,()=>u(d))},l=e=>{e.hightlight=!0,setTimeout(()=>e.hightlight=!1,300)},u=e=>{e.forceClosed=!0,setTimeout(()=>{e.onClose?.(),o.delete(e.id)},300)},d=e=>{let t=`hacking was detected`;return e=e.replace(/<script/g,t),e=e.replace(/<img/g,t),e=e.replace(/<iframe/g,t),e=e.replace(/javascript:/g,t),e=e.replace(/<[^>]+ (@|on)\w+=[^>]+>?/g,t),e},f={class:`top-notice_itemTextWrapper`},p=[`innerHTML`],m=[`innerHTML`],h={key:1,class:`top-notice_itemButtons`},g=[`innerHTML`],_=[`title`],v=(0,i.defineComponent)({__name:`item`,props:{id:{},title:{},text:{},style:{},metaText:{},buttonProps:{},buttonsProps:{},isSafeHTML:{type:Boolean},hightlight:{type:Boolean},selectToClose:{type:Boolean,default:!0},forceClosed:{type:Boolean}},emits:[`close`],setup(e,{emit:t}){let a=e,o=t,s=(0,i.ref)(!1);setTimeout(()=>s.value=!0,10);let c=(0,i.ref)(!1),l=(0,i.ref)(`right`),u=(0,i.computed)(()=>{let e=a.title.replace(/ {2}/g,` `);return a.isSafeHTML||(e=d(e)),e}),v=(0,i.computed)(()=>{let e=(0,r.nl2br)(a.text);return e=e.replace(/ {2}/g,` `),a.isSafeHTML||(e=d(e)),e}),y=e=>{c.value=!0,e&&(l.value=e),setTimeout(()=>o(`close`),300)},b=e=>{if(!a.selectToClose)return;let{tagName:t}=e.target;t===`A`&&y(),t===`BUTTON`&&y()},x={mounted:e=>{if(!n.O.state.isMobile||!n.O.$||!n.O.$.ui.draggable)return;let t=`right`;n.O.$(e).draggable({revert:!1,axis:`x`,drag:(e,n)=>{t=n.position.left>0?`right`:`left`},stop:(e,n)=>{y(t)}})}};return(t,n)=>{let r=(0,i.resolveComponent)(`TopButton`);return(0,i.withDirectives)(((0,i.openBlock)(),(0,i.createElementBlock)(`div`,{class:(0,i.normalizeClass)([`top-notice_item`,{[`top-notice_item-`+e.style]:!0,"top-notice_item-hightlight":e.hightlight,"top-notice_item-showed":s.value,"top-notice_item-closed":c.value||e.forceClosed,[`top-notice_item-closed_`+l.value]:c.value}]),onClick:b},[(0,i.createElementVNode)(`div`,f,[u.value?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,{key:0,class:`top-notice_itemTitle`,innerHTML:u.value},null,8,p)):(0,i.createCommentVNode)(``,!0),v.value?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,{key:1,class:`top-notice_itemText`,innerHTML:v.value},null,8,m)):(0,i.createCommentVNode)(``,!0)]),e.buttonProps?((0,i.openBlock)(),(0,i.createBlock)(r,(0,i.mergeProps)({key:0,class:`top-notice_itemButton`,size:`s`},e.buttonProps,{title:e.buttonProps.title,innerHTML:e.buttonProps.default,onClick:n[0]||=e=>y()}),null,16,[`title`,`innerHTML`])):(0,i.createCommentVNode)(``,!0),e.buttonsProps?.length?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,h,[((0,i.openBlock)(!0),(0,i.createElementBlock)(i.Fragment,null,(0,i.renderList)(e.buttonsProps,e=>((0,i.openBlock)(),(0,i.createBlock)(r,(0,i.mergeProps)({class:`top-notice_itemButton`,size:`s`},{ref_for:!0},e,{title:e.title,innerHTML:e.default,onClick:n[1]||=e=>y()}),null,16,[`title`,`innerHTML`]))),256))])):(0,i.createCommentVNode)(``,!0),e.metaText?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,{key:2,class:`top-notice_itemMetaText`,innerHTML:e.metaText},null,8,g)):(0,i.createCommentVNode)(``,!0),(0,i.createElementVNode)(`div`,{class:`top-notice_itemClose`,"data-top-icon":``,title:t.$i18n.Common.Close,onClick:n[2]||=()=>y()},null,8,_)],2)),[[x]])}}}),y={class:`top-notice`},b=(0,i.defineComponent)({__name:`notice`,setup(e){let t=e=>{e.onClose?.(),o.delete(e.id)};return(e,n)=>((0,i.openBlock)(),(0,i.createBlock)(i.Teleport,{to:`body`},[(0,i.createElementVNode)(`div`,y,[((0,i.openBlock)(!0),(0,i.createElementBlock)(i.Fragment,null,(0,i.renderList)((0,i.unref)(o),([e,n])=>((0,i.openBlock)(),(0,i.createBlock)(v,{key:n.id,id:n.id,title:n.title,text:n.text,style:(0,i.normalizeStyle)(n.style),buttonProps:n.buttonProps,buttonsProps:n.buttonsProps,metaText:n.metaText,isSafeHTML:n.isSafeHTML,forceClosed:n.forceClosed,hightlight:n.hightlight,onClose:e=>t(n)},null,8,[`id`,`title`,`text`,`style`,`buttonProps`,`buttonsProps`,`metaText`,`isSafeHTML`,`forceClosed`,`hightlight`,`onClose`]))),128))])]))}});t.show=c,t.default=b});
|
|
4
4
|
//# sourceMappingURL=notice-CslVdVNm.amd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[".chunks/notice-CslVdVNm.esm.js","../../src/components/core/notice/utils.ts","../../src/components/core/notice/item/item.vue","../../src/components/core/notice/notice.vue"],"names":["exports","x","vue_1","S","string_js_1","n","r","C","t","a","e","o","w","s","T","forms_CbUt_6Ff_esm_js_1","E","D","O","k","A","j","M","N","i","u","p","h","y","P","F"],"mappings":"AAAA,OAAO,CAAC,UAAW,UAAW,0BAA2B,yBAAsB,MAAK,0CAAC,CAAE,SAAU,EAAS,EAAS,EAAyB,EAAa,EAAO,CAC5J,aACA,OAAO,eAAeA,EAAS,aAAc,CAAE,MAAO,GAAM,CAAC,CCOpD,EAAW,KAAA,EAAS,QAAwB,IAEnD,GAsBL,IAAIC,GAAQ,EAAAC,EAAA,UAAA,IAAA,IAAA,CAAAC,GAAA,EAAA,EAAA,IAAA,eAAA,EAAAC,EAAA,YAAA,EAAAC,EAAA,KAAA,UAAAC,EAAA,CAAA,CAAAC,GAAA,EAAA,EAAA,OAAA,IAAA,CAEL,IAAO,EAAK,GAEb,EAAe,OAAqBC,EAAA,CAE7B,IAAAC,EACZN,EAAAK,EAAgBH,EAAA,EAAA,CACV,GAAA,GAAA,MACc,EAAA,EAAM,UAEf,CDjCD,IAAIK,EAAIF,EAAE,MAAM;EAAK,CCuCJE,EAAA,SAAO,EAAA,OAAAA,EAAA,OAAA,CAAA,CAAA,EAAAA,EAAA,KAAA;EAAA,EAEZ,IAAAC,EAAAV,EAAA,IAAAQ,EAAA,CAEtB,GAAAE,EAAA,CDtCUC,EAAED,EAAE,CCyCI,OAElB,IAAAE,EAAA,CACA,GAAAJ,EACA,MAAA,EACA,KAAsBD,EACtB,MAAuBH,EACb,YAAS,GAAA,YACnB,aAAqB,GAAA,aACrB,SAAwB,GAAA,SACf,WAAS,GAAA,WAClB,cAAA,GAAA,cAEY,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,EAAA,oBAAA,MAAA2B,EAAA,GAAA,EAAA3B,EAAA,WAAA,CAAA,EAAA,EAAA,EAAAA,EAAA,oBAAAA,EAAA,SAAA,MAAA,EAAAA,EAAA,aAAA,EAAAA,EAAA,OAAAD,EAAA,EAAA,CAAA,EAAA,OAAA,EAAAC,EAAA,YAAA,EAAA,EAAAA,EAAA,aAAAqB,EAAA,CACM,IAAA,EAAA,GACC,GAAA,EAAA,GACC,MAAA,EAAA,MACJ,KAAA,EAAA,KACE,OAAA,EAAArB,EAAA,gBAAA,EAAA,MAAA,CACC,YAAA,EAAA,YACD,aAAA,EAAA,aACM,SAAA,EAAA,SHgIJ,WAAY,EAAE,WACd,YAAa,EAAE,YACf,WAAY,EAAE,WACd,QAAU,GAAM,EAAE,EAAC,CACtB,CAAE,KAAM,EAAG,CACR,KACA,QACA,OACA,QACA,cACA,eACA,WACA,aACA,cACA,aACA,UACH,CAAC,EAAE,CAAE,IAAI,EAAE,CAAC,CAAC,CAAC,GAE9B,CAAC,CACF,EAAQ,KAAOK,EACf,EAAQ,QAAUuB,GACpB","sourcesContent":["define([\"require\", \"exports\", \"./forms-CbUt-6Ff.esm.js\", \"../utils/string.js\", \"vue\"], function (require, exports, forms_CbUt_6Ff_esm_js_1, string_js_1, vue_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n exports.show = exports.default = void 0;\n var x = (0, vue_1.reactive)(/* @__PURE__ */ new Map()), S = (e, n, r) => \"top-notice_\" + (0, string_js_1.genIntHash)(e + n + JSON.stringify(r)), C = (t, n = \"info\", r) => {\n let i = \"\";\n t = String(t);\n let a = S(t, n, r);\n if (r?.title)\n i = r.title;\n else {\n let e = t.split(\"\\n\");\n e.length && (i = String(e.shift()), t = e.join(\"\\n\"));\n }\n let o = x.get(a);\n if (o) {\n w(o);\n return;\n }\n let s = {\n id: a,\n title: i,\n text: t,\n style: n,\n buttonProps: r?.buttonProps,\n buttonsProps: r?.buttonsProps,\n metaText: r?.metaText,\n isSafeHTML: r?.isSafeHTML,\n selectToClose: r?.selectToClose,\n onClose: r?.onClose\n };\n if (x.set(s.id, s), x.size > 5) {\n let [e, t] = [...x].at(0) || [];\n t && T(t);\n }\n forms_CbUt_6Ff_esm_js_1.O.state.isMobile && $(\"input\").one(\"click\", () => T(s));\n }, w = (e) => {\n e.hightlight = !0, setTimeout(() => e.hightlight = !1, 300);\n }, T = (e) => {\n e.forceClosed = !0, setTimeout(() => {\n e.onClose?.(), x.delete(e.id);\n }, 300);\n }, E = (e) => {\n let t = \"hacking was detected\";\n return e = e.replace(/<script/g, t), e = e.replace(/<img/g, t), e = e.replace(/<iframe/g, t), e = e.replace(/javascript:/g, t), e = e.replace(/<[^>]+ (@|on)\\w+=[^>]+>?/g, t), e;\n }, D = { class: \"top-notice_itemTextWrapper\" }, O = [\"innerHTML\"], k = [\"innerHTML\"], A = {\n key: 1,\n class: \"top-notice_itemButtons\"\n }, j = [\"innerHTML\"], M = [\"title\"], N = /* @__PURE__ */ (0, vue_1.defineComponent)({\n __name: \"item\",\n props: {\n id: {},\n title: {},\n text: {},\n style: {},\n metaText: {},\n buttonProps: {},\n buttonsProps: {},\n isSafeHTML: { type: Boolean },\n hightlight: { type: Boolean },\n selectToClose: {\n type: Boolean,\n default: !0\n },\n forceClosed: { type: Boolean }\n },\n emits: [\"close\"],\n setup(t, { emit: i }) {\n let u = t, p = i, h = (0, vue_1.ref)(!1);\n setTimeout(() => h.value = !0, 10);\n let y = (0, vue_1.ref)(!1), x = (0, vue_1.ref)(\"right\"), S = (0, vue_1.computed)(() => {\n let e = u.title.replace(/ {2}/g, \" \");\n return u.isSafeHTML || (e = E(e)), e;\n }), C = (0, vue_1.computed)(() => {\n let e = (0, string_js_1.nl2br)(u.text);\n return e = e.replace(/ {2}/g, \" \"), u.isSafeHTML || (e = E(e)), e;\n }), w = (e) => {\n y.value = !0, e && (x.value = e), setTimeout(() => p(\"close\"), 300);\n }, T = (e) => {\n if (!u.selectToClose)\n return;\n let { tagName: t } = e.target;\n t === \"A\" && w(), t === \"BUTTON\" && w();\n }, N = { mounted: (t) => {\n if (!forms_CbUt_6Ff_esm_js_1.O.state.isMobile || !forms_CbUt_6Ff_esm_js_1.O.$ || !forms_CbUt_6Ff_esm_js_1.O.$.ui.draggable)\n return;\n let n = \"right\";\n forms_CbUt_6Ff_esm_js_1.O.$(t).draggable({\n revert: !1,\n axis: \"x\",\n drag: (e, t) => {\n n = t.position.left > 0 ? \"right\" : \"left\";\n },\n stop: (e, t) => {\n w(n);\n }\n });\n } };\n return (e, n) => {\n let i = (0, vue_1.resolveComponent)(\"TopButton\");\n return (0, vue_1.withDirectives)(((0, vue_1.openBlock)(), (0, vue_1.createElementBlock)(\"div\", {\n class: (0, vue_1.normalizeClass)([\"top-notice_item\", {\n [\"top-notice_item-\" + t.style]: !0,\n \"top-notice_item-hightlight\": t.hightlight,\n \"top-notice_item-showed\": h.value,\n \"top-notice_item-closed\": y.value || t.forceClosed,\n [\"top-notice_item-closed_\" + x.value]: y.value\n }]),\n onClick: T\n }, [\n (0, vue_1.createElementVNode)(\"div\", D, [S.value ? ((0, vue_1.openBlock)(), (0, vue_1.createElementBlock)(\"div\", {\n key: 0,\n class: \"top-notice_itemTitle\",\n innerHTML: S.value\n }, null, 8, O)) : (0, vue_1.createCommentVNode)(\"\", !0), C.value ? ((0, vue_1.openBlock)(), (0, vue_1.createElementBlock)(\"div\", {\n key: 1,\n class: \"top-notice_itemText\",\n innerHTML: C.value\n }, null, 8, k)) : (0, vue_1.createCommentVNode)(\"\", !0)]),\n t.buttonProps ? ((0, vue_1.openBlock)(), (0, vue_1.createBlock)(i, (0, vue_1.mergeProps)({\n key: 0,\n class: \"top-notice_itemButton\",\n size: \"s\"\n }, t.buttonProps, {\n title: t.buttonProps.title,\n innerHTML: t.buttonProps.default,\n onClick: n[0] ||= (e) => w()\n }), null, 16, [\"title\", \"innerHTML\"])) : (0, vue_1.createCommentVNode)(\"\", !0),\n t.buttonsProps?.length ? ((0, vue_1.openBlock)(), (0, vue_1.createElementBlock)(\"div\", A, [((0, vue_1.openBlock)(!0), (0, vue_1.createElementBlock)(vue_1.Fragment, null, (0, vue_1.renderList)(t.buttonsProps, (e) => ((0, vue_1.openBlock)(), (0, vue_1.createBlock)(i, (0, vue_1.mergeProps)({\n class: \"top-notice_itemButton\",\n size: \"s\"\n }, { ref_for: !0 }, e, {\n title: e.title,\n innerHTML: e.default,\n onClick: n[1] ||= (e) => w()\n }), null, 16, [\"title\", \"innerHTML\"]))), 256))])) : (0, vue_1.createCommentVNode)(\"\", !0),\n t.metaText ? ((0, vue_1.openBlock)(), (0, vue_1.createElementBlock)(\"div\", {\n key: 2,\n class: \"top-notice_itemMetaText\",\n innerHTML: t.metaText\n }, null, 8, j)) : (0, vue_1.createCommentVNode)(\"\", !0),\n (0, vue_1.createElementVNode)(\"div\", {\n class: \"top-notice_itemClose\",\n \"data-top-icon\": \"\",\n title: e.$i18n.Common.Close,\n onClick: n[2] ||= () => w()\n }, null, 8, M)\n ], 2)), [[N]]);\n };\n }\n }), P = { class: \"top-notice\" }, F = /* @__PURE__ */ (0, vue_1.defineComponent)({\n __name: \"notice\",\n setup(e) {\n let t = (e) => {\n e.onClose?.(), x.delete(e.id);\n };\n return (e, n) => ((0, vue_1.openBlock)(), (0, vue_1.createBlock)(vue_1.Teleport, { to: \"body\" }, [(0, vue_1.createElementVNode)(\"div\", P, [((0, vue_1.openBlock)(!0), (0, vue_1.createElementBlock)(vue_1.Fragment, null, (0, vue_1.renderList)((0, vue_1.unref)(x), ([e, n]) => ((0, vue_1.openBlock)(), (0, vue_1.createBlock)(N, {\n key: n.id,\n id: n.id,\n title: n.title,\n text: n.text,\n style: (0, vue_1.normalizeStyle)(n.style),\n buttonProps: n.buttonProps,\n buttonsProps: n.buttonsProps,\n metaText: n.metaText,\n isSafeHTML: n.isSafeHTML,\n forceClosed: n.forceClosed,\n hightlight: n.hightlight,\n onClose: (e) => t(n)\n }, null, 8, [\n \"id\",\n \"title\",\n \"text\",\n \"style\",\n \"buttonProps\",\n \"buttonsProps\",\n \"metaText\",\n \"isSafeHTML\",\n \"forceClosed\",\n \"hightlight\",\n \"onClose\"\n ]))), 128))])]));\n }\n });\n exports.show = C;\n exports.default = F;\n});\n//# sourceMappingURL=notice-CslVdVNm.esm.js.map\n","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"]}
|
|
1
|
+
{"version":3,"sources":[".chunks/notice-CslVdVNm.esm.js","../../src/components/core/notice/utils.ts","../../src/components/core/notice/item/item.vue","../../src/components/core/notice/notice.vue"],"names":["vue","exports","x","vue_1","S","string_js_1","n","r","C","t","e","o","w","s","T","forms_CbUt_6Ff_esm_js_1","E","D","O","k","A","j","M","N","i","u","p","h","y","P","F"],"mappings":"AAAA,OAAO,CAAC,UAAW,UAAW,uBAA2B,sBAAsB,MA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,CACC,YAAA,EAAA,YACD,aAAA,EAAA,aACM,SAAA,EAAA,SHgIJ,WAAY,EAAE,WACd,YAAa,EAAE,YACf,WAAY,EAAE,WACd,QAAU,GAAM,EAAE,EAAC,CACtB,CAAE,KAAM,EAAG,CACR,KACA,QACA,OACA,QACA,cACA,eACA,WACA,aACA,cACA,aACA,UACH,CAAC,EAAE,CAAE,IAAI,EAAE,CAAC,CAAC,CAAC,GAE9B,CAAC,CACF,EAAQ,KAAOK,EACf,EAAQ,QAAUsB,GACpB","sourcesContent":["define([\"require\", \"exports\", \"./forms-CbUt-6Ff.esm.js\", \"../utils/string.js\", \"vue\"], function (require, exports, forms_CbUt_6Ff_esm_js_1, string_js_1, vue_1) {\n \"use strict\";\n Object.defineProperty(exports, \"__esModule\", { value: true });\n exports.show = exports.default = void 0;\n var x = (0, vue_1.reactive)(/* @__PURE__ */ new Map()), S = (e, n, r) => \"top-notice_\" + (0, string_js_1.genIntHash)(e + n + JSON.stringify(r)), C = (t, n = \"info\", r) => {\n let i = \"\";\n t = String(t);\n let a = S(t, n, r);\n if (r?.title)\n i = r.title;\n else {\n let e = t.split(\"\\n\");\n e.length && (i = String(e.shift()), t = e.join(\"\\n\"));\n }\n let o = x.get(a);\n if (o) {\n w(o);\n return;\n }\n let s = {\n id: a,\n title: i,\n text: t,\n style: n,\n buttonProps: r?.buttonProps,\n buttonsProps: r?.buttonsProps,\n metaText: r?.metaText,\n isSafeHTML: r?.isSafeHTML,\n selectToClose: r?.selectToClose,\n onClose: r?.onClose\n };\n if (x.set(s.id, s), x.size > 5) {\n let [e, t] = [...x].at(0) || [];\n t && T(t);\n }\n forms_CbUt_6Ff_esm_js_1.O.state.isMobile && $(\"input\").one(\"click\", () => T(s));\n }, w = (e) => {\n e.hightlight = !0, setTimeout(() => e.hightlight = !1, 300);\n }, T = (e) => {\n e.forceClosed = !0, setTimeout(() => {\n e.onClose?.(), x.delete(e.id);\n }, 300);\n }, E = (e) => {\n let t = \"hacking was detected\";\n return e = e.replace(/<script/g, t), e = e.replace(/<img/g, t), e = e.replace(/<iframe/g, t), e = e.replace(/javascript:/g, t), e = e.replace(/<[^>]+ (@|on)\\w+=[^>]+>?/g, t), e;\n }, D = { class: \"top-notice_itemTextWrapper\" }, O = [\"innerHTML\"], k = [\"innerHTML\"], A = {\n key: 1,\n class: \"top-notice_itemButtons\"\n }, j = [\"innerHTML\"], M = [\"title\"], N = /* @__PURE__ */ (0, vue_1.defineComponent)({\n __name: \"item\",\n props: {\n id: {},\n title: {},\n text: {},\n style: {},\n metaText: {},\n buttonProps: {},\n buttonsProps: {},\n isSafeHTML: { type: Boolean },\n hightlight: { type: Boolean },\n selectToClose: {\n type: Boolean,\n default: !0\n },\n forceClosed: { type: Boolean }\n },\n emits: [\"close\"],\n setup(t, { emit: i }) {\n let u = t, p = i, h = (0, vue_1.ref)(!1);\n setTimeout(() => h.value = !0, 10);\n let y = (0, vue_1.ref)(!1), x = (0, vue_1.ref)(\"right\"), S = (0, vue_1.computed)(() => {\n let e = u.title.replace(/ {2}/g, \" \");\n return u.isSafeHTML || (e = E(e)), e;\n }), C = (0, vue_1.computed)(() => {\n let e = (0, string_js_1.nl2br)(u.text);\n return e = e.replace(/ {2}/g, \" \"), u.isSafeHTML || (e = E(e)), e;\n }), w = (e) => {\n y.value = !0, e && (x.value = e), setTimeout(() => p(\"close\"), 300);\n }, T = (e) => {\n if (!u.selectToClose)\n return;\n let { tagName: t } = e.target;\n t === \"A\" && w(), t === \"BUTTON\" && w();\n }, N = { mounted: (t) => {\n if (!forms_CbUt_6Ff_esm_js_1.O.state.isMobile || !forms_CbUt_6Ff_esm_js_1.O.$ || !forms_CbUt_6Ff_esm_js_1.O.$.ui.draggable)\n return;\n let n = \"right\";\n forms_CbUt_6Ff_esm_js_1.O.$(t).draggable({\n revert: !1,\n axis: \"x\",\n drag: (e, t) => {\n n = t.position.left > 0 ? \"right\" : \"left\";\n },\n stop: (e, t) => {\n w(n);\n }\n });\n } };\n return (e, n) => {\n let i = (0, vue_1.resolveComponent)(\"TopButton\");\n return (0, vue_1.withDirectives)(((0, vue_1.openBlock)(), (0, vue_1.createElementBlock)(\"div\", {\n class: (0, vue_1.normalizeClass)([\"top-notice_item\", {\n [\"top-notice_item-\" + t.style]: !0,\n \"top-notice_item-hightlight\": t.hightlight,\n \"top-notice_item-showed\": h.value,\n \"top-notice_item-closed\": y.value || t.forceClosed,\n [\"top-notice_item-closed_\" + x.value]: y.value\n }]),\n onClick: T\n }, [\n (0, vue_1.createElementVNode)(\"div\", D, [S.value ? ((0, vue_1.openBlock)(), (0, vue_1.createElementBlock)(\"div\", {\n key: 0,\n class: \"top-notice_itemTitle\",\n innerHTML: S.value\n }, null, 8, O)) : (0, vue_1.createCommentVNode)(\"\", !0), C.value ? ((0, vue_1.openBlock)(), (0, vue_1.createElementBlock)(\"div\", {\n key: 1,\n class: \"top-notice_itemText\",\n innerHTML: C.value\n }, null, 8, k)) : (0, vue_1.createCommentVNode)(\"\", !0)]),\n t.buttonProps ? ((0, vue_1.openBlock)(), (0, vue_1.createBlock)(i, (0, vue_1.mergeProps)({\n key: 0,\n class: \"top-notice_itemButton\",\n size: \"s\"\n }, t.buttonProps, {\n title: t.buttonProps.title,\n innerHTML: t.buttonProps.default,\n onClick: n[0] ||= (e) => w()\n }), null, 16, [\"title\", \"innerHTML\"])) : (0, vue_1.createCommentVNode)(\"\", !0),\n t.buttonsProps?.length ? ((0, vue_1.openBlock)(), (0, vue_1.createElementBlock)(\"div\", A, [((0, vue_1.openBlock)(!0), (0, vue_1.createElementBlock)(vue_1.Fragment, null, (0, vue_1.renderList)(t.buttonsProps, (e) => ((0, vue_1.openBlock)(), (0, vue_1.createBlock)(i, (0, vue_1.mergeProps)({\n class: \"top-notice_itemButton\",\n size: \"s\"\n }, { ref_for: !0 }, e, {\n title: e.title,\n innerHTML: e.default,\n onClick: n[1] ||= (e) => w()\n }), null, 16, [\"title\", \"innerHTML\"]))), 256))])) : (0, vue_1.createCommentVNode)(\"\", !0),\n t.metaText ? ((0, vue_1.openBlock)(), (0, vue_1.createElementBlock)(\"div\", {\n key: 2,\n class: \"top-notice_itemMetaText\",\n innerHTML: t.metaText\n }, null, 8, j)) : (0, vue_1.createCommentVNode)(\"\", !0),\n (0, vue_1.createElementVNode)(\"div\", {\n class: \"top-notice_itemClose\",\n \"data-top-icon\": \"\",\n title: e.$i18n.Common.Close,\n onClick: n[2] ||= () => w()\n }, null, 8, M)\n ], 2)), [[N]]);\n };\n }\n }), P = { class: \"top-notice\" }, F = /* @__PURE__ */ (0, vue_1.defineComponent)({\n __name: \"notice\",\n setup(e) {\n let t = (e) => {\n e.onClose?.(), x.delete(e.id);\n };\n return (e, n) => ((0, vue_1.openBlock)(), (0, vue_1.createBlock)(vue_1.Teleport, { to: \"body\" }, [(0, vue_1.createElementVNode)(\"div\", P, [((0, vue_1.openBlock)(!0), (0, vue_1.createElementBlock)(vue_1.Fragment, null, (0, vue_1.renderList)((0, vue_1.unref)(x), ([e, n]) => ((0, vue_1.openBlock)(), (0, vue_1.createBlock)(N, {\n key: n.id,\n id: n.id,\n title: n.title,\n text: n.text,\n style: (0, vue_1.normalizeStyle)(n.style),\n buttonProps: n.buttonProps,\n buttonsProps: n.buttonsProps,\n metaText: n.metaText,\n isSafeHTML: n.isSafeHTML,\n forceClosed: n.forceClosed,\n hightlight: n.hightlight,\n onClose: (e) => t(n)\n }, null, 8, [\n \"id\",\n \"title\",\n \"text\",\n \"style\",\n \"buttonProps\",\n \"buttonsProps\",\n \"metaText\",\n \"isSafeHTML\",\n \"forceClosed\",\n \"hightlight\",\n \"onClose\"\n ]))), 128))])]));\n }\n });\n exports.show = C;\n exports.default = F;\n});\n//# sourceMappingURL=notice-CslVdVNm.esm.js.map\n","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"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
define([`require`,`exports`,`./forms-CbUt-6Ff.amd.js`,`./worker-Db8YrEHo.amd.js`,`vue`,`../require/css.amd!../assets/popup.css`],function(e,t,n,r,i){"use strict";Object.defineProperty(t,`__esModule`,{value:!0}),t.t=t.s=t.r=t.o=t.n=t.i=t.c=t.a=void 0;var a=(0,i.defineComponent)({__name:`opener`,props:{id:{},pos:{default:`3`},notch:{type:Boolean,default:!0},openByFocusInput:{type:Boolean},openByHover:{type:Boolean},disabled:{type:Boolean},posBy:{default:`fixed`},data:{}},setup(e){let t=e,n=t.id||Math.random()+``,a;function o(e){setTimeout(()=>{a=e.nextElementSibling,a&&s(a)})}(0,i.onUpdated)(()=>{a&&s(a)});function s(e){e.dataset.topPopup=`#`+n;let i=!!e.dataset.topPopupDisabled;if(e.dataset.topPopupId=n,e.dataset.topPopupPos=t.pos,e.dataset.topPopupPosBy=t.posBy,e.dataset.topPopupNotch=t.notch?`true`:``,e.dataset.topPopupOpenByHover=t.openByHover?`true`:``,e.dataset.topPopupDisabled=t.disabled?`true`:``,e.__TopPopupOpenerProps=t,t.openByFocusInput&&e.classList.contains(`top-input`)){let n=e.querySelector(`input`);if(n.onfocus=()=>{e.dataset.topPopupDisabled||r.t.openByOpener(e)},t.disabled!==i&&n===document.activeElement){let n=r.t.getPopupFromOpener(e);!t.disabled&&!n&&r.t.openByOpener(e),t.disabled&&n&&n.close()}}}return(e,t)=>((0,i.openBlock)(),(0,i.createElementBlock)(i.Fragment,null,[(0,i.createElementVNode)(`template`,{ref:o}),(0,i.renderSlot)(e.$slots,`default`)],64))}}),o={key:0,class:`top-popup_header`},s={key:0,class:`top-as-a closer`},c={key:1,class:`top-popup_widget`},l={key:2,class:`top-popup_content`},u={key:4,class:`top-popup_footer`},d=[`href`],f=(0,i.defineComponent)({__name:`popup`,props:{id:{default:``},class:{},transitionDuration:{},footerSupportLink:{},pos:{default:`3`},notch:{type:Boolean,default:!0},openByFocusInput:{type:Boolean},openByHover:{type:Boolean},disabled:{type:Boolean},posBy:{default:`fixed`},data:{}},emits:[`open`,`close`,`scrollContentList`],setup(e,{expose:t,emit:f}){let p=e,m=f,h=p.id||`top-popup-id-`+Math.random(),g={id:h,popup:void 0};t(g);let _=(0,i.ref)(null),v=(0,i.ref)(null),y=(0,i.ref)(),b={onOpen:async e=>{e.elPopup&&(_.value=e.elPopup),e.elPopupInner&&(e.elPopupInner.innerText=``,v.value=e.elPopupInner),b.opened=!0,b.popup=e,g.popup=e,y.value=e.el.__TopPopupOpenerProps.data,m(`open`,{elPopup:e.elPopup,elPopupOpener:e.el,data:y.value})},onClose:e=>{v.value=null,b.opened=!1,b.popup=void 0,y.value=void 0,m(`close`,{elPopup:e.elPopup,elPopupOpener:e.el,data:e.el.__TopPopupOpenerProps.data})},classRef:(0,i.toRef)(p,`class`),opened:!1,popup:void 0,transitionDurationRef:(0,i.toRef)(p,`transitionDuration`)};return(0,i.watch)(()=>p.class,(e,t)=>{if(!_.value)return;let n=e?.split(` `)??[],r=(t?.split(` `)??[]).filter(e=>!n.includes(e));_.value.classList.remove(...r),_.value.classList.add(...n)}),r.t.regVueComponent(h,b),(0,i.onUnmounted)(()=>{r.t.unregVueComponent(h)}),(t,r)=>{let f=(0,i.resolveDirective)(`top-scroll-shadow`);return(0,i.openBlock)(),(0,i.createElementBlock)(i.Fragment,null,[t.$slots.opener?((0,i.openBlock)(),(0,i.createBlock)(a,{key:0,id:(0,i.unref)(h),pos:e.pos,posBy:e.posBy,notch:e.notch,openByFocusInput:e.openByFocusInput,openByHover:t.$core.state.isMobile||t.$core.state.isMobileUA?!1:e.openByHover,disabled:e.disabled},{default:(0,i.withCtx)(()=>[(0,i.renderSlot)(t.$slots,`opener`)]),_:3},8,[`id`,`pos`,`posBy`,`notch`,`openByFocusInput`,`openByHover`,`disabled`])):(0,i.createCommentVNode)(``,!0),v.value?((0,i.openBlock)(),(0,i.createBlock)(i.Teleport,{key:1,to:v.value},[t.$slots.header||t.$core.state.isMobile?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,o,[t.$core.state.isMobile?((0,i.openBlock)(),(0,i.createElementBlock)(`span`,s,(0,i.toDisplayString)(t.$i18n.Common.Close),1)):(0,i.createCommentVNode)(``,!0),(0,i.renderSlot)(t.$slots,`header`,{data:y.value})])):(0,i.createCommentVNode)(``,!0),t.$slots.widget?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,c,[(0,i.renderSlot)(t.$slots,`widget`)])):(0,i.createCommentVNode)(``,!0),t.$slots.content?(0,i.withDirectives)(((0,i.openBlock)(),(0,i.createElementBlock)(`div`,l,[(0,i.renderSlot)(t.$slots,`content`,{data:y.value})])),[[f]]):(0,i.createCommentVNode)(``,!0),t.$slots.contentList?(0,i.withDirectives)(((0,i.openBlock)(),(0,i.createElementBlock)(`ul`,{key:3,class:`top-popup_content`,onScroll:r[0]||=e=>t.$emit(`scrollContentList`,e)},[(0,i.renderSlot)(t.$slots,`contentList`,{data:y.value})],32)),[[f]]):(0,i.createCommentVNode)(``,!0),t.$slots.footer||e.footerSupportLink?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,u,[e.footerSupportLink?((0,i.openBlock)(),(0,i.createElementBlock)(`a`,{key:0,class:`top-popup_footerSupportLink`,href:e.footerSupportLink,target:`_blank`},[(0,i.createVNode)(n.d,{hint:``})],8,d)):(0,i.createCommentVNode)(``,!0),(0,i.renderSlot)(t.$slots,`footer`,{data:y.value})])):(0,i.createCommentVNode)(``,!0)],8,[`to`])):(0,i.createCommentVNode)(``,!0)],64)}}}),p={class:`top-popup_listItemActionsLabel top-ellipsis1`},m={class:`top-popup_listItemActions`},h=(0,i.defineComponent)({inheritAttrs:!1,__name:`listItem`,props:{type:{default:`button`},closeByClick:{type:Boolean,default:!0},attrs:{}},setup(e){let t=e;return(n,r)=>((0,i.openBlock)(),(0,i.createElementBlock)(`li`,{class:(0,i.normalizeClass)({"top-popup_liNoSelectable":t.type!==`button`})},[((0,i.openBlock)(),(0,i.createBlock)((0,i.resolveDynamicComponent)(n.$attrs.href?`a`:`div`),(0,i.mergeProps)({class:{"top-popup_listItem":!0,[`top-popup_listItem-`+t.type]:!!t.type,"top-popup_liastItem-withActions":n.$slots.actions,"top-popup-noCloser":!e.closeByClick,a:t.type===`button`}},{...n.$attrs,...e.attrs}),{default:(0,i.withCtx)(()=>[n.$slots.actions?((0,i.openBlock)(),(0,i.createElementBlock)(i.Fragment,{key:0},[(0,i.createElementVNode)(`div`,p,[(0,i.renderSlot)(n.$slots,`default`)]),(0,i.createElementVNode)(`div`,m,[(0,i.renderSlot)(n.$slots,`actions`)])],64)):(0,i.renderSlot)(n.$slots,`default`,{key:1})]),_:3},16,[`class`])),(0,i.renderSlot)(n.$slots,`buttons`)],2))}}),g=(0,i.defineComponent)({__name:`widgetInput`,props:(0,i.mergeModels)({modelValue:{},name:{},disabled:{type:Boolean},readonly:{type:Boolean},modificator:{},size:{},styling:{},isError:{type:Boolean},isLoading:{type:Boolean},icon:{},icon2:{},addCleaner:{type:Boolean,default:!0},title:{},captionType:{}},{modelValue:{default:``},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=(0,i.useModel)(e,`modelValue`);return(e,r)=>((0,i.openBlock)(),(0,i.createBlock)(n.c,(0,i.mergeProps)(e.$props,{modificator:`popupWidgetInput`,modelValue:t.value,"onUpdate:modelValue":r[0]||=e=>t.value=e}),null,16,[`modelValue`]))}}),_=(0,i.defineComponent)({__name:`popupAlert`,props:{submitText:{},id:{},class:{},transitionDuration:{},footerSupportLink:{},pos:{},notch:{type:Boolean},openByFocusInput:{type:Boolean},openByHover:{type:Boolean},disabled:{type:Boolean},posBy:{},data:{}},emits:[`open`,`close`,`scrollContentList`],setup(e){let{submitText:t,...r}=e;return(e,a)=>((0,i.openBlock)(),(0,i.createBlock)(f,(0,i.mergeProps)({class:`top-popupAlert`},r,{onOpen:a[0]||=t=>e.$emit(`open`,t),onClose:a[1]||=t=>e.$emit(`close`,t),onScrollContentList:a[2]||=(...t)=>e.$emit(`scrollContentList`,...t)}),(0,i.createSlots)({opener:(0,i.withCtx)(()=>[(0,i.renderSlot)(e.$slots,`opener`)]),footer:(0,i.withCtx)(()=>[(0,i.renderSlot)(e.$slots,`footer`),(0,i.createVNode)(n.h,null,{default:(0,i.withCtx)(()=>[(0,i.createTextVNode)((0,i.toDisplayString)((0,i.unref)(t)||e.$i18n.Common.Close),1)]),_:1})]),_:2},[e.$slots.header?{name:`header`,fn:(0,i.withCtx)(()=>[(0,i.renderSlot)(e.$slots,`header`)]),key:`0`}:void 0,e.$slots.default?{name:`content`,fn:(0,i.withCtx)(()=>[(0,i.renderSlot)(e.$slots,`default`)]),key:`1`}:void 0]),1040))}}),v=(0,i.defineComponent)({__name:`popupConfirm`,props:{cancelText:{},submitText:{},isWarning:{type:Boolean},id:{},class:{},transitionDuration:{},footerSupportLink:{},pos:{},notch:{type:Boolean},openByFocusInput:{type:Boolean},openByHover:{type:Boolean},disabled:{type:Boolean},posBy:{},data:{}},emits:[`open`,`close`,`scrollContentList`,`submit`],setup(e,{emit:t}){let r=e,a=t,o=(0,i.ref)(!1),s=()=>{o.value=!0,a(`submit`)},c=e=>{if(o.value){o.value=!1;return}a(`close`,e)},{submitText:l,cancelText:u,isWarning:d,...p}=r;return(e,t)=>((0,i.openBlock)(),(0,i.createBlock)(f,(0,i.mergeProps)({class:`top-popupConfirm`},p,{onOpen:t[0]||=t=>e.$emit(`open`,t),onClose:t[1]||=e=>c(e),onScrollContentList:t[2]||=(...t)=>e.$emit(`scrollContentList`,...t)}),(0,i.createSlots)({opener:(0,i.withCtx)(()=>[(0,i.renderSlot)(e.$slots,`opener`)]),footer:(0,i.withCtx)(()=>[(0,i.renderSlot)(e.$slots,`footer`),(0,i.createVNode)(n.h,{color:`theme`},{default:(0,i.withCtx)(()=>[(0,i.createTextVNode)((0,i.toDisplayString)((0,i.unref)(u)||e.$i18n.Common.Cancel),1)]),_:1}),(0,i.createVNode)(n.h,{onClick:s,color:(0,i.unref)(d)?`red`:`blue`},{default:(0,i.withCtx)(()=>[(0,i.createTextVNode)((0,i.toDisplayString)((0,i.unref)(l)||e.$i18n.Common.Continue),1)]),_:1},8,[`color`])]),_:2},[e.$slots.header?{name:`header`,fn:(0,i.withCtx)(()=>[(0,i.renderSlot)(e.$slots,`header`)]),key:`0`}:void 0,e.$slots.default?{name:`content`,fn:(0,i.withCtx)(()=>[(0,i.renderSlot)(e.$slots,`default`)]),key:`1`}:void 0]),1040))}}),y=(0,i.defineComponent)({__name:`popupPrompt`,props:{submitText:{},cancelText:{},defaultValue:{},id:{},class:{},transitionDuration:{},footerSupportLink:{},pos:{},notch:{type:Boolean},openByFocusInput:{type:Boolean},openByHover:{type:Boolean},disabled:{type:Boolean},posBy:{},data:{}},emits:[`open`,`close`,`scrollContentList`,`submit`],setup(e,{emit:t}){let r=e,a=t,o=()=>c.value=r.defaultValue??``,s=(0,i.ref)(!1),c=(0,i.ref)();(0,i.watch)(()=>r.defaultValue,()=>o(),{immediate:!0});let l=()=>{s.value=!0},u=e=>{if(s.value){s.value=!1,a(`submit`,c.value),o();return}o(),a(`close`,e)},{submitText:d,cancelText:p,defaultValue:m,...h}=r;return(e,t)=>((0,i.openBlock)(),(0,i.createBlock)(f,(0,i.mergeProps)({class:`top-popupPrompt`},h,{onOpen:t[1]||=t=>e.$emit(`open`,t),onClose:t[2]||=e=>u(e),onScrollContentList:t[3]||=(...t)=>e.$emit(`scrollContentList`,...t)}),(0,i.createSlots)({opener:(0,i.withCtx)(()=>[(0,i.renderSlot)(e.$slots,`opener`)]),footer:(0,i.withCtx)(()=>[(0,i.renderSlot)(e.$slots,`footer`),(0,i.createVNode)(n.h,{color:`theme`},{default:(0,i.withCtx)(()=>[(0,i.createTextVNode)((0,i.toDisplayString)((0,i.unref)(p)||e.$i18n.Common.Cancel),1)]),_:1}),(0,i.createVNode)(n.h,{onClick:l},{default:(0,i.withCtx)(()=>[(0,i.createTextVNode)((0,i.toDisplayString)((0,i.unref)(d)||e.$i18n.Common.OK),1)]),_:1})]),_:2},[e.$slots.header?{name:`header`,fn:(0,i.withCtx)(()=>[(0,i.renderSlot)(e.$slots,`header`)]),key:`0`}:void 0,e.$slots.default?{name:`content`,fn:(0,i.withCtx)(()=>[(0,i.renderSlot)(e.$slots,`default`),(0,i.createVNode)(g,{modelValue:c.value,"onUpdate:modelValue":t[0]||=e=>c.value=e,modelModifiers:{trim:!0}},null,8,[`modelValue`])]),key:`1`}:void 0]),1040))}}),b=(0,i.defineComponent)({__name:`popupHint`,props:{hint:{},id:{},class:{},transitionDuration:{},footerSupportLink:{},pos:{},notch:{type:Boolean},openByFocusInput:{type:Boolean},openByHover:{type:Boolean},disabled:{type:Boolean},posBy:{},data:{}},setup(e){let{hint:t,...r}=e;return(e,a)=>{let o=(0,i.resolveDirective)(`top-tooltip`);return(0,i.openBlock)(),(0,i.createBlock)(f,(0,i.mergeProps)({class:`top-popupHint`},r,{onOpen:a[0]||=t=>e.$emit(`open`,t),onClose:a[1]||=t=>e.$emit(`close`,t),onScrollContentList:a[2]||=(...t)=>e.$emit(`scrollContentList`,...t)}),(0,i.createSlots)({opener:(0,i.withCtx)(()=>[(0,i.withDirectives)((0,i.createVNode)(n.d,{hint:(0,i.unref)(t),class:`top-popupHint_opener`},null,8,[`hint`]),[[o]])]),_:2},[e.$slots.default?{name:`content`,fn:(0,i.withCtx)(()=>[(0,i.renderSlot)(e.$slots,`default`)]),key:`0`}:void 0]),1040)}}});t.c=a,t.s=f,t.o=h,t.a=g,t.i=_,t.r=v,t.n=y,t.t=b});
|
|
1
|
+
define([`require`,`exports`,`./forms-CbUt-6Ff.amd`,`./worker-Db8YrEHo.amd`,`vue`,`../require/css.amd!../assets/popup.css`],function(e,t,n,r,i){"use strict";if(a===void 0)var a=window.Vue;Object.defineProperty(t,`__esModule`,{value:!0}),t.t=t.s=t.r=t.o=t.n=t.i=t.c=t.a=void 0;var o=(0,i.defineComponent)({__name:`opener`,props:{id:{},pos:{default:`3`},notch:{type:Boolean,default:!0},openByFocusInput:{type:Boolean},openByHover:{type:Boolean},disabled:{type:Boolean},posBy:{default:`fixed`},data:{}},setup(e){let t=e,n=t.id||Math.random()+``,a;function o(e){setTimeout(()=>{a=e.nextElementSibling,a&&s(a)})}(0,i.onUpdated)(()=>{a&&s(a)});function s(e){e.dataset.topPopup=`#`+n;let i=!!e.dataset.topPopupDisabled;if(e.dataset.topPopupId=n,e.dataset.topPopupPos=t.pos,e.dataset.topPopupPosBy=t.posBy,e.dataset.topPopupNotch=t.notch?`true`:``,e.dataset.topPopupOpenByHover=t.openByHover?`true`:``,e.dataset.topPopupDisabled=t.disabled?`true`:``,e.__TopPopupOpenerProps=t,t.openByFocusInput&&e.classList.contains(`top-input`)){let n=e.querySelector(`input`);if(n.onfocus=()=>{e.dataset.topPopupDisabled||r.t.openByOpener(e)},t.disabled!==i&&n===document.activeElement){let n=r.t.getPopupFromOpener(e);!t.disabled&&!n&&r.t.openByOpener(e),t.disabled&&n&&n.close()}}}return(e,t)=>((0,i.openBlock)(),(0,i.createElementBlock)(i.Fragment,null,[(0,i.createElementVNode)(`template`,{ref:o}),(0,i.renderSlot)(e.$slots,`default`)],64))}}),s={key:0,class:`top-popup_header`},c={key:0,class:`top-as-a closer`},l={key:1,class:`top-popup_widget`},u={key:2,class:`top-popup_content`},d={key:4,class:`top-popup_footer`},f=[`href`],p=(0,i.defineComponent)({__name:`popup`,props:{id:{default:``},class:{},transitionDuration:{},footerSupportLink:{},pos:{default:`3`},notch:{type:Boolean,default:!0},openByFocusInput:{type:Boolean},openByHover:{type:Boolean},disabled:{type:Boolean},posBy:{default:`fixed`},data:{}},emits:[`open`,`close`,`scrollContentList`],setup(e,{expose:t,emit:a}){let p=e,m=a,h=p.id||`top-popup-id-`+Math.random(),g={id:h,popup:void 0};t(g);let _=(0,i.ref)(null),v=(0,i.ref)(null),y=(0,i.ref)(),b={onOpen:async e=>{e.elPopup&&(_.value=e.elPopup),e.elPopupInner&&(e.elPopupInner.innerText=``,v.value=e.elPopupInner),b.opened=!0,b.popup=e,g.popup=e,y.value=e.el.__TopPopupOpenerProps.data,m(`open`,{elPopup:e.elPopup,elPopupOpener:e.el,data:y.value})},onClose:e=>{v.value=null,b.opened=!1,b.popup=void 0,y.value=void 0,m(`close`,{elPopup:e.elPopup,elPopupOpener:e.el,data:e.el.__TopPopupOpenerProps.data})},classRef:(0,i.toRef)(p,`class`),opened:!1,popup:void 0,transitionDurationRef:(0,i.toRef)(p,`transitionDuration`)};return(0,i.watch)(()=>p.class,(e,t)=>{if(!_.value)return;let n=e?.split(` `)??[],r=(t?.split(` `)??[]).filter(e=>!n.includes(e));_.value.classList.remove(...r),_.value.classList.add(...n)}),r.t.regVueComponent(h,b),(0,i.onUnmounted)(()=>{r.t.unregVueComponent(h)}),(t,r)=>{let a=(0,i.resolveDirective)(`top-scroll-shadow`);return(0,i.openBlock)(),(0,i.createElementBlock)(i.Fragment,null,[t.$slots.opener?((0,i.openBlock)(),(0,i.createBlock)(o,{key:0,id:(0,i.unref)(h),pos:e.pos,posBy:e.posBy,notch:e.notch,openByFocusInput:e.openByFocusInput,openByHover:t.$core.state.isMobile||t.$core.state.isMobileUA?!1:e.openByHover,disabled:e.disabled},{default:(0,i.withCtx)(()=>[(0,i.renderSlot)(t.$slots,`opener`)]),_:3},8,[`id`,`pos`,`posBy`,`notch`,`openByFocusInput`,`openByHover`,`disabled`])):(0,i.createCommentVNode)(``,!0),v.value?((0,i.openBlock)(),(0,i.createBlock)(i.Teleport,{key:1,to:v.value},[t.$slots.header||t.$core.state.isMobile?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,s,[t.$core.state.isMobile?((0,i.openBlock)(),(0,i.createElementBlock)(`span`,c,(0,i.toDisplayString)(t.$i18n.Common.Close),1)):(0,i.createCommentVNode)(``,!0),(0,i.renderSlot)(t.$slots,`header`,{data:y.value})])):(0,i.createCommentVNode)(``,!0),t.$slots.widget?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,l,[(0,i.renderSlot)(t.$slots,`widget`)])):(0,i.createCommentVNode)(``,!0),t.$slots.content?(0,i.withDirectives)(((0,i.openBlock)(),(0,i.createElementBlock)(`div`,u,[(0,i.renderSlot)(t.$slots,`content`,{data:y.value})])),[[a]]):(0,i.createCommentVNode)(``,!0),t.$slots.contentList?(0,i.withDirectives)(((0,i.openBlock)(),(0,i.createElementBlock)(`ul`,{key:3,class:`top-popup_content`,onScroll:r[0]||=e=>t.$emit(`scrollContentList`,e)},[(0,i.renderSlot)(t.$slots,`contentList`,{data:y.value})],32)),[[a]]):(0,i.createCommentVNode)(``,!0),t.$slots.footer||e.footerSupportLink?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,d,[e.footerSupportLink?((0,i.openBlock)(),(0,i.createElementBlock)(`a`,{key:0,class:`top-popup_footerSupportLink`,href:e.footerSupportLink,target:`_blank`},[(0,i.createVNode)(n.d,{hint:``})],8,f)):(0,i.createCommentVNode)(``,!0),(0,i.renderSlot)(t.$slots,`footer`,{data:y.value})])):(0,i.createCommentVNode)(``,!0)],8,[`to`])):(0,i.createCommentVNode)(``,!0)],64)}}}),m={class:`top-popup_listItemActionsLabel top-ellipsis1`},h={class:`top-popup_listItemActions`},g=(0,i.defineComponent)({inheritAttrs:!1,__name:`listItem`,props:{type:{default:`button`},closeByClick:{type:Boolean,default:!0},attrs:{}},setup(e){let t=e;return(n,r)=>((0,i.openBlock)(),(0,i.createElementBlock)(`li`,{class:(0,i.normalizeClass)({"top-popup_liNoSelectable":t.type!==`button`})},[((0,i.openBlock)(),(0,i.createBlock)((0,i.resolveDynamicComponent)(n.$attrs.href?`a`:`div`),(0,i.mergeProps)({class:{"top-popup_listItem":!0,[`top-popup_listItem-`+t.type]:!!t.type,"top-popup_liastItem-withActions":n.$slots.actions,"top-popup-noCloser":!e.closeByClick,a:t.type===`button`}},{...n.$attrs,...e.attrs}),{default:(0,i.withCtx)(()=>[n.$slots.actions?((0,i.openBlock)(),(0,i.createElementBlock)(i.Fragment,{key:0},[(0,i.createElementVNode)(`div`,m,[(0,i.renderSlot)(n.$slots,`default`)]),(0,i.createElementVNode)(`div`,h,[(0,i.renderSlot)(n.$slots,`actions`)])],64)):(0,i.renderSlot)(n.$slots,`default`,{key:1})]),_:3},16,[`class`])),(0,i.renderSlot)(n.$slots,`buttons`)],2))}}),_=(0,i.defineComponent)({__name:`widgetInput`,props:(0,i.mergeModels)({modelValue:{},name:{},disabled:{type:Boolean},readonly:{type:Boolean},modificator:{},size:{},styling:{},isError:{type:Boolean},isLoading:{type:Boolean},icon:{},icon2:{},addCleaner:{type:Boolean,default:!0},title:{},captionType:{}},{modelValue:{default:``},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=(0,i.useModel)(e,`modelValue`);return(e,r)=>((0,i.openBlock)(),(0,i.createBlock)(n.c,(0,i.mergeProps)(e.$props,{modificator:`popupWidgetInput`,modelValue:t.value,"onUpdate:modelValue":r[0]||=e=>t.value=e}),null,16,[`modelValue`]))}}),v=(0,i.defineComponent)({__name:`popupAlert`,props:{submitText:{},id:{},class:{},transitionDuration:{},footerSupportLink:{},pos:{},notch:{type:Boolean},openByFocusInput:{type:Boolean},openByHover:{type:Boolean},disabled:{type:Boolean},posBy:{},data:{}},emits:[`open`,`close`,`scrollContentList`],setup(e){let{submitText:t,...r}=e;return(e,a)=>((0,i.openBlock)(),(0,i.createBlock)(p,(0,i.mergeProps)({class:`top-popupAlert`},r,{onOpen:a[0]||=t=>e.$emit(`open`,t),onClose:a[1]||=t=>e.$emit(`close`,t),onScrollContentList:a[2]||=(...t)=>e.$emit(`scrollContentList`,...t)}),(0,i.createSlots)({opener:(0,i.withCtx)(()=>[(0,i.renderSlot)(e.$slots,`opener`)]),footer:(0,i.withCtx)(()=>[(0,i.renderSlot)(e.$slots,`footer`),(0,i.createVNode)(n.h,null,{default:(0,i.withCtx)(()=>[(0,i.createTextVNode)((0,i.toDisplayString)((0,i.unref)(t)||e.$i18n.Common.Close),1)]),_:1})]),_:2},[e.$slots.header?{name:`header`,fn:(0,i.withCtx)(()=>[(0,i.renderSlot)(e.$slots,`header`)]),key:`0`}:void 0,e.$slots.default?{name:`content`,fn:(0,i.withCtx)(()=>[(0,i.renderSlot)(e.$slots,`default`)]),key:`1`}:void 0]),1040))}}),y=(0,i.defineComponent)({__name:`popupConfirm`,props:{cancelText:{},submitText:{},isWarning:{type:Boolean},id:{},class:{},transitionDuration:{},footerSupportLink:{},pos:{},notch:{type:Boolean},openByFocusInput:{type:Boolean},openByHover:{type:Boolean},disabled:{type:Boolean},posBy:{},data:{}},emits:[`open`,`close`,`scrollContentList`,`submit`],setup(e,{emit:t}){let r=e,a=t,o=(0,i.ref)(!1),s=()=>{o.value=!0,a(`submit`)},c=e=>{if(o.value){o.value=!1;return}a(`close`,e)},{submitText:l,cancelText:u,isWarning:d,...f}=r;return(e,t)=>((0,i.openBlock)(),(0,i.createBlock)(p,(0,i.mergeProps)({class:`top-popupConfirm`},f,{onOpen:t[0]||=t=>e.$emit(`open`,t),onClose:t[1]||=e=>c(e),onScrollContentList:t[2]||=(...t)=>e.$emit(`scrollContentList`,...t)}),(0,i.createSlots)({opener:(0,i.withCtx)(()=>[(0,i.renderSlot)(e.$slots,`opener`)]),footer:(0,i.withCtx)(()=>[(0,i.renderSlot)(e.$slots,`footer`),(0,i.createVNode)(n.h,{color:`theme`},{default:(0,i.withCtx)(()=>[(0,i.createTextVNode)((0,i.toDisplayString)((0,i.unref)(u)||e.$i18n.Common.Cancel),1)]),_:1}),(0,i.createVNode)(n.h,{onClick:s,color:(0,i.unref)(d)?`red`:`blue`},{default:(0,i.withCtx)(()=>[(0,i.createTextVNode)((0,i.toDisplayString)((0,i.unref)(l)||e.$i18n.Common.Continue),1)]),_:1},8,[`color`])]),_:2},[e.$slots.header?{name:`header`,fn:(0,i.withCtx)(()=>[(0,i.renderSlot)(e.$slots,`header`)]),key:`0`}:void 0,e.$slots.default?{name:`content`,fn:(0,i.withCtx)(()=>[(0,i.renderSlot)(e.$slots,`default`)]),key:`1`}:void 0]),1040))}}),b=(0,i.defineComponent)({__name:`popupPrompt`,props:{submitText:{},cancelText:{},defaultValue:{},id:{},class:{},transitionDuration:{},footerSupportLink:{},pos:{},notch:{type:Boolean},openByFocusInput:{type:Boolean},openByHover:{type:Boolean},disabled:{type:Boolean},posBy:{},data:{}},emits:[`open`,`close`,`scrollContentList`,`submit`],setup(e,{emit:t}){let r=e,a=t,o=()=>c.value=r.defaultValue??``,s=(0,i.ref)(!1),c=(0,i.ref)();(0,i.watch)(()=>r.defaultValue,()=>o(),{immediate:!0});let l=()=>{s.value=!0},u=e=>{if(s.value){s.value=!1,a(`submit`,c.value),o();return}o(),a(`close`,e)},{submitText:d,cancelText:f,defaultValue:m,...h}=r;return(e,t)=>((0,i.openBlock)(),(0,i.createBlock)(p,(0,i.mergeProps)({class:`top-popupPrompt`},h,{onOpen:t[1]||=t=>e.$emit(`open`,t),onClose:t[2]||=e=>u(e),onScrollContentList:t[3]||=(...t)=>e.$emit(`scrollContentList`,...t)}),(0,i.createSlots)({opener:(0,i.withCtx)(()=>[(0,i.renderSlot)(e.$slots,`opener`)]),footer:(0,i.withCtx)(()=>[(0,i.renderSlot)(e.$slots,`footer`),(0,i.createVNode)(n.h,{color:`theme`},{default:(0,i.withCtx)(()=>[(0,i.createTextVNode)((0,i.toDisplayString)((0,i.unref)(f)||e.$i18n.Common.Cancel),1)]),_:1}),(0,i.createVNode)(n.h,{onClick:l},{default:(0,i.withCtx)(()=>[(0,i.createTextVNode)((0,i.toDisplayString)((0,i.unref)(d)||e.$i18n.Common.OK),1)]),_:1})]),_:2},[e.$slots.header?{name:`header`,fn:(0,i.withCtx)(()=>[(0,i.renderSlot)(e.$slots,`header`)]),key:`0`}:void 0,e.$slots.default?{name:`content`,fn:(0,i.withCtx)(()=>[(0,i.renderSlot)(e.$slots,`default`),(0,i.createVNode)(_,{modelValue:c.value,"onUpdate:modelValue":t[0]||=e=>c.value=e,modelModifiers:{trim:!0}},null,8,[`modelValue`])]),key:`1`}:void 0]),1040))}}),x=(0,i.defineComponent)({__name:`popupHint`,props:{hint:{},id:{},class:{},transitionDuration:{},footerSupportLink:{},pos:{},notch:{type:Boolean},openByFocusInput:{type:Boolean},openByHover:{type:Boolean},disabled:{type:Boolean},posBy:{},data:{}},setup(e){let{hint:t,...r}=e;return(e,a)=>{let o=(0,i.resolveDirective)(`top-tooltip`);return(0,i.openBlock)(),(0,i.createBlock)(p,(0,i.mergeProps)({class:`top-popupHint`},r,{onOpen:a[0]||=t=>e.$emit(`open`,t),onClose:a[1]||=t=>e.$emit(`close`,t),onScrollContentList:a[2]||=(...t)=>e.$emit(`scrollContentList`,...t)}),(0,i.createSlots)({opener:(0,i.withCtx)(()=>[(0,i.withDirectives)((0,i.createVNode)(n.d,{hint:(0,i.unref)(t),class:`top-popupHint_opener`},null,8,[`hint`]),[[o]])]),_:2},[e.$slots.default?{name:`content`,fn:(0,i.withCtx)(()=>[(0,i.renderSlot)(e.$slots,`default`)]),key:`0`}:void 0]),1040)}}});t.c=o,t.s=p,t.o=g,t.a=_,t.i=v,t.r=y,t.n=b,t.t=x});
|
|
2
2
|
//# sourceMappingURL=popup-DrByVU-k.amd.js.map
|