@topvisor/ui 0.9.35-4 → 0.9.35
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/{datepicker-D_95vv2c.amd.js → datepicker-BG0u8UXv.amd.js} +3 -3
- package/.chunks/datepicker-BG0u8UXv.amd.js.map +1 -0
- package/.chunks/{datepicker-CcRVcC5P.es.js → datepicker-Dmeojg66.es.js} +24 -23
- package/.chunks/{datepicker-CcRVcC5P.es.js.map → datepicker-Dmeojg66.es.js.map} +1 -1
- package/.chunks/{forms-BZoPbSQt.es.js → forms-CPEVHoks.es.js} +388 -463
- package/.chunks/forms-CPEVHoks.es.js.map +1 -0
- package/.chunks/forms-oowSA2rF.amd.js +3 -0
- package/.chunks/forms-oowSA2rF.amd.js.map +1 -0
- package/.chunks/{listItem.vue_vue_type_script_setup_true_lang-4m2ZOlaP.amd.js → listItem.vue_vue_type_script_setup_true_lang-CkZHzNZU.amd.js} +2 -2
- package/.chunks/{listItem.vue_vue_type_script_setup_true_lang-4m2ZOlaP.amd.js.map → listItem.vue_vue_type_script_setup_true_lang-CkZHzNZU.amd.js.map} +1 -1
- package/.chunks/{listItem.vue_vue_type_script_setup_true_lang-C2uuAtpx.es.js → listItem.vue_vue_type_script_setup_true_lang-Dlm9Et7q.es.js} +20 -20
- package/.chunks/{listItem.vue_vue_type_script_setup_true_lang-C2uuAtpx.es.js.map → listItem.vue_vue_type_script_setup_true_lang-Dlm9Et7q.es.js.map} +1 -1
- package/.chunks/{menu-DDYYS64d.es.js → menu-CiQMMrnp.es.js} +34 -34
- package/.chunks/{menu-DDYYS64d.es.js.map → menu-CiQMMrnp.es.js.map} +1 -1
- package/.chunks/{menu-CNIQ9vFJ.amd.js → menu-SmyeSNWQ.amd.js} +2 -2
- package/.chunks/{menu-CNIQ9vFJ.amd.js.map → menu-SmyeSNWQ.amd.js.map} +1 -1
- package/.chunks/{popup-Bc6YggdE.es.js → popup-Bv_sxmoj.es.js} +21 -20
- package/.chunks/popup-Bv_sxmoj.es.js.map +1 -0
- package/.chunks/popup-ClvUyl7S.amd.js +441 -0
- package/.chunks/popup-ClvUyl7S.amd.js.map +1 -0
- package/core/app.amd.js +1 -1
- package/core/app.amd.js.map +1 -1
- package/core/app.js +2 -2
- package/core/app.js.map +1 -1
- package/core/core/core.d.ts +0 -40
- package/core/core.amd.js +1 -1
- package/core/core.js +1 -1
- package/core/utils/css.d.ts +43 -0
- package/forms/forms.amd.js +1 -1
- package/forms/forms.js +1 -1
- package/formsExt/formsExt.amd.js +1 -1
- package/formsExt/formsExt.js +58 -58
- package/package.json +1 -1
- package/popup/popup.amd.js +1 -1
- package/popup/popup.js +17 -17
- package/popup/worker.amd.js +1 -1
- package/popup/worker.js +2 -2
- package/project/project.amd.js +1 -1
- package/project/project.js +19 -19
- package/require/css.amd.js +4 -4
- package/tabs/tabs.amd.js +1 -1
- package/tabs/tabs.js +13 -13
- package/tabsView/tabsView.amd.js +1 -1
- package/tabsView/tabsView.js +44 -44
- package/utils/css.amd.js +2 -0
- package/utils/css.amd.js.map +1 -0
- package/utils/css.d.ts +1 -0
- package/utils/css.js +45 -0
- package/utils/css.js.map +1 -0
- package/utils/date.amd.js +1 -1
- package/utils/date.js +1 -1
- package/utils/device.amd.js +1 -1
- package/utils/device.js +1 -1
- package/utils/price.amd.js +1 -1
- package/utils/price.js +1 -1
- package/.chunks/datepicker-D_95vv2c.amd.js.map +0 -1
- package/.chunks/forms-BZoPbSQt.es.js.map +0 -1
- package/.chunks/forms-KR6uVX5Z.amd.js +0 -3
- package/.chunks/forms-KR6uVX5Z.amd.js.map +0 -1
- package/.chunks/popup-BFJ2eTTB.amd.js +0 -441
- package/.chunks/popup-BFJ2eTTB.amd.js.map +0 -1
- package/.chunks/popup-Bc6YggdE.es.js.map +0 -1
package/core/app.amd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
define(["require","exports","../.chunks/forms-
|
|
1
|
+
define(["require","exports","../.chunks/forms-oowSA2rF.amd","../.chunks/i18n-eDh3Aaw9.amd","vue","lodash","../utils/clipboard.amd","../utils/string.amd","../utils/route.amd"],function(_,c,a,u,g,v,I,L,w){"use strict";if(typeof g>"u")var g=window.Vue;const E={mounted:function(s,t){t.value.disabled||s.focus()}};let h;const y={mounted(s,t,e){const o=t.value||"top-sticky";h=new IntersectionObserver(n=>{let i=n[0].intersectionRatio<1;i&&t.modifiers.bottom&&n[0].intersectionRect.y===0&&(i=!1),s.classList.toggle(o,i)},{threshold:[1]}),h.observe(s)},unmounted(s,t,e){h==null||h.disconnect()}};let S=!1,l;const f=new Map,O=(s,t)=>{const{distance:e,percent:o}=s.directiveSwipUpOptions,n=s.getBoundingClientRect().top,i=t*o/100/e,r=(t-n)/i;r<=e?s.style.transform=`translateY(${e-r}px)`:s.style.transform="translateY(0px)"},k=s=>{let t=window.innerHeight;window.addEventListener("scroll",()=>{f.forEach(e=>O(e,t))},{passive:!0}),l=new IntersectionObserver(e=>{t=window.innerHeight,e.forEach(o=>{const n=o.target;if(o.intersectionRatio<.1?f.delete(n):f.set(n,n),o.intersectionRatio===0){const{distance:i}=n.directiveSwipUpOptions;n.style.transform=`translateY(${i}px)`}})},{threshold:.1})},C={mounted(s,t,e){var o,n;a.Core.state.isMobileUA||(s.directiveSwipUpOptions={distance:((o=t.value)==null?void 0:o.distance)??100,percent:((n=t.value)==null?void 0:n.percent)??30},S||(k(),S=!0),l.observe(s))},unmounted(s,t,e){f.delete(s),l==null||l.unobserve(s)}},m=s=>{var t,e;if(!((e=(t=a.Core.$)==null?void 0:t.ui)!=null&&e.tooltip)){console.info("Для работы v-top-tooltip требуется глобальная загрузка jQuery UI Tooltip");return}return a.Core.$(s)},b=(s,t)=>{var o;const e=s.value??{};return e.content??=(o=t.props)==null?void 0:o.title,e.content=String(e.content).replace(/\r\n|\r|\n/g,"<br>"),e.position??={my:"bottom-18px",at:"top center"},e},N={mounted(s,t,e){var o;(o=m(s))==null||o.tooltip(b(t,e))},updated(s,t,e,o){var r;const n=b(t,e),i=(r=m(s))==null?void 0:r.tooltip("instance");i&&(i.options={...i.options,...n})},unmounted(s,t,e){var o;(o=m(s))==null||o.tooltip("destroy")}},H={install:(s,t)=>{s.config.globalProperties.$core2=a.Core;for(const e in t)a.Core.state[e]=t[e];a.Core._setState(),s.directive("top-focus",E),s.directive("top-sticky",y),s.directive("top-swim-up",C),s.directive("top-tooltip",N),s.component("TopAvatar",a.TopAvatar),s.component("TopButton",a.TopButton$1),s.component("TopCheckbox",a.TopCheckbox),s.component("TopControlLabel",a.TopControlLabel),s.component("TopHint",a.TopHint),s.component("TopInput",a.TopInput$1),s.component("TopInputDate",a.TopInputDate),s.component("TopInputRange",a.TopInputRange),s.component("TopLoadbar",a.TopLoadbar),s.component("TopRadio",a.TopRadio),s.component("TopSelect",a.TopSelect),s.component("TopSwitcher",a.TopSwitcher),s.component("TopTextarea",a.TopTextarea)}};class P{#e;#t;#o;#n;#d;#s=[];#i=[];#p=[];#a=[];constructor(t){var o;this.#t=t.store,this.#e=this.#t.$id,this.#o=t.options.Page,this.#n=t.options.user,this.#d=t.options.Api,this.#s=t.options.tpaNamesUrlHash||[],this.#i=t.options.tpaNamesStorage||[],this.#p=t.options.tpaNamesStorageLocal||[],this.#a=t.options.tpaNamesGuestLink||[],t.store.genGuestLink=(n,i)=>this.genGuestLink(n,i),(o=this.#n.guest_data)!=null&&o.data||(this.#h(),this.#h(!0),this.#g()),this.#T(),this.#w();const e=v.debounce(()=>{this.#f(),this.#m()});t.store.$subscribe(e)}async genGuestLink(t,e){const o=this.#l();e=Object.assign(e,Object.fromEntries(o));const n=await this.#d.gen(t,"fetchColumn").call({},e);n!=null&&n.errors||(await I.setClipboard(n.result),alert("Link copied"))}#l(){const t=new Map;return this.#a.forEach(e=>{const o=L.camelToSnakeCase(e);t.set(o,this.#t[e])}),t}#r(t){if(Object.isFrozen(this))throw"Please, use setOptions only inner commit function";t.forEach((e,o)=>{const n=this.#t[o];if(e!=null&&e!=null&&e.constructor&&e.constructor===n.constructor){if(o.indexOf("date")===0&&!Array.isArray(e)){if(typeof e=="string"&&!/\d\d\d\d-\d\d-\d\d/.test(e))return}this.#t[o]=e}})}#u(t){const e=new Map;return t.forEach((o,n)=>{o!==null&&(o=JSON.stringify(o),e.set(n,o))}),e}#c(t){const e=new Map;return t.forEach((o,n)=>{if(!(o==null||o==="false")){try{if(typeof o=="string"&&!/^\d\d\d\d-\d\d-\d\d$/.test(o)&&(o=JSON.parse(o)),o==null||o==="false")return}catch{}e.set(n,o)}}),e}#g(){let t;try{t=JSON.parse(w.getHash(this.#e))}catch{}if(!t)return;const e=new Map;this.#s.forEach(n=>{const i=t[n];i&&e.set(n,i)});const o=this.#c(e);this.#r(o)}#f(){const t=new Map;this.#s.forEach(n=>{const i=this.#t[n];t.set(n,i)});const e=Object.fromEntries(t),o=JSON.stringify(e);w.setHash(this.#e,o)}#h(t=!1){const e=new Map;let o="state:"+this.#e;t&&(o="state:"+this.#e+":"+location.pathname),this.#i.forEach(i=>{const r=localStorage.getItem(o+":"+i);e.set(i,r)});const n=this.#c(e);this.#r(n)}#m(t=!1){const e=new Map;let o=this.#i,n="state:"+this.#e;t&&(o=this.#p,n="state:"+this.#e+":"+location.pathname),o.forEach(r=>{const d=this.#t[r];e.set(r,d)});const i=this.#u(e);o.forEach(r=>{const d=i.get(r);localStorage.setItem(n+":"+r,d)})}#T(){var i,r,d;const t=(r=(i=this.#n)==null?void 0:i.guest_data)==null?void 0:r.data;if(!t)return;this.#n.id===-1&&(this.#n.positionsReverseDates=t.positionsReverseDates);const e=new Map;this.#a.forEach(p=>{const T=t[p];e.set(p,T)});const o=this.#c(e);this.#r(o);const n=$(".mod_guest_title");if(((d=this.#t.competitorsIds)==null?void 0:d.length)===1&&this.#o.page.data.competitors){let p=this.#o.page.data.competitors.filter(T=>T.id===t.competitorsIds[0]);p.length&&($("a",n).attr("href","http://"+p[0].url),$("a",n).text(p[0].name))}}#w(){this.#t.regionsIndexes&&g.watch(this.#t,t=>{if(!t.length)return;t.forEach((n,i)=>t[i]=n);const e=TplProjectSelectorRegion.genSearchersMap(),o=[];e.forEach(n=>{n.regions.forEach(i=>{i.index!==-1&&o.push(i.index)})}),this.#t.regionsIndexes=t.filter(n=>o.includes(n))},{immediate:!0}),this.#t.competitorsIds&&g.watch(this.#t,t=>{if(!t.length)return;t.forEach((o,n)=>o[n]=o);const e=[this.#o.page.data.project.id];this.#o.page.data.project.competitors.forEach(o=>{o.on>=0&&e.push(o.id)}),this.#t.competitorsIds=t.filter(o=>e.includes(o))})}}const R=s=>{var e,o,n,i;const t=s;!((e=t.options.tpaNamesUrlHash)!=null&&e.length)&&!((o=t.options.tpaNamesStorage)!=null&&o.length)&&!((n=t.options.tpaNamesStorageLocal)!=null&&n.length)&&!((i=t.options.tpaNamesGuestLink)!=null&&i.length)||new P(t)};c.Core=a.Core,c.i18nPlugin=u.i18n,c.useI18n=u.useI18n,c.useI18nLang=u.useI18nLang,c.useI18nSetLang=u.useI18nSetLang,c.corePlugin=H,c.piniaTPAPlugin=R,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|
|
2
2
|
//# sourceMappingURL=app.amd.js.map
|
package/core/app.amd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.amd.js","sources":["../../src/core/directives/focus.ts","../../src/core/directives/sticky.ts","../../src/core/directives/swimUp.ts","../../src/core/directives/tooltip.ts","../../src/core/plugins/core.ts","../../src/core/plugins/piniaTPA.ts"],"sourcesContent":["import type { DirectiveBinding, ObjectDirective } from 'vue';\r\n\r\n/**\r\n * Фокусировка на элементе сразу после его отображения\r\n */\r\nconst focus = {\r\n\tmounted: function (el: HTMLElement, binding: DirectiveBinding) {\r\n\t\tif (!binding.value.disabled) el.focus();\r\n\t},\r\n} satisfies ObjectDirective;\r\n\r\nexport default focus;\r\n","import type { DirectiveBinding, ObjectDirective, VNode } from 'vue';\r\n\r\nlet appStickyObserver: IntersectionObserver;\r\n\r\n/**\r\n * Добавление sticky\r\n * К элементу добляется класс переданный как значение диррективы либо **'top-sticky'** по умолчанию\r\n */\r\nconst sticky = {\r\n\tmounted(el: HTMLElement, binding: DirectiveBinding, _vnode: VNode) {\r\n\t\tconst className = binding.value || 'top-sticky';\r\n\r\n\t\tappStickyObserver = new IntersectionObserver(entries => {\r\n\t\t\tlet condition = entries[0].intersectionRatio < 1;\r\n\t\t\tif (condition) {\r\n\t\t\t\tif (binding.modifiers.bottom && entries[0].intersectionRect.y === 0) condition = false;\r\n\t\t\t}\r\n\r\n\t\t\tel.classList.toggle(className, condition);\r\n\t\t}, {\r\n\t\t\tthreshold: [1],\r\n\t\t});\r\n\r\n\t\tappStickyObserver.observe(el);\r\n\t},\r\n\r\n\tunmounted(_el: HTMLElement, _binding: DirectiveBinding, _vnode: VNode) {\r\n\t\tappStickyObserver?.disconnect();\r\n\t},\r\n} satisfies ObjectDirective;\r\n\r\nexport default sticky;\r\n","import type { DirectiveBinding, ObjectDirective, VNode } from 'vue';\r\nimport Core from '@/core/core/core';\r\n\r\ninterface HTMLElementWithSwimUpOptions extends HTMLElement {\r\n\tdirectiveSwipUpOptions: {\r\n\t\tdistance: number,\r\n\t\tpercent: number,\r\n\t};\r\n}\r\n\r\nlet appSwimUpInited = false;\r\nlet appSwimUpObserver: IntersectionObserver;\r\nconst appSwimUpEls = new Map();\r\n\r\n/**\r\n * Отодвинуть блок в зависимости от скролла старинцы\r\n * @param el\r\n * @param windowHeight\r\n */\r\nconst swimUpElTransform = (el: HTMLElementWithSwimUpOptions, windowHeight: number): void => {\r\n\tconst { distance, percent } = el.directiveSwipUpOptions;\r\n\r\n\tconst elTop = el.getBoundingClientRect().top;\r\n\r\n\t// во столько раз triggerHeight должен быть меньше, чтобы закончить подплытие к нужной высоте экрана\r\n\tconst triggerHeightReducer = windowHeight * percent / 100 / distance;\r\n\tconst triggerHeight = (windowHeight - elTop) / triggerHeightReducer;\r\n\r\n\tif (triggerHeight <= distance) {\r\n\t\tel.style.transform = `translateY(${distance - triggerHeight}px)`;\r\n\t} else {\r\n\t\tel.style.transform = 'translateY(0px)';\r\n\t}\r\n};\r\n\r\nconst swimUpInit = (el: HTMLElementWithSwimUpOptions): void => {\r\n\tlet windowHeight = window.innerHeight;\r\n\r\n\twindow.addEventListener('scroll', () => {\r\n\t\tappSwimUpEls.forEach((el) => swimUpElTransform(el, windowHeight));\r\n\t}, { passive: true });\r\n\r\n\t// проверка того, что элемент в зоне видимости\r\n\tappSwimUpObserver = new IntersectionObserver(entries => {\r\n\t\twindowHeight = window.innerHeight;\r\n\r\n\t\tentries.forEach((entry) => {\r\n\t\t\tconst el = entry.target as HTMLElementWithSwimUpOptions;\r\n\r\n\t\t\tif (entry.intersectionRatio < 0.1) {\r\n\t\t\t\t// элемент за областью видимости\r\n\t\t\t\tappSwimUpEls.delete(el);\r\n\t\t\t} else {\r\n\t\t\t\t// элемент на экране\r\n\t\t\t\tappSwimUpEls.set(el, el);\r\n\t\t\t}\r\n\r\n\t\t\tif (entry.intersectionRatio === 0) {\r\n\t\t\t\tconst { distance } = el.directiveSwipUpOptions;\r\n\t\t\t\tel.style.transform = `translateY(${distance}px)`;\r\n\t\t\t}\r\n\t\t});\r\n\t}, {\r\n\t\tthreshold: 0.1,\r\n\t});\r\n};\r\n\r\n/**\r\n * Добавление анимации подплытия вверх для блока\r\n */\r\nconst swimUp = {\r\n\tmounted(el: HTMLElementWithSwimUpOptions, binding: DirectiveBinding, _vnode: VNode): void {\r\n\t\tif (Core.state.isMobileUA) return;\r\n\r\n\t\tel.directiveSwipUpOptions = {\r\n\t\t\tdistance: binding.value?.distance ?? 100, // количество px на которые блок изначально смещен вниз,\r\n\t\t\tpercent: binding.value?.percent ?? 30, // процент высоты экрана поднявшись на который блок закончит подплытие\r\n\t\t};\r\n\r\n\t\tif (!appSwimUpInited) {\r\n\t\t\tswimUpInit(el);\r\n\r\n\t\t\tappSwimUpInited = true;\r\n\t\t}\r\n\r\n\t\tappSwimUpObserver.observe(el);\r\n\t},\r\n\r\n\tunmounted(el: HTMLElementWithSwimUpOptions, _binding: DirectiveBinding, _vnode: VNode) {\r\n\t\tappSwimUpEls.delete(el);\r\n\t\tappSwimUpObserver?.unobserve(el);\r\n\t},\r\n} satisfies ObjectDirective;\r\n\r\nexport default swimUp;\r\n","import type { DirectiveBinding, ObjectDirective, VNode } from 'vue';\r\nimport Core from '@/core/core/core';\r\n\r\nconst $ = (el: VNode) => {\r\n\tif (!Core.$?.ui?.tooltip) {\r\n\t\tconsole.info('Для работы v-top-tooltip требуется глобальная загрузка jQuery UI Tooltip');\r\n\r\n\t\treturn;\r\n\t}\r\n\r\n\treturn Core.$(el);\r\n};\r\n\r\nconst tvTooltipGenOptions = (binding: DirectiveBinding, vnode: VNode) => {\r\n\tconst options = binding.value ?? {};\r\n\r\n\toptions.content ??= vnode.props?.title;\r\n\toptions.content = String(options.content).replace(/\\r\\n|\\r|\\n/g, '<br>');\r\n\r\n\toptions.position ??= {\r\n\t\tmy: 'bottom-18px',\r\n\t\tat: 'top center',\r\n\t};\r\n\r\n\treturn options;\r\n};\r\n\r\n/**\r\n * Добавление всплывающей подсказки к элементу.\r\n */\r\nconst tooltip = {\r\n\tmounted(el: VNode, binding: DirectiveBinding, vnode: VNode) {\r\n\t\t$(el)?.tooltip(tvTooltipGenOptions(binding, vnode));\r\n\t},\r\n\r\n\tupdated(el: VNode, binding: DirectiveBinding, vnode: VNode, _prevVnode: VNode) {\r\n\t\t/**\r\n\t\t * В результате обновления может быть открыто несколько тултипов поэтому изменить опции, без перерисовки тултипа\r\n\t\t */\r\n\t\tconst options = tvTooltipGenOptions(binding, vnode);\r\n\t\tconst instance = $(el)?.tooltip('instance') as { options: JQueryUI.TooltipOptions } | undefined;\r\n\t\tif (!instance) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tinstance.options = {\r\n\t\t\t...instance.options,\r\n\t\t\t...options,\r\n\t\t};\r\n\t},\r\n\r\n\tunmounted(el: VNode, _binding: DirectiveBinding, _vnode: VNode) {\r\n\t\t$(el)?.tooltip('destroy');\r\n\t},\r\n} satisfies ObjectDirective;\r\n\r\nexport default tooltip;","import type { Plugin } from 'vue';\r\nimport Core from '@/core/core/core';\r\nimport coreDefaultOptions from '@/core/core/options';\r\nimport * as Forms from '../../components/forms/forms';\r\nimport directiveFocus from '@/core/directives/focus';\r\nimport directiveSticky from '@/core/directives/sticky';\r\nimport directiveSwimUp from '@/core/directives/swimUp';\r\nimport directiveTooltip from '@/core/directives/tooltip';\r\n\r\ndeclare module 'vue' {\r\n\texport interface ComponentCustomProperties {\r\n\t\t/**\r\n\t\t * Статический класс с текущим состоянимем UI\r\n\t\t */\r\n\t\t$core: typeof Core;\r\n\t}\r\n\r\n\t/**\r\n\t * Обязательные компоненты UI\r\n\t *\r\n\t * Они подключаются через плагин и доступны без явного указания импорта\r\n\t */\r\n\texport interface GlobalComponents {\r\n\t\tTopAvatar: typeof Forms.TopAvatar;\r\n\t\tTopButton: typeof Forms.TopButton;\r\n\t\tTopCheckbox: typeof Forms.TopCheckbox;\r\n\t\tTopControlLabel: typeof Forms.TopControlLabel;\r\n\t\tTopHint: typeof Forms.TopHint;\r\n\t\tTopInput: typeof Forms.TopInput;\r\n\t\tTopInputDate: typeof Forms.TopInputDate;\r\n\t\tTopInputRange: typeof Forms.TopInputRange;\r\n\t\tTopRadio: typeof Forms.TopRadio;\r\n\t\tTopSwitcher: typeof Forms.TopSwitcher;\r\n\t\tTopTextarea: typeof Forms.TopTextarea;\r\n\t\tTopSelect: typeof Forms.TopSelect;\r\n\t\tTopLoadbar: typeof Forms.TopLoadbar;\r\n\t}\r\n}\r\n\r\ntype PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\r\n\r\ntype Options = PartialBy<typeof coreDefaultOptions, 'gmt'>;\r\n\r\n/**\r\n * Плагин для интеграции UI во Vue приложение\r\n *\r\n * - В глобальную область видимости шаблонов будет добавлен объект $core\r\n * - Будут зарегистрирвоаны директивы UI: https://ui.topvisor.com/?path=/docs/core-directives-focus--docs\r\n * - Будут подключены базовые компоненты UI/Forms: https://ui.topvisor.com/?path=/docs/components-forms-readme--docs\r\n */\r\nexport default {\r\n\r\n\tinstall: (app, options: Options) => {\r\n\t\tapp.config.globalProperties.$core = Core;\r\n\r\n\t\t// начальные настройки UI\r\n\t\tfor (const name in options) {\r\n\t\t\tCore.state[name] = options[name];\r\n\t\t}\r\n\r\n\t\tCore._setState();\r\n\r\n\t\t// определение директив\r\n\t\tapp.directive('top-focus', directiveFocus);\r\n\t\tapp.directive('top-sticky', directiveSticky);\r\n\t\tapp.directive('top-swim-up', directiveSwimUp);\r\n\t\tapp.directive('top-tooltip', directiveTooltip);\r\n\r\n\t\t// определение базовых компонентов\r\n\t\tapp.component('TopAvatar', Forms.TopAvatar);\r\n\t\tapp.component('TopButton', Forms.TopButton);\r\n\t\tapp.component('TopCheckbox', Forms.TopCheckbox);\r\n\t\tapp.component('TopControlLabel', Forms.TopControlLabel);\r\n\t\tapp.component('TopHint', Forms.TopHint);\r\n\t\tapp.component('TopInput', Forms.TopInput);\r\n\t\tapp.component('TopInputDate', Forms.TopInputDate);\r\n\t\tapp.component('TopInputRange', Forms.TopInputRange);\r\n\t\tapp.component('TopLoadbar', Forms.TopLoadbar);\r\n\t\tapp.component('TopRadio', Forms.TopRadio);\r\n\t\tapp.component('TopSelect', Forms.TopSelect);\r\n\t\tapp.component('TopSwitcher', Forms.TopSwitcher);\r\n\t\tapp.component('TopTextarea', Forms.TopTextarea);\r\n\r\n\t},\r\n\r\n} satisfies Plugin<Options>;\r\n","import type { PiniaPluginContext, Store } from 'pinia';\r\nimport { watch } from 'vue';\r\nimport { debounce } from 'lodash';\r\nimport { setClipboard } from '@/core/utils/clipboard';\r\nimport { camelToSnakeCase } from '@/core/utils/string.js';\r\nimport type { paths as OpenAPIPaths } from 'topvisor-openapi/src/ts/Topvisor';\r\nimport { getHash, setHash } from '@/core/utils/route';\r\n\r\ntype OpenAPIPath = keyof OpenAPIPaths;\r\n\r\nclass PiniaTPA {\r\n\r\n\treadonly #storeId: string;\r\n\treadonly #store: Store<'test', any>;\r\n\r\n\t/**\r\n\t * @deprecated\r\n\t */\r\n\treadonly #Page: any;\r\n\r\n\treadonly #user: any;\r\n\treadonly #Api: any;\r\n\r\n\treadonly #namesUrlHash: string[] = [];\r\n\treadonly #namesStorage: string[] = [];\r\n\treadonly #namesStorageLocal: string[] = [];\r\n\treadonly #namesGuestLink: string[] = [];\r\n\r\n\tconstructor(context: Context) {\r\n\t\tthis.#store = context.store;\r\n\t\tthis.#storeId = this.#store.$id;\r\n\r\n\t\tthis.#Page = context.options.Page;\r\n\r\n\t\tthis.#user = context.options.user;\r\n\t\tthis.#Api = context.options.Api;\r\n\r\n\t\tthis.#namesUrlHash = context.options.tpaNamesUrlHash || [];\r\n\t\tthis.#namesStorage = context.options.tpaNamesStorage || [];\r\n\t\tthis.#namesStorageLocal = context.options.tpaNamesStorageLocal || [];\r\n\t\tthis.#namesGuestLink = context.options.tpaNamesGuestLink || [];\r\n\r\n\t\tcontext.store.genGuestLink = <Path extends OpenAPIPath>(url: Path, data: any) => this.genGuestLink(url, data);\r\n\r\n\t\tif (!this.#user.guest_data?.data) {\r\n\t\t\tthis.#loadFromStorage();\r\n\t\t\tthis.#loadFromStorage(true);\r\n\r\n\t\t\t// настройки URL hash имеют приоритет\r\n\t\t\tthis.#loadFromHash();\r\n\t\t}\r\n\r\n\t\t// настройки гостевой ссылки имеют приоритет\r\n\t\tthis.#loadFromGuestLink();\r\n\r\n\t\tthis.#prepareParams();\r\n\r\n\t\tconst save = debounce(() => {\r\n\t\t\tthis.#saveInHash();\r\n\t\t\tthis.#saveInStorage();\r\n\t\t});\r\n\r\n\t\tcontext.store.$subscribe(save);\r\n\t}\r\n\r\n\t/**\r\n\t * Сгенерировать гостевую ссылку\r\n\t *\r\n\t * Метод, путь к которому указан в url, должен возвращать сгенерированную ссылку\r\n\t */\r\n\tasync genGuestLink<Path extends OpenAPIPath>(url: Path, data: any) {\r\n\t\tconst dataGuestLink = this.#genOptionsForGuestLink();\r\n\t\tdata = Object.assign(data, Object.fromEntries(dataGuestLink));\r\n\r\n\t\tconst res = await this.#Api.gen(url, 'fetchColumn').call({} as any, data);\r\n\r\n\t\t// @ts-ignore - метод, который скачивает файл не возвращает json\r\n\t\tif (res?.errors) return;\r\n\r\n\t\t// @ts-ignore - метод, который скачивает файл не возвращает json\r\n\t\tawait setClipboard(res.result);\r\n\r\n\t\t// TODO: Оформить через компонент messages\r\n\t\talert('Link copied');\r\n\t}\r\n\r\n\t/**\r\n\t * Сгенерировать опции для гостевой ссылки\r\n\t */\r\n\t#genOptionsForGuestLink() {\r\n\t\tconst data = new Map();\r\n\r\n\t\tthis.#namesGuestLink.forEach(name => {\r\n\t\t\t// формат параметров API: snake_case\r\n\t\t\tconst nameSnakeCase = camelToSnakeCase(name);\r\n\t\t\tdata.set(nameSnakeCase, this.#store[name]);\r\n\t\t});\r\n\r\n\t\treturn data;\r\n\t}\r\n\r\n\t/**\r\n\t * Установить опции из объекта без фиксации состояния\r\n\t */\r\n\t#setOptions(data: Map<string, any>) {\r\n\t\tif (Object.isFrozen(this)) throw 'Please, use setOptions only inner commit function';\r\n\r\n\t\tdata.forEach((value, name) => {\r\n\t\t\tconst currentValue = this.#store[name];\r\n\r\n\t\t\tif (value === null || value === undefined) return;\r\n\t\t\tif (!value?.constructor) return;\r\n\t\t\tif (value.constructor !== currentValue.constructor) return;\r\n\r\n\t\t\t// дополнительная проверка на формат даты\r\n\t\t\tif (name.indexOf('date') === 0) {\r\n\t\t\t\tif (Array.isArray(value)) {\r\n\t\t\t\t\t// value.forEach((valueI) => {\r\n\t\t\t\t\t// \tif (!/\\d\\d\\d\\d-\\d\\d-\\d\\d/.test(valueI)) return;\r\n\t\t\t\t\t// });\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (typeof (value) === 'string') {\r\n\t\t\t\t\t\tif (!/\\d\\d\\d\\d-\\d\\d-\\d\\d/.test(value)) return;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tthis.#store[name] = value;\r\n\t\t});\r\n\t}\r\n\r\n\t/**\r\n\t * Сгенерировать Map объект с опциями со значениями в виде json строк\r\n\t */\r\n\t#genDataFormat(data: Map<string, any>) {\r\n\t\tconst dataFormatted = new Map();\r\n\r\n\t\tdata.forEach((value, name) => {\r\n\t\t\tif (value === null) return;\r\n\r\n\t\t\tvalue = JSON.stringify(value);\r\n\r\n\t\t\tdataFormatted.set(name, value);\r\n\t\t});\r\n\r\n\t\treturn dataFormatted;\r\n\t}\r\n\r\n\t/**\r\n\t * Сгенерировать Map объект с опциями со значениями в оригинальном виде\r\n\t */\r\n\t#genDataUnFormat(dataFormatted: Map<string, string>) {\r\n\t\tconst data: Map<string, any> = new Map();\r\n\r\n\t\tdataFormatted.forEach((value, name) => {\r\n\t\t\tif (value === null || value === undefined || value === 'false') return;\r\n\r\n\t\t\ttry {\r\n\t\t\t\tif (typeof (value) === 'string' && !/^\\d\\d\\d\\d-\\d\\d-\\d\\d$/.test(value)) value = JSON.parse(value);\r\n\r\n\t\t\t\tif (value === null || value === undefined || value === 'false') return;\r\n\t\t\t} catch (e) {\r\n\t\t\t\t// не json строка\r\n\t\t\t}\r\n\r\n\t\t\tdata.set(name, value);\r\n\t\t});\r\n\r\n\t\treturn data;\r\n\t}\r\n\r\n\t/**\r\n\t * Установить опции из хеша адреса страницы\r\n\t */\r\n\t#loadFromHash() {\r\n\t\tlet dataHash: any;\r\n\t\ttry {\r\n\t\t\tdataHash = JSON.parse(getHash(this.#storeId));\r\n\t\t} catch (e) {\r\n\r\n\t\t}\r\n\t\tif (!dataHash) return;\r\n\r\n\t\tconst dataFormatted: Map<string, any> = new Map();\r\n\r\n\t\tthis.#namesUrlHash.forEach((name) => {\r\n\t\t\tconst value = dataHash[name];\r\n\t\t\tif (!value) return;\r\n\r\n\t\t\tdataFormatted.set(name, value);\r\n\t\t});\r\n\r\n\t\tconst data = this.#genDataUnFormat(dataFormatted);\r\n\r\n\t\tthis.#setOptions(data);\r\n\t}\r\n\r\n\t/**\r\n\t * Сохранить опции в хеш адреса страницы\r\n\t */\r\n\t#saveInHash() {\r\n\t\tconst data = new Map();\r\n\r\n\t\tthis.#namesUrlHash.forEach((name) => {\r\n\t\t\tconst value = this.#store[name];\r\n\r\n\t\t\tdata.set(name, value);\r\n\t\t});\r\n\r\n\t\tconst dataObject = Object.fromEntries(data);\r\n\t\tconst dataJSON = JSON.stringify(dataObject);\r\n\r\n\t\tsetHash(this.#storeId, dataJSON);\r\n\t};\r\n\r\n\t/**\r\n\t * Установить опции из localStorage\r\n\t * @param isLocal - сохранить с учетом адреса страницы\r\n\t */\r\n\t#loadFromStorage(isLocal = false) {\r\n\t\tconst dataFormatted = new Map();\r\n\r\n\t\t// let names = this.#namesStorage;\r\n\t\tlet storageNamespace = 'state:' + this.#storeId;\r\n\r\n\t\tif (isLocal) {\r\n\t\t\t// names = this.#namesStorageLocal;\r\n\t\t\tstorageNamespace = 'state:' + this.#storeId + ':' + location.pathname;\r\n\t\t}\r\n\r\n\t\tthis.#namesStorage.forEach((name) => {\r\n\t\t\tconst value = localStorage.getItem(storageNamespace + ':' + name);\r\n\t\t\tdataFormatted.set(name, value);\r\n\t\t});\r\n\r\n\t\tconst data = this.#genDataUnFormat(dataFormatted);\r\n\r\n\t\tthis.#setOptions(data);\r\n\t}\r\n\r\n\t/**\r\n\t * Сохранить опции в localStorage\r\n\t * @param isLocal - сохранить с учетом адреса страницы\r\n\t */\r\n\t#saveInStorage(isLocal = false) {\r\n\t\tconst data = new Map();\r\n\r\n\t\tlet names = this.#namesStorage;\r\n\t\tlet storageNamespace = 'state:' + this.#storeId;\r\n\r\n\t\tif (isLocal) {\r\n\t\t\tnames = this.#namesStorageLocal;\r\n\t\t\tstorageNamespace = 'state:' + this.#storeId + ':' + location.pathname;\r\n\t\t}\r\n\r\n\t\tnames.forEach((name) => {\r\n\t\t\tconst value = this.#store[name];\r\n\r\n\t\t\tdata.set(name, value);\r\n\t\t});\r\n\r\n\t\tconst dataFormatted = this.#genDataFormat(data);\r\n\r\n\t\tnames.forEach((name) => {\r\n\t\t\tconst value = dataFormatted.get(name);\r\n\r\n\t\t\tlocalStorage.setItem(storageNamespace + ':' + name, value);\r\n\t\t});\r\n\t}\r\n\r\n\t/**\r\n\t * Установить опции из гостевой ссылки\r\n\t */\r\n\t#loadFromGuestLink() {\r\n\t\tconst guestData = this.#user?.guest_data?.data;\r\n\t\tif (!guestData) return;\r\n\r\n\t\t// общие правила для гостевых сессий\r\n\t\tif (this.#user.id === -1) this.#user.positionsReverseDates = guestData.positionsReverseDates;\r\n\r\n\t\tconst dataFormatted = new Map();\r\n\r\n\t\tthis.#namesGuestLink.forEach((name) => {\r\n\t\t\tconst value = guestData[name];\r\n\t\t\tdataFormatted.set(name, value);\r\n\t\t});\r\n\r\n\t\tconst data = this.#genDataUnFormat(dataFormatted);\r\n\r\n\t\tthis.#setOptions(data);\r\n\r\n\t\tconst $guestTitle = $('.mod_guest_title');\r\n\r\n\t\t// TODO: вынести в опции плагина\r\n\t\tif (this.#store.competitorsIds?.length === 1 && this.#Page.page.data.competitors) {\r\n\t\t\tlet competitors = this.#Page.page.data.competitors.filter((competitor: any) => competitor.id === guestData.competitorsIds[0]);\r\n\t\t\tif (competitors.length) {\r\n\t\t\t\t$('a', $guestTitle).attr('href', 'http://' + competitors[0].url);\r\n\t\t\t\t$('a', $guestTitle).text(competitors[0].name);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Подготовить входные параметры перед инициализацией основного функционала\r\n\t *\r\n\t * Входные параметры устанавливаются при открытии страницы\r\n\t *\r\n\t * Входные параметры могут меняться пользоваталем и устаревать\r\n\t */\r\n\t#prepareParams() {\r\n\t\t// контролль за вводом регионов\r\n\t\t// TODO: вынести в опции плагина\r\n\t\tif (this.#store.regionsIndexes) {\r\n\t\t\twatch(this.#store, (regionsIndexes) => {\r\n\t\t\t\tif (!regionsIndexes.length) return;\r\n\r\n\t\t\t\t// приведение типа\r\n\t\t\t\tregionsIndexes.forEach((regionIndex: number, index: number) => regionsIndexes[index] = regionIndex);\r\n\r\n\t\t\t\t// оставить только включенные регионы\r\n\t\t\t\t// @ts-ignore\r\n\t\t\t\tconst mapSearchers = TplProjectSelectorRegion.genSearchersMap();\r\n\r\n\t\t\t\tconst availableRegionsIndexes: number[] = [];\r\n\t\t\t\tmapSearchers.forEach((searcher: any) => {\r\n\t\t\t\t\tsearcher.regions.forEach((region: any) => {\r\n\t\t\t\t\t\tif (region.index === -1) return;\r\n\r\n\t\t\t\t\t\tavailableRegionsIndexes.push(region.index);\r\n\t\t\t\t\t});\r\n\t\t\t\t});\r\n\r\n\t\t\t\tthis.#store.regionsIndexes = regionsIndexes.filter((regionIndex: number) => availableRegionsIndexes.includes(regionIndex));\r\n\t\t\t}, { immediate: true });\r\n\t\t}\r\n\r\n\t\t// контролль за вводом конкурентов\r\n\t\t// TODO: вынести в опции плагина\r\n\t\tif (this.#store.competitorsIds) {\r\n\t\t\twatch(this.#store, (competitorsIds) => {\r\n\t\t\t\tif (!competitorsIds.length) return;\r\n\r\n\t\t\t\t// приведение типа\r\n\t\t\t\tcompetitorsIds.forEach((competitorId: number, index: number) => competitorId[index] = competitorId);\r\n\r\n\t\t\t\t// оставить только включенных конкурентов\r\n\t\t\t\tconst availableCompetitorsIds = [this.#Page.page.data.project.id];\r\n\t\t\t\tthis.#Page.page.data.project.competitors.forEach((competitor: any) => {\r\n\t\t\t\t\tif (competitor.on >= 0) availableCompetitorsIds.push(competitor.id);\r\n\t\t\t\t});\r\n\r\n\t\t\t\tthis.#store.competitorsIds = competitorsIds.filter((competitorId: number) => availableCompetitorsIds.includes(competitorId));\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n}\r\n\r\ntype Options = {\r\n\t/**\r\n\t * TODO: Убрать из плагина\r\n\t */\r\n\tPage: any,\r\n\r\n\t/**\r\n\t * Объект с настройками пользователя\r\n\t */\r\n\tuser: any,\r\n\r\n\t/**\r\n\t * Объект для работы с API\r\n\t *\r\n\t * См. на айте: @/component/api/core/api.ts\r\n\t */\r\n\tApi: any;\r\n\r\n\t/**\r\n\t * Имена свойств для сохранения в URL\r\n\t */\r\n\ttpaNamesUrlHash?: string[],\r\n\r\n\t/**\r\n\t * Имена свойств для сохранения в localStorage\r\n\t */\r\n\ttpaNamesStorage?: string[],\r\n\r\n\t/**\r\n\t * Имена свойств для сохранения в localStorage с учетом пути URL\r\n\t *\r\n\t * Каждый URL будет работать со своим состоянием\r\n\t */\r\n\ttpaNamesStorageLocal?: string[],\r\n\r\n\t/**\r\n\t * Имена свойств для работы с гостевой ссылкой\r\n\t *\r\n\t * Для генерации гостевой ссылки используйте store.genGuestLink(data, url)\r\n\t */\r\n\ttpaNamesGuestLink?: string[],\r\n};\r\n\r\ntype Context = PiniaPluginContext & {\r\n\toptions: Options\r\n};\r\n\r\n/**\r\n * Плагин tpa (Third-party access) для pinia\r\n *\r\n * Добавляет возможность сохранять и загружать данные в/из:\r\n * \t- URL hash в адресе страницы\r\n * \t- localStorage\r\n * \t- гостевая ссылка\r\n *\r\n * Для подключения плагина нужно указань одну или несколько опций при определении defineStore():\r\n * - tpaNamesUrlHash\r\n * - tpaNamesStorage\r\n * - tpaNamesStorageLocal\r\n * - tpaNamesGuestLink\r\n */\r\nexport default (contextPinia: PiniaPluginContext) => {\r\n\tconst context = contextPinia as Context;\r\n\r\n\t// плагин подключать не нужно\r\n\tif (\r\n\t\t!context.options.tpaNamesUrlHash?.length &&\r\n\t\t!context.options.tpaNamesStorage?.length &&\r\n\t\t!context.options.tpaNamesStorageLocal?.length &&\r\n\t\t!context.options.tpaNamesGuestLink?.length\r\n\t) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tnew PiniaTPA(context);\r\n}\r\n"],"names":["focus","el","binding","appStickyObserver","sticky","_vnode","entries","_el","_binding","appSwimUpObserver","appSwimUpEls","swimUpElTransform","windowHeight","triggerHeight","distance","swimUpInit","el2","entry","swimUp","forms","$$1","tvTooltipGenOptions","vnode","options","tooltip","_a","instance","core","app","name","PiniaTPA","#storeId","#store","#Page","#user","#Api","context","url","data","#loadFromStorage","#loadFromHash","#loadFromGuestLink","#prepareParams","save","lodash","#saveInHash","#saveInStorage","dataGuestLink","#genOptionsForGuestLink","res","utils_clipboard","nameSnakeCase","utils_string","value","dataFormatted","dataHash","utils_route","#setOptions","isLocal","storageNamespace","names","#namesStorage","#namesStorageLocal","guestData","$guestTitle","competitors","competitor","regionsIndexes","regionIndex","index","mapSearchers","availableRegionsIndexes","searcher","competitorsIds","competitorId","availableCompetitorsIds","piniaTPA","contextPinia","_b","_c","_d"],"mappings":"yPAKA,MAAAA,EAAA,CAAc,QAAA,SAAAC,EAAAC,EAAA,CAEZA,EAAA,MAAA,UAAAD,EAAA,MAAA,ICLF,IAAAE,EAMA,MAAAC,EAAA,CAAe,QAAAH,EAAAC,EAAAG,EAAA,+BAIbF,EAAA,IAAA,qBAAAG,GAAA,kHAMyC,EAAA,CACtC,UAAA,CAAA,CAAA,CACW,CAAA,EAGdH,EAAA,QAAAF,CAAA,GACD,UAAAM,EAAAC,EAAAH,EAAA,CAGCF,GAAA,MAAAA,EAAA,wBChBFM,EACA,MAAAC,EAAA,IAAA,IAOAC,EAAA,CAAAV,EAAAW,IAAA,4GASCC,GAAAC,EACCb,EAAA,MAAA,UAAA,cAAAa,EAAAD,CAAA,MAEAZ,EAAA,MAAA,UAAA,iBAEF,EAEAc,EAAAd,GAAA,CACC,IAAAW,EAAA,OAAA,YAEA,OAAA,iBAAA,SAAA,IAAA,CACCF,EAAA,QAAAM,GAAAL,EAAAK,EAAAJ,CAAA,CAAA,CAAgE,EAAA,CAAA,QAAA,EAAA,CAAA,EAIjEH,EAAA,IAAA,qBAAAH,GAAA,CACCM,EAAA,OAAA,YAEAN,EAAA,QAAAW,GAAA,CACC,MAAAD,EAAAC,EAAA,OAUA,GARAA,EAAA,kBA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GAAApD,EAAAW,EAAA,QAAA,kBAAA,MAAAX,EAAA,SAAA,GAAAqD,EAAA1C,EAAA,QAAA,kBAAA,MAAA0C,EAAA,SAAA,GAAAC,EAAA3C,EAAA,QAAA,uBAAA,MAAA2C,EAAA,SAAA,GAAAC,EAAA5C,EAAA,QAAA,oBAAA,MAAA4C,EAAA,SASA,IAAAlD,EAAAM,CAAA"}
|
|
1
|
+
{"version":3,"file":"app.amd.js","sources":["../../src/core/directives/focus.ts","../../src/core/directives/sticky.ts","../../src/core/directives/swimUp.ts","../../src/core/directives/tooltip.ts","../../src/core/plugins/core.ts","../../src/core/plugins/piniaTPA.ts"],"sourcesContent":["import type { DirectiveBinding, ObjectDirective } from 'vue';\r\n\r\n/**\r\n * Фокусировка на элементе сразу после его отображения\r\n */\r\nconst focus = {\r\n\tmounted: function (el: HTMLElement, binding: DirectiveBinding) {\r\n\t\tif (!binding.value.disabled) el.focus();\r\n\t},\r\n} satisfies ObjectDirective;\r\n\r\nexport default focus;\r\n","import type { DirectiveBinding, ObjectDirective, VNode } from 'vue';\r\n\r\nlet appStickyObserver: IntersectionObserver;\r\n\r\n/**\r\n * Добавление sticky\r\n * К элементу добляется класс переданный как значение диррективы либо **'top-sticky'** по умолчанию\r\n */\r\nconst sticky = {\r\n\tmounted(el: HTMLElement, binding: DirectiveBinding, _vnode: VNode) {\r\n\t\tconst className = binding.value || 'top-sticky';\r\n\r\n\t\tappStickyObserver = new IntersectionObserver(entries => {\r\n\t\t\tlet condition = entries[0].intersectionRatio < 1;\r\n\t\t\tif (condition) {\r\n\t\t\t\tif (binding.modifiers.bottom && entries[0].intersectionRect.y === 0) condition = false;\r\n\t\t\t}\r\n\r\n\t\t\tel.classList.toggle(className, condition);\r\n\t\t}, {\r\n\t\t\tthreshold: [1],\r\n\t\t});\r\n\r\n\t\tappStickyObserver.observe(el);\r\n\t},\r\n\r\n\tunmounted(_el: HTMLElement, _binding: DirectiveBinding, _vnode: VNode) {\r\n\t\tappStickyObserver?.disconnect();\r\n\t},\r\n} satisfies ObjectDirective;\r\n\r\nexport default sticky;\r\n","import type { DirectiveBinding, ObjectDirective, VNode } from 'vue';\r\nimport Core from '@/core/core/core';\r\n\r\ninterface HTMLElementWithSwimUpOptions extends HTMLElement {\r\n\tdirectiveSwipUpOptions: {\r\n\t\tdistance: number,\r\n\t\tpercent: number,\r\n\t};\r\n}\r\n\r\nlet appSwimUpInited = false;\r\nlet appSwimUpObserver: IntersectionObserver;\r\nconst appSwimUpEls = new Map();\r\n\r\n/**\r\n * Отодвинуть блок в зависимости от скролла старинцы\r\n * @param el\r\n * @param windowHeight\r\n */\r\nconst swimUpElTransform = (el: HTMLElementWithSwimUpOptions, windowHeight: number): void => {\r\n\tconst { distance, percent } = el.directiveSwipUpOptions;\r\n\r\n\tconst elTop = el.getBoundingClientRect().top;\r\n\r\n\t// во столько раз triggerHeight должен быть меньше, чтобы закончить подплытие к нужной высоте экрана\r\n\tconst triggerHeightReducer = windowHeight * percent / 100 / distance;\r\n\tconst triggerHeight = (windowHeight - elTop) / triggerHeightReducer;\r\n\r\n\tif (triggerHeight <= distance) {\r\n\t\tel.style.transform = `translateY(${distance - triggerHeight}px)`;\r\n\t} else {\r\n\t\tel.style.transform = 'translateY(0px)';\r\n\t}\r\n};\r\n\r\nconst swimUpInit = (el: HTMLElementWithSwimUpOptions): void => {\r\n\tlet windowHeight = window.innerHeight;\r\n\r\n\twindow.addEventListener('scroll', () => {\r\n\t\tappSwimUpEls.forEach((el) => swimUpElTransform(el, windowHeight));\r\n\t}, { passive: true });\r\n\r\n\t// проверка того, что элемент в зоне видимости\r\n\tappSwimUpObserver = new IntersectionObserver(entries => {\r\n\t\twindowHeight = window.innerHeight;\r\n\r\n\t\tentries.forEach((entry) => {\r\n\t\t\tconst el = entry.target as HTMLElementWithSwimUpOptions;\r\n\r\n\t\t\tif (entry.intersectionRatio < 0.1) {\r\n\t\t\t\t// элемент за областью видимости\r\n\t\t\t\tappSwimUpEls.delete(el);\r\n\t\t\t} else {\r\n\t\t\t\t// элемент на экране\r\n\t\t\t\tappSwimUpEls.set(el, el);\r\n\t\t\t}\r\n\r\n\t\t\tif (entry.intersectionRatio === 0) {\r\n\t\t\t\tconst { distance } = el.directiveSwipUpOptions;\r\n\t\t\t\tel.style.transform = `translateY(${distance}px)`;\r\n\t\t\t}\r\n\t\t});\r\n\t}, {\r\n\t\tthreshold: 0.1,\r\n\t});\r\n};\r\n\r\n/**\r\n * Добавление анимации подплытия вверх для блока\r\n */\r\nconst swimUp = {\r\n\tmounted(el: HTMLElementWithSwimUpOptions, binding: DirectiveBinding, _vnode: VNode): void {\r\n\t\tif (Core.state.isMobileUA) return;\r\n\r\n\t\tel.directiveSwipUpOptions = {\r\n\t\t\tdistance: binding.value?.distance ?? 100, // количество px на которые блок изначально смещен вниз,\r\n\t\t\tpercent: binding.value?.percent ?? 30, // процент высоты экрана поднявшись на который блок закончит подплытие\r\n\t\t};\r\n\r\n\t\tif (!appSwimUpInited) {\r\n\t\t\tswimUpInit(el);\r\n\r\n\t\t\tappSwimUpInited = true;\r\n\t\t}\r\n\r\n\t\tappSwimUpObserver.observe(el);\r\n\t},\r\n\r\n\tunmounted(el: HTMLElementWithSwimUpOptions, _binding: DirectiveBinding, _vnode: VNode) {\r\n\t\tappSwimUpEls.delete(el);\r\n\t\tappSwimUpObserver?.unobserve(el);\r\n\t},\r\n} satisfies ObjectDirective;\r\n\r\nexport default swimUp;\r\n","import type { DirectiveBinding, ObjectDirective, VNode } from 'vue';\r\nimport Core from '@/core/core/core';\r\n\r\nconst $ = (el: VNode) => {\r\n\tif (!Core.$?.ui?.tooltip) {\r\n\t\tconsole.info('Для работы v-top-tooltip требуется глобальная загрузка jQuery UI Tooltip');\r\n\r\n\t\treturn;\r\n\t}\r\n\r\n\treturn Core.$(el);\r\n};\r\n\r\nconst tvTooltipGenOptions = (binding: DirectiveBinding, vnode: VNode) => {\r\n\tconst options = binding.value ?? {};\r\n\r\n\toptions.content ??= vnode.props?.title;\r\n\toptions.content = String(options.content).replace(/\\r\\n|\\r|\\n/g, '<br>');\r\n\r\n\toptions.position ??= {\r\n\t\tmy: 'bottom-18px',\r\n\t\tat: 'top center',\r\n\t};\r\n\r\n\treturn options;\r\n};\r\n\r\n/**\r\n * Добавление всплывающей подсказки к элементу.\r\n */\r\nconst tooltip = {\r\n\tmounted(el: VNode, binding: DirectiveBinding, vnode: VNode) {\r\n\t\t$(el)?.tooltip(tvTooltipGenOptions(binding, vnode));\r\n\t},\r\n\r\n\tupdated(el: VNode, binding: DirectiveBinding, vnode: VNode, _prevVnode: VNode) {\r\n\t\t/**\r\n\t\t * В результате обновления может быть открыто несколько тултипов поэтому изменить опции, без перерисовки тултипа\r\n\t\t */\r\n\t\tconst options = tvTooltipGenOptions(binding, vnode);\r\n\t\tconst instance = $(el)?.tooltip('instance') as { options: JQueryUI.TooltipOptions } | undefined;\r\n\t\tif (!instance) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tinstance.options = {\r\n\t\t\t...instance.options,\r\n\t\t\t...options,\r\n\t\t};\r\n\t},\r\n\r\n\tunmounted(el: VNode, _binding: DirectiveBinding, _vnode: VNode) {\r\n\t\t$(el)?.tooltip('destroy');\r\n\t},\r\n} satisfies ObjectDirective;\r\n\r\nexport default tooltip;","import type { Plugin } from 'vue';\r\nimport Core from '@/core/core/core';\r\nimport coreDefaultOptions from '@/core/core/options';\r\nimport * as Forms from '../../components/forms/forms';\r\nimport directiveFocus from '@/core/directives/focus';\r\nimport directiveSticky from '@/core/directives/sticky';\r\nimport directiveSwimUp from '@/core/directives/swimUp';\r\nimport directiveTooltip from '@/core/directives/tooltip';\r\n\r\ndeclare module 'vue' {\r\n\texport interface ComponentCustomProperties {\r\n\t\t/**\r\n\t\t * Статический класс с текущим состоянимем UI\r\n\t\t */\r\n\t\t$core: typeof Core;\r\n\t}\r\n\r\n\t/**\r\n\t * Обязательные компоненты UI\r\n\t *\r\n\t * Они подключаются через плагин и доступны без явного указания импорта\r\n\t */\r\n\texport interface GlobalComponents {\r\n\t\tTopAvatar: typeof Forms.TopAvatar;\r\n\t\tTopButton: typeof Forms.TopButton;\r\n\t\tTopCheckbox: typeof Forms.TopCheckbox;\r\n\t\tTopControlLabel: typeof Forms.TopControlLabel;\r\n\t\tTopHint: typeof Forms.TopHint;\r\n\t\tTopInput: typeof Forms.TopInput;\r\n\t\tTopInputDate: typeof Forms.TopInputDate;\r\n\t\tTopInputRange: typeof Forms.TopInputRange;\r\n\t\tTopRadio: typeof Forms.TopRadio;\r\n\t\tTopSwitcher: typeof Forms.TopSwitcher;\r\n\t\tTopTextarea: typeof Forms.TopTextarea;\r\n\t\tTopSelect: typeof Forms.TopSelect;\r\n\t\tTopLoadbar: typeof Forms.TopLoadbar;\r\n\t}\r\n}\r\n\r\ntype PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\r\n\r\ntype Options = PartialBy<typeof coreDefaultOptions, 'gmt'>;\r\n\r\n/**\r\n * Плагин для интеграции UI во Vue приложение\r\n *\r\n * - В глобальную область видимости шаблонов будет добавлен объект $core\r\n * - Будут зарегистрирвоаны директивы UI: https://ui.topvisor.com/?path=/docs/core-directives-focus--docs\r\n * - Будут подключены базовые компоненты UI/Forms: https://ui.topvisor.com/?path=/docs/components-forms-readme--docs\r\n */\r\nexport default {\r\n\r\n\tinstall: (app, options: Options) => {\r\n\t\tapp.config.globalProperties.$core2 = Core;\r\n\r\n\t\t// начальные настройки UI\r\n\t\tfor (const name in options) {\r\n\t\t\tCore.state[name] = options[name];\r\n\t\t}\r\n\r\n\t\tCore._setState();\r\n\r\n\t\t// определение директив\r\n\t\tapp.directive('top-focus', directiveFocus);\r\n\t\tapp.directive('top-sticky', directiveSticky);\r\n\t\tapp.directive('top-swim-up', directiveSwimUp);\r\n\t\tapp.directive('top-tooltip', directiveTooltip);\r\n\r\n\t\t// определение базовых компонентов\r\n\t\tapp.component('TopAvatar', Forms.TopAvatar);\r\n\t\tapp.component('TopButton', Forms.TopButton);\r\n\t\tapp.component('TopCheckbox', Forms.TopCheckbox);\r\n\t\tapp.component('TopControlLabel', Forms.TopControlLabel);\r\n\t\tapp.component('TopHint', Forms.TopHint);\r\n\t\tapp.component('TopInput', Forms.TopInput);\r\n\t\tapp.component('TopInputDate', Forms.TopInputDate);\r\n\t\tapp.component('TopInputRange', Forms.TopInputRange);\r\n\t\tapp.component('TopLoadbar', Forms.TopLoadbar);\r\n\t\tapp.component('TopRadio', Forms.TopRadio);\r\n\t\tapp.component('TopSelect', Forms.TopSelect);\r\n\t\tapp.component('TopSwitcher', Forms.TopSwitcher);\r\n\t\tapp.component('TopTextarea', Forms.TopTextarea);\r\n\r\n\t},\r\n\r\n} satisfies Plugin<Options>;\r\n","import type { PiniaPluginContext, Store } from 'pinia';\r\nimport { watch } from 'vue';\r\nimport { debounce } from 'lodash';\r\nimport { setClipboard } from '@/core/utils/clipboard';\r\nimport { camelToSnakeCase } from '@/core/utils/string.js';\r\nimport type { paths as OpenAPIPaths } from 'topvisor-openapi/src/ts/Topvisor';\r\nimport { getHash, setHash } from '@/core/utils/route';\r\n\r\ntype OpenAPIPath = keyof OpenAPIPaths;\r\n\r\nclass PiniaTPA {\r\n\r\n\treadonly #storeId: string;\r\n\treadonly #store: Store<'test', any>;\r\n\r\n\t/**\r\n\t * @deprecated\r\n\t */\r\n\treadonly #Page: any;\r\n\r\n\treadonly #user: any;\r\n\treadonly #Api: any;\r\n\r\n\treadonly #namesUrlHash: string[] = [];\r\n\treadonly #namesStorage: string[] = [];\r\n\treadonly #namesStorageLocal: string[] = [];\r\n\treadonly #namesGuestLink: string[] = [];\r\n\r\n\tconstructor(context: Context) {\r\n\t\tthis.#store = context.store;\r\n\t\tthis.#storeId = this.#store.$id;\r\n\r\n\t\tthis.#Page = context.options.Page;\r\n\r\n\t\tthis.#user = context.options.user;\r\n\t\tthis.#Api = context.options.Api;\r\n\r\n\t\tthis.#namesUrlHash = context.options.tpaNamesUrlHash || [];\r\n\t\tthis.#namesStorage = context.options.tpaNamesStorage || [];\r\n\t\tthis.#namesStorageLocal = context.options.tpaNamesStorageLocal || [];\r\n\t\tthis.#namesGuestLink = context.options.tpaNamesGuestLink || [];\r\n\r\n\t\tcontext.store.genGuestLink = <Path extends OpenAPIPath>(url: Path, data: any) => this.genGuestLink(url, data);\r\n\r\n\t\tif (!this.#user.guest_data?.data) {\r\n\t\t\tthis.#loadFromStorage();\r\n\t\t\tthis.#loadFromStorage(true);\r\n\r\n\t\t\t// настройки URL hash имеют приоритет\r\n\t\t\tthis.#loadFromHash();\r\n\t\t}\r\n\r\n\t\t// настройки гостевой ссылки имеют приоритет\r\n\t\tthis.#loadFromGuestLink();\r\n\r\n\t\tthis.#prepareParams();\r\n\r\n\t\tconst save = debounce(() => {\r\n\t\t\tthis.#saveInHash();\r\n\t\t\tthis.#saveInStorage();\r\n\t\t});\r\n\r\n\t\tcontext.store.$subscribe(save);\r\n\t}\r\n\r\n\t/**\r\n\t * Сгенерировать гостевую ссылку\r\n\t *\r\n\t * Метод, путь к которому указан в url, должен возвращать сгенерированную ссылку\r\n\t */\r\n\tasync genGuestLink<Path extends OpenAPIPath>(url: Path, data: any) {\r\n\t\tconst dataGuestLink = this.#genOptionsForGuestLink();\r\n\t\tdata = Object.assign(data, Object.fromEntries(dataGuestLink));\r\n\r\n\t\tconst res = await this.#Api.gen(url, 'fetchColumn').call({} as any, data);\r\n\r\n\t\t// @ts-ignore - метод, который скачивает файл не возвращает json\r\n\t\tif (res?.errors) return;\r\n\r\n\t\t// @ts-ignore - метод, который скачивает файл не возвращает json\r\n\t\tawait setClipboard(res.result);\r\n\r\n\t\t// TODO: Оформить через компонент messages\r\n\t\talert('Link copied');\r\n\t}\r\n\r\n\t/**\r\n\t * Сгенерировать опции для гостевой ссылки\r\n\t */\r\n\t#genOptionsForGuestLink() {\r\n\t\tconst data = new Map();\r\n\r\n\t\tthis.#namesGuestLink.forEach(name => {\r\n\t\t\t// формат параметров API: snake_case\r\n\t\t\tconst nameSnakeCase = camelToSnakeCase(name);\r\n\t\t\tdata.set(nameSnakeCase, this.#store[name]);\r\n\t\t});\r\n\r\n\t\treturn data;\r\n\t}\r\n\r\n\t/**\r\n\t * Установить опции из объекта без фиксации состояния\r\n\t */\r\n\t#setOptions(data: Map<string, any>) {\r\n\t\tif (Object.isFrozen(this)) throw 'Please, use setOptions only inner commit function';\r\n\r\n\t\tdata.forEach((value, name) => {\r\n\t\t\tconst currentValue = this.#store[name];\r\n\r\n\t\t\tif (value === null || value === undefined) return;\r\n\t\t\tif (!value?.constructor) return;\r\n\t\t\tif (value.constructor !== currentValue.constructor) return;\r\n\r\n\t\t\t// дополнительная проверка на формат даты\r\n\t\t\tif (name.indexOf('date') === 0) {\r\n\t\t\t\tif (Array.isArray(value)) {\r\n\t\t\t\t\t// value.forEach((valueI) => {\r\n\t\t\t\t\t// \tif (!/\\d\\d\\d\\d-\\d\\d-\\d\\d/.test(valueI)) return;\r\n\t\t\t\t\t// });\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (typeof (value) === 'string') {\r\n\t\t\t\t\t\tif (!/\\d\\d\\d\\d-\\d\\d-\\d\\d/.test(value)) return;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tthis.#store[name] = value;\r\n\t\t});\r\n\t}\r\n\r\n\t/**\r\n\t * Сгенерировать Map объект с опциями со значениями в виде json строк\r\n\t */\r\n\t#genDataFormat(data: Map<string, any>) {\r\n\t\tconst dataFormatted = new Map();\r\n\r\n\t\tdata.forEach((value, name) => {\r\n\t\t\tif (value === null) return;\r\n\r\n\t\t\tvalue = JSON.stringify(value);\r\n\r\n\t\t\tdataFormatted.set(name, value);\r\n\t\t});\r\n\r\n\t\treturn dataFormatted;\r\n\t}\r\n\r\n\t/**\r\n\t * Сгенерировать Map объект с опциями со значениями в оригинальном виде\r\n\t */\r\n\t#genDataUnFormat(dataFormatted: Map<string, string>) {\r\n\t\tconst data: Map<string, any> = new Map();\r\n\r\n\t\tdataFormatted.forEach((value, name) => {\r\n\t\t\tif (value === null || value === undefined || value === 'false') return;\r\n\r\n\t\t\ttry {\r\n\t\t\t\tif (typeof (value) === 'string' && !/^\\d\\d\\d\\d-\\d\\d-\\d\\d$/.test(value)) value = JSON.parse(value);\r\n\r\n\t\t\t\tif (value === null || value === undefined || value === 'false') return;\r\n\t\t\t} catch (e) {\r\n\t\t\t\t// не json строка\r\n\t\t\t}\r\n\r\n\t\t\tdata.set(name, value);\r\n\t\t});\r\n\r\n\t\treturn data;\r\n\t}\r\n\r\n\t/**\r\n\t * Установить опции из хеша адреса страницы\r\n\t */\r\n\t#loadFromHash() {\r\n\t\tlet dataHash: any;\r\n\t\ttry {\r\n\t\t\tdataHash = JSON.parse(getHash(this.#storeId));\r\n\t\t} catch (e) {\r\n\r\n\t\t}\r\n\t\tif (!dataHash) return;\r\n\r\n\t\tconst dataFormatted: Map<string, any> = new Map();\r\n\r\n\t\tthis.#namesUrlHash.forEach((name) => {\r\n\t\t\tconst value = dataHash[name];\r\n\t\t\tif (!value) return;\r\n\r\n\t\t\tdataFormatted.set(name, value);\r\n\t\t});\r\n\r\n\t\tconst data = this.#genDataUnFormat(dataFormatted);\r\n\r\n\t\tthis.#setOptions(data);\r\n\t}\r\n\r\n\t/**\r\n\t * Сохранить опции в хеш адреса страницы\r\n\t */\r\n\t#saveInHash() {\r\n\t\tconst data = new Map();\r\n\r\n\t\tthis.#namesUrlHash.forEach((name) => {\r\n\t\t\tconst value = this.#store[name];\r\n\r\n\t\t\tdata.set(name, value);\r\n\t\t});\r\n\r\n\t\tconst dataObject = Object.fromEntries(data);\r\n\t\tconst dataJSON = JSON.stringify(dataObject);\r\n\r\n\t\tsetHash(this.#storeId, dataJSON);\r\n\t};\r\n\r\n\t/**\r\n\t * Установить опции из localStorage\r\n\t * @param isLocal - сохранить с учетом адреса страницы\r\n\t */\r\n\t#loadFromStorage(isLocal = false) {\r\n\t\tconst dataFormatted = new Map();\r\n\r\n\t\t// let names = this.#namesStorage;\r\n\t\tlet storageNamespace = 'state:' + this.#storeId;\r\n\r\n\t\tif (isLocal) {\r\n\t\t\t// names = this.#namesStorageLocal;\r\n\t\t\tstorageNamespace = 'state:' + this.#storeId + ':' + location.pathname;\r\n\t\t}\r\n\r\n\t\tthis.#namesStorage.forEach((name) => {\r\n\t\t\tconst value = localStorage.getItem(storageNamespace + ':' + name);\r\n\t\t\tdataFormatted.set(name, value);\r\n\t\t});\r\n\r\n\t\tconst data = this.#genDataUnFormat(dataFormatted);\r\n\r\n\t\tthis.#setOptions(data);\r\n\t}\r\n\r\n\t/**\r\n\t * Сохранить опции в localStorage\r\n\t * @param isLocal - сохранить с учетом адреса страницы\r\n\t */\r\n\t#saveInStorage(isLocal = false) {\r\n\t\tconst data = new Map();\r\n\r\n\t\tlet names = this.#namesStorage;\r\n\t\tlet storageNamespace = 'state:' + this.#storeId;\r\n\r\n\t\tif (isLocal) {\r\n\t\t\tnames = this.#namesStorageLocal;\r\n\t\t\tstorageNamespace = 'state:' + this.#storeId + ':' + location.pathname;\r\n\t\t}\r\n\r\n\t\tnames.forEach((name) => {\r\n\t\t\tconst value = this.#store[name];\r\n\r\n\t\t\tdata.set(name, value);\r\n\t\t});\r\n\r\n\t\tconst dataFormatted = this.#genDataFormat(data);\r\n\r\n\t\tnames.forEach((name) => {\r\n\t\t\tconst value = dataFormatted.get(name);\r\n\r\n\t\t\tlocalStorage.setItem(storageNamespace + ':' + name, value);\r\n\t\t});\r\n\t}\r\n\r\n\t/**\r\n\t * Установить опции из гостевой ссылки\r\n\t */\r\n\t#loadFromGuestLink() {\r\n\t\tconst guestData = this.#user?.guest_data?.data;\r\n\t\tif (!guestData) return;\r\n\r\n\t\t// общие правила для гостевых сессий\r\n\t\tif (this.#user.id === -1) this.#user.positionsReverseDates = guestData.positionsReverseDates;\r\n\r\n\t\tconst dataFormatted = new Map();\r\n\r\n\t\tthis.#namesGuestLink.forEach((name) => {\r\n\t\t\tconst value = guestData[name];\r\n\t\t\tdataFormatted.set(name, value);\r\n\t\t});\r\n\r\n\t\tconst data = this.#genDataUnFormat(dataFormatted);\r\n\r\n\t\tthis.#setOptions(data);\r\n\r\n\t\tconst $guestTitle = $('.mod_guest_title');\r\n\r\n\t\t// TODO: вынести в опции плагина\r\n\t\tif (this.#store.competitorsIds?.length === 1 && this.#Page.page.data.competitors) {\r\n\t\t\tlet competitors = this.#Page.page.data.competitors.filter((competitor: any) => competitor.id === guestData.competitorsIds[0]);\r\n\t\t\tif (competitors.length) {\r\n\t\t\t\t$('a', $guestTitle).attr('href', 'http://' + competitors[0].url);\r\n\t\t\t\t$('a', $guestTitle).text(competitors[0].name);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Подготовить входные параметры перед инициализацией основного функционала\r\n\t *\r\n\t * Входные параметры устанавливаются при открытии страницы\r\n\t *\r\n\t * Входные параметры могут меняться пользоваталем и устаревать\r\n\t */\r\n\t#prepareParams() {\r\n\t\t// контролль за вводом регионов\r\n\t\t// TODO: вынести в опции плагина\r\n\t\tif (this.#store.regionsIndexes) {\r\n\t\t\twatch(this.#store, (regionsIndexes) => {\r\n\t\t\t\tif (!regionsIndexes.length) return;\r\n\r\n\t\t\t\t// приведение типа\r\n\t\t\t\tregionsIndexes.forEach((regionIndex: number, index: number) => regionsIndexes[index] = regionIndex);\r\n\r\n\t\t\t\t// оставить только включенные регионы\r\n\t\t\t\t// @ts-ignore\r\n\t\t\t\tconst mapSearchers = TplProjectSelectorRegion.genSearchersMap();\r\n\r\n\t\t\t\tconst availableRegionsIndexes: number[] = [];\r\n\t\t\t\tmapSearchers.forEach((searcher: any) => {\r\n\t\t\t\t\tsearcher.regions.forEach((region: any) => {\r\n\t\t\t\t\t\tif (region.index === -1) return;\r\n\r\n\t\t\t\t\t\tavailableRegionsIndexes.push(region.index);\r\n\t\t\t\t\t});\r\n\t\t\t\t});\r\n\r\n\t\t\t\tthis.#store.regionsIndexes = regionsIndexes.filter((regionIndex: number) => availableRegionsIndexes.includes(regionIndex));\r\n\t\t\t}, { immediate: true });\r\n\t\t}\r\n\r\n\t\t// контролль за вводом конкурентов\r\n\t\t// TODO: вынести в опции плагина\r\n\t\tif (this.#store.competitorsIds) {\r\n\t\t\twatch(this.#store, (competitorsIds) => {\r\n\t\t\t\tif (!competitorsIds.length) return;\r\n\r\n\t\t\t\t// приведение типа\r\n\t\t\t\tcompetitorsIds.forEach((competitorId: number, index: number) => competitorId[index] = competitorId);\r\n\r\n\t\t\t\t// оставить только включенных конкурентов\r\n\t\t\t\tconst availableCompetitorsIds = [this.#Page.page.data.project.id];\r\n\t\t\t\tthis.#Page.page.data.project.competitors.forEach((competitor: any) => {\r\n\t\t\t\t\tif (competitor.on >= 0) availableCompetitorsIds.push(competitor.id);\r\n\t\t\t\t});\r\n\r\n\t\t\t\tthis.#store.competitorsIds = competitorsIds.filter((competitorId: number) => availableCompetitorsIds.includes(competitorId));\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n}\r\n\r\ntype Options = {\r\n\t/**\r\n\t * TODO: Убрать из плагина\r\n\t */\r\n\tPage: any,\r\n\r\n\t/**\r\n\t * Объект с настройками пользователя\r\n\t */\r\n\tuser: any,\r\n\r\n\t/**\r\n\t * Объект для работы с API\r\n\t *\r\n\t * См. на айте: @/component/api/core/api.ts\r\n\t */\r\n\tApi: any;\r\n\r\n\t/**\r\n\t * Имена свойств для сохранения в URL\r\n\t */\r\n\ttpaNamesUrlHash?: string[],\r\n\r\n\t/**\r\n\t * Имена свойств для сохранения в localStorage\r\n\t */\r\n\ttpaNamesStorage?: string[],\r\n\r\n\t/**\r\n\t * Имена свойств для сохранения в localStorage с учетом пути URL\r\n\t *\r\n\t * Каждый URL будет работать со своим состоянием\r\n\t */\r\n\ttpaNamesStorageLocal?: string[],\r\n\r\n\t/**\r\n\t * Имена свойств для работы с гостевой ссылкой\r\n\t *\r\n\t * Для генерации гостевой ссылки используйте store.genGuestLink(data, url)\r\n\t */\r\n\ttpaNamesGuestLink?: string[],\r\n};\r\n\r\ntype Context = PiniaPluginContext & {\r\n\toptions: Options\r\n};\r\n\r\n/**\r\n * Плагин tpa (Third-party access) для pinia\r\n *\r\n * Добавляет возможность сохранять и загружать данные в/из:\r\n * \t- URL hash в адресе страницы\r\n * \t- localStorage\r\n * \t- гостевая ссылка\r\n *\r\n * Для подключения плагина нужно указань одну или несколько опций при определении defineStore():\r\n * - tpaNamesUrlHash\r\n * - tpaNamesStorage\r\n * - tpaNamesStorageLocal\r\n * - tpaNamesGuestLink\r\n */\r\nexport default (contextPinia: PiniaPluginContext) => {\r\n\tconst context = contextPinia as Context;\r\n\r\n\t// плагин подключать не нужно\r\n\tif (\r\n\t\t!context.options.tpaNamesUrlHash?.length &&\r\n\t\t!context.options.tpaNamesStorage?.length &&\r\n\t\t!context.options.tpaNamesStorageLocal?.length &&\r\n\t\t!context.options.tpaNamesGuestLink?.length\r\n\t) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tnew PiniaTPA(context);\r\n}\r\n"],"names":["focus","el","binding","appStickyObserver","sticky","_vnode","entries","_el","_binding","appSwimUpObserver","appSwimUpEls","swimUpElTransform","windowHeight","triggerHeight","distance","swimUpInit","el2","entry","swimUp","forms","$$1","tvTooltipGenOptions","vnode","options","tooltip","_a","instance","core","app","name","PiniaTPA","#storeId","#store","#Page","#user","#Api","context","url","data","#loadFromStorage","#loadFromHash","#loadFromGuestLink","#prepareParams","save","lodash","#saveInHash","#saveInStorage","dataGuestLink","#genOptionsForGuestLink","res","utils_clipboard","nameSnakeCase","utils_string","value","dataFormatted","dataHash","utils_route","#setOptions","isLocal","storageNamespace","names","#namesStorage","#namesStorageLocal","guestData","$guestTitle","competitors","competitor","regionsIndexes","regionIndex","index","mapSearchers","availableRegionsIndexes","searcher","competitorsIds","competitorId","availableCompetitorsIds","piniaTPA","contextPinia","_b","_c","_d"],"mappings":"yPAKA,MAAAA,EAAA,CAAc,QAAA,SAAAC,EAAAC,EAAA,CAEZA,EAAA,MAAA,U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IAAAD,CAAA,EAAA,KAAAC,EAAA,CAAA,EAAA,IAAA,IAGHvB,IAAA,CAYC,KAAAV,GAAA,oCAEE,GAAA,CAAAmC,EAAA,OAAA,OAGAA,EAAA,QAAA,CAAAC,EAAAC,IAAAF,EAAAE,CAAA,EAAAD,CAAA,EAIA,MAAAE,EAAA,yBAAA,gBAAA,EAEAC,EAAA,CAAA,EACAD,EAAA,QAAAE,GAAA,oDAI2C,CAAA,CACzC,CAAA,mDAGuH,EAAA,CAAA,UAAA,EAAA,CAAA,EAM3H,KAAAxC,GAAA,oCAEE,GAAA,CAAAyC,EAAA,OAAA,OAGAA,EAAA,QAAA,CAAAC,EAAAL,IAAAK,EAAAL,CAAA,EAAAK,CAAA,EAGA,MAAAC,EAAA,CAAA,KAAA1C,GAAA,KAAA,KAAA,QAAA,EAAA,EACA,KAAAA,GAAA,KAAA,KAAA,QAAA,YAAA,QAAAiC,GAAA,CACCA,EAAA,IAAA,GAAAS,EAAA,KAAAT,EAAA,EAAA,CAAkE,CAAA,mDAGwD,CAAA,GAoE/H,MAAAU,EAAAC,GAAA,aACC,MAAAzC,EAAAyC,EAGA,GAAApD,EAAAW,EAAA,QAAA,kBAAA,MAAAX,EAAA,SAAA,GAAAqD,EAAA1C,EAAA,QAAA,kBAAA,MAAA0C,EAAA,SAAA,GAAAC,EAAA3C,EAAA,QAAA,uBAAA,MAAA2C,EAAA,SAAA,GAAAC,EAAA5C,EAAA,QAAA,oBAAA,MAAA4C,EAAA,SASA,IAAAlD,EAAAM,CAAA"}
|
package/core/app.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as p, b as w, c as S, e as b, f as E, g as I, h as L, j as v, k as O, l as k, m as y, n as N, o as _, p as H } from "../.chunks/forms-
|
|
1
|
+
import { C as p, b as w, c as S, e as b, f as E, g as I, h as L, j as v, k as O, l as k, m as y, n as N, o as _, p as H } from "../.chunks/forms-CPEVHoks.es.js";
|
|
2
2
|
import { i as tt, a as et, u as ot, b as st } from "../.chunks/i18n-qpB8zyhD.es.js";
|
|
3
3
|
import { watch as u } from "vue";
|
|
4
4
|
import { debounce as R } from "lodash";
|
|
@@ -90,7 +90,7 @@ const l = /* @__PURE__ */ new Map(), A = (n, t) => {
|
|
|
90
90
|
}
|
|
91
91
|
}, K = {
|
|
92
92
|
install: (n, t) => {
|
|
93
|
-
n.config.globalProperties.$
|
|
93
|
+
n.config.globalProperties.$core2 = p;
|
|
94
94
|
for (const e in t)
|
|
95
95
|
p.state[e] = t[e];
|
|
96
96
|
p._setState(), n.directive("top-focus", M), n.directive("top-sticky", j), n.directive("top-swim-up", D), n.directive("top-tooltip", x), n.component("TopAvatar", w), n.component("TopButton", S), n.component("TopCheckbox", b), n.component("TopControlLabel", E), n.component("TopHint", I), n.component("TopInput", L), n.component("TopInputDate", v), n.component("TopInputRange", O), n.component("TopLoadbar", k), n.component("TopRadio", y), n.component("TopSelect", N), n.component("TopSwitcher", _), n.component("TopTextarea", H);
|
package/core/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sources":["../../src/core/directives/focus.ts","../../src/core/directives/sticky.ts","../../src/core/directives/swimUp.ts","../../src/core/directives/tooltip.ts","../../src/core/plugins/core.ts","../../src/core/plugins/piniaTPA.ts"],"sourcesContent":["import type { DirectiveBinding, ObjectDirective } from 'vue';\r\n\r\n/**\r\n * Фокусировка на элементе сразу после его отображения\r\n */\r\nconst focus = {\r\n\tmounted: function (el: HTMLElement, binding: DirectiveBinding) {\r\n\t\tif (!binding.value.disabled) el.focus();\r\n\t},\r\n} satisfies ObjectDirective;\r\n\r\nexport default focus;\r\n","import type { DirectiveBinding, ObjectDirective, VNode } from 'vue';\r\n\r\nlet appStickyObserver: IntersectionObserver;\r\n\r\n/**\r\n * Добавление sticky\r\n * К элементу добляется класс переданный как значение диррективы либо **'top-sticky'** по умолчанию\r\n */\r\nconst sticky = {\r\n\tmounted(el: HTMLElement, binding: DirectiveBinding, _vnode: VNode) {\r\n\t\tconst className = binding.value || 'top-sticky';\r\n\r\n\t\tappStickyObserver = new IntersectionObserver(entries => {\r\n\t\t\tlet condition = entries[0].intersectionRatio < 1;\r\n\t\t\tif (condition) {\r\n\t\t\t\tif (binding.modifiers.bottom && entries[0].intersectionRect.y === 0) condition = false;\r\n\t\t\t}\r\n\r\n\t\t\tel.classList.toggle(className, condition);\r\n\t\t}, {\r\n\t\t\tthreshold: [1],\r\n\t\t});\r\n\r\n\t\tappStickyObserver.observe(el);\r\n\t},\r\n\r\n\tunmounted(_el: HTMLElement, _binding: DirectiveBinding, _vnode: VNode) {\r\n\t\tappStickyObserver?.disconnect();\r\n\t},\r\n} satisfies ObjectDirective;\r\n\r\nexport default sticky;\r\n","import type { DirectiveBinding, ObjectDirective, VNode } from 'vue';\r\nimport Core from '@/core/core/core';\r\n\r\ninterface HTMLElementWithSwimUpOptions extends HTMLElement {\r\n\tdirectiveSwipUpOptions: {\r\n\t\tdistance: number,\r\n\t\tpercent: number,\r\n\t};\r\n}\r\n\r\nlet appSwimUpInited = false;\r\nlet appSwimUpObserver: IntersectionObserver;\r\nconst appSwimUpEls = new Map();\r\n\r\n/**\r\n * Отодвинуть блок в зависимости от скролла старинцы\r\n * @param el\r\n * @param windowHeight\r\n */\r\nconst swimUpElTransform = (el: HTMLElementWithSwimUpOptions, windowHeight: number): void => {\r\n\tconst { distance, percent } = el.directiveSwipUpOptions;\r\n\r\n\tconst elTop = el.getBoundingClientRect().top;\r\n\r\n\t// во столько раз triggerHeight должен быть меньше, чтобы закончить подплытие к нужной высоте экрана\r\n\tconst triggerHeightReducer = windowHeight * percent / 100 / distance;\r\n\tconst triggerHeight = (windowHeight - elTop) / triggerHeightReducer;\r\n\r\n\tif (triggerHeight <= distance) {\r\n\t\tel.style.transform = `translateY(${distance - triggerHeight}px)`;\r\n\t} else {\r\n\t\tel.style.transform = 'translateY(0px)';\r\n\t}\r\n};\r\n\r\nconst swimUpInit = (el: HTMLElementWithSwimUpOptions): void => {\r\n\tlet windowHeight = window.innerHeight;\r\n\r\n\twindow.addEventListener('scroll', () => {\r\n\t\tappSwimUpEls.forEach((el) => swimUpElTransform(el, windowHeight));\r\n\t}, { passive: true });\r\n\r\n\t// проверка того, что элемент в зоне видимости\r\n\tappSwimUpObserver = new IntersectionObserver(entries => {\r\n\t\twindowHeight = window.innerHeight;\r\n\r\n\t\tentries.forEach((entry) => {\r\n\t\t\tconst el = entry.target as HTMLElementWithSwimUpOptions;\r\n\r\n\t\t\tif (entry.intersectionRatio < 0.1) {\r\n\t\t\t\t// элемент за областью видимости\r\n\t\t\t\tappSwimUpEls.delete(el);\r\n\t\t\t} else {\r\n\t\t\t\t// элемент на экране\r\n\t\t\t\tappSwimUpEls.set(el, el);\r\n\t\t\t}\r\n\r\n\t\t\tif (entry.intersectionRatio === 0) {\r\n\t\t\t\tconst { distance } = el.directiveSwipUpOptions;\r\n\t\t\t\tel.style.transform = `translateY(${distance}px)`;\r\n\t\t\t}\r\n\t\t});\r\n\t}, {\r\n\t\tthreshold: 0.1,\r\n\t});\r\n};\r\n\r\n/**\r\n * Добавление анимации подплытия вверх для блока\r\n */\r\nconst swimUp = {\r\n\tmounted(el: HTMLElementWithSwimUpOptions, binding: DirectiveBinding, _vnode: VNode): void {\r\n\t\tif (Core.state.isMobileUA) return;\r\n\r\n\t\tel.directiveSwipUpOptions = {\r\n\t\t\tdistance: binding.value?.distance ?? 100, // количество px на которые блок изначально смещен вниз,\r\n\t\t\tpercent: binding.value?.percent ?? 30, // процент высоты экрана поднявшись на который блок закончит подплытие\r\n\t\t};\r\n\r\n\t\tif (!appSwimUpInited) {\r\n\t\t\tswimUpInit(el);\r\n\r\n\t\t\tappSwimUpInited = true;\r\n\t\t}\r\n\r\n\t\tappSwimUpObserver.observe(el);\r\n\t},\r\n\r\n\tunmounted(el: HTMLElementWithSwimUpOptions, _binding: DirectiveBinding, _vnode: VNode) {\r\n\t\tappSwimUpEls.delete(el);\r\n\t\tappSwimUpObserver?.unobserve(el);\r\n\t},\r\n} satisfies ObjectDirective;\r\n\r\nexport default swimUp;\r\n","import type { DirectiveBinding, ObjectDirective, VNode } from 'vue';\r\nimport Core from '@/core/core/core';\r\n\r\nconst $ = (el: VNode) => {\r\n\tif (!Core.$?.ui?.tooltip) {\r\n\t\tconsole.info('Для работы v-top-tooltip требуется глобальная загрузка jQuery UI Tooltip');\r\n\r\n\t\treturn;\r\n\t}\r\n\r\n\treturn Core.$(el);\r\n};\r\n\r\nconst tvTooltipGenOptions = (binding: DirectiveBinding, vnode: VNode) => {\r\n\tconst options = binding.value ?? {};\r\n\r\n\toptions.content ??= vnode.props?.title;\r\n\toptions.content = String(options.content).replace(/\\r\\n|\\r|\\n/g, '<br>');\r\n\r\n\toptions.position ??= {\r\n\t\tmy: 'bottom-18px',\r\n\t\tat: 'top center',\r\n\t};\r\n\r\n\treturn options;\r\n};\r\n\r\n/**\r\n * Добавление всплывающей подсказки к элементу.\r\n */\r\nconst tooltip = {\r\n\tmounted(el: VNode, binding: DirectiveBinding, vnode: VNode) {\r\n\t\t$(el)?.tooltip(tvTooltipGenOptions(binding, vnode));\r\n\t},\r\n\r\n\tupdated(el: VNode, binding: DirectiveBinding, vnode: VNode, _prevVnode: VNode) {\r\n\t\t/**\r\n\t\t * В результате обновления может быть открыто несколько тултипов поэтому изменить опции, без перерисовки тултипа\r\n\t\t */\r\n\t\tconst options = tvTooltipGenOptions(binding, vnode);\r\n\t\tconst instance = $(el)?.tooltip('instance') as { options: JQueryUI.TooltipOptions } | undefined;\r\n\t\tif (!instance) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tinstance.options = {\r\n\t\t\t...instance.options,\r\n\t\t\t...options,\r\n\t\t};\r\n\t},\r\n\r\n\tunmounted(el: VNode, _binding: DirectiveBinding, _vnode: VNode) {\r\n\t\t$(el)?.tooltip('destroy');\r\n\t},\r\n} satisfies ObjectDirective;\r\n\r\nexport default tooltip;","import type { Plugin } from 'vue';\r\nimport Core from '@/core/core/core';\r\nimport coreDefaultOptions from '@/core/core/options';\r\nimport * as Forms from '../../components/forms/forms';\r\nimport directiveFocus from '@/core/directives/focus';\r\nimport directiveSticky from '@/core/directives/sticky';\r\nimport directiveSwimUp from '@/core/directives/swimUp';\r\nimport directiveTooltip from '@/core/directives/tooltip';\r\n\r\ndeclare module 'vue' {\r\n\texport interface ComponentCustomProperties {\r\n\t\t/**\r\n\t\t * Статический класс с текущим состоянимем UI\r\n\t\t */\r\n\t\t$core: typeof Core;\r\n\t}\r\n\r\n\t/**\r\n\t * Обязательные компоненты UI\r\n\t *\r\n\t * Они подключаются через плагин и доступны без явного указания импорта\r\n\t */\r\n\texport interface GlobalComponents {\r\n\t\tTopAvatar: typeof Forms.TopAvatar;\r\n\t\tTopButton: typeof Forms.TopButton;\r\n\t\tTopCheckbox: typeof Forms.TopCheckbox;\r\n\t\tTopControlLabel: typeof Forms.TopControlLabel;\r\n\t\tTopHint: typeof Forms.TopHint;\r\n\t\tTopInput: typeof Forms.TopInput;\r\n\t\tTopInputDate: typeof Forms.TopInputDate;\r\n\t\tTopInputRange: typeof Forms.TopInputRange;\r\n\t\tTopRadio: typeof Forms.TopRadio;\r\n\t\tTopSwitcher: typeof Forms.TopSwitcher;\r\n\t\tTopTextarea: typeof Forms.TopTextarea;\r\n\t\tTopSelect: typeof Forms.TopSelect;\r\n\t\tTopLoadbar: typeof Forms.TopLoadbar;\r\n\t}\r\n}\r\n\r\ntype PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\r\n\r\ntype Options = PartialBy<typeof coreDefaultOptions, 'gmt'>;\r\n\r\n/**\r\n * Плагин для интеграции UI во Vue приложение\r\n *\r\n * - В глобальную область видимости шаблонов будет добавлен объект $core\r\n * - Будут зарегистрирвоаны директивы UI: https://ui.topvisor.com/?path=/docs/core-directives-focus--docs\r\n * - Будут подключены базовые компоненты UI/Forms: https://ui.topvisor.com/?path=/docs/components-forms-readme--docs\r\n */\r\nexport default {\r\n\r\n\tinstall: (app, options: Options) => {\r\n\t\tapp.config.globalProperties.$core = Core;\r\n\r\n\t\t// начальные настройки UI\r\n\t\tfor (const name in options) {\r\n\t\t\tCore.state[name] = options[name];\r\n\t\t}\r\n\r\n\t\tCore._setState();\r\n\r\n\t\t// определение директив\r\n\t\tapp.directive('top-focus', directiveFocus);\r\n\t\tapp.directive('top-sticky', directiveSticky);\r\n\t\tapp.directive('top-swim-up', directiveSwimUp);\r\n\t\tapp.directive('top-tooltip', directiveTooltip);\r\n\r\n\t\t// определение базовых компонентов\r\n\t\tapp.component('TopAvatar', Forms.TopAvatar);\r\n\t\tapp.component('TopButton', Forms.TopButton);\r\n\t\tapp.component('TopCheckbox', Forms.TopCheckbox);\r\n\t\tapp.component('TopControlLabel', Forms.TopControlLabel);\r\n\t\tapp.component('TopHint', Forms.TopHint);\r\n\t\tapp.component('TopInput', Forms.TopInput);\r\n\t\tapp.component('TopInputDate', Forms.TopInputDate);\r\n\t\tapp.component('TopInputRange', Forms.TopInputRange);\r\n\t\tapp.component('TopLoadbar', Forms.TopLoadbar);\r\n\t\tapp.component('TopRadio', Forms.TopRadio);\r\n\t\tapp.component('TopSelect', Forms.TopSelect);\r\n\t\tapp.component('TopSwitcher', Forms.TopSwitcher);\r\n\t\tapp.component('TopTextarea', Forms.TopTextarea);\r\n\r\n\t},\r\n\r\n} satisfies Plugin<Options>;\r\n","import type { PiniaPluginContext, Store } from 'pinia';\r\nimport { watch } from 'vue';\r\nimport { debounce } from 'lodash';\r\nimport { setClipboard } from '@/core/utils/clipboard';\r\nimport { camelToSnakeCase } from '@/core/utils/string.js';\r\nimport type { paths as OpenAPIPaths } from 'topvisor-openapi/src/ts/Topvisor';\r\nimport { getHash, setHash } from '@/core/utils/route';\r\n\r\ntype OpenAPIPath = keyof OpenAPIPaths;\r\n\r\nclass PiniaTPA {\r\n\r\n\treadonly #storeId: string;\r\n\treadonly #store: Store<'test', any>;\r\n\r\n\t/**\r\n\t * @deprecated\r\n\t */\r\n\treadonly #Page: any;\r\n\r\n\treadonly #user: any;\r\n\treadonly #Api: any;\r\n\r\n\treadonly #namesUrlHash: string[] = [];\r\n\treadonly #namesStorage: string[] = [];\r\n\treadonly #namesStorageLocal: string[] = [];\r\n\treadonly #namesGuestLink: string[] = [];\r\n\r\n\tconstructor(context: Context) {\r\n\t\tthis.#store = context.store;\r\n\t\tthis.#storeId = this.#store.$id;\r\n\r\n\t\tthis.#Page = context.options.Page;\r\n\r\n\t\tthis.#user = context.options.user;\r\n\t\tthis.#Api = context.options.Api;\r\n\r\n\t\tthis.#namesUrlHash = context.options.tpaNamesUrlHash || [];\r\n\t\tthis.#namesStorage = context.options.tpaNamesStorage || [];\r\n\t\tthis.#namesStorageLocal = context.options.tpaNamesStorageLocal || [];\r\n\t\tthis.#namesGuestLink = context.options.tpaNamesGuestLink || [];\r\n\r\n\t\tcontext.store.genGuestLink = <Path extends OpenAPIPath>(url: Path, data: any) => this.genGuestLink(url, data);\r\n\r\n\t\tif (!this.#user.guest_data?.data) {\r\n\t\t\tthis.#loadFromStorage();\r\n\t\t\tthis.#loadFromStorage(true);\r\n\r\n\t\t\t// настройки URL hash имеют приоритет\r\n\t\t\tthis.#loadFromHash();\r\n\t\t}\r\n\r\n\t\t// настройки гостевой ссылки имеют приоритет\r\n\t\tthis.#loadFromGuestLink();\r\n\r\n\t\tthis.#prepareParams();\r\n\r\n\t\tconst save = debounce(() => {\r\n\t\t\tthis.#saveInHash();\r\n\t\t\tthis.#saveInStorage();\r\n\t\t});\r\n\r\n\t\tcontext.store.$subscribe(save);\r\n\t}\r\n\r\n\t/**\r\n\t * Сгенерировать гостевую ссылку\r\n\t *\r\n\t * Метод, путь к которому указан в url, должен возвращать сгенерированную ссылку\r\n\t */\r\n\tasync genGuestLink<Path extends OpenAPIPath>(url: Path, data: any) {\r\n\t\tconst dataGuestLink = this.#genOptionsForGuestLink();\r\n\t\tdata = Object.assign(data, Object.fromEntries(dataGuestLink));\r\n\r\n\t\tconst res = await this.#Api.gen(url, 'fetchColumn').call({} as any, data);\r\n\r\n\t\t// @ts-ignore - метод, который скачивает файл не возвращает json\r\n\t\tif (res?.errors) return;\r\n\r\n\t\t// @ts-ignore - метод, который скачивает файл не возвращает json\r\n\t\tawait setClipboard(res.result);\r\n\r\n\t\t// TODO: Оформить через компонент messages\r\n\t\talert('Link copied');\r\n\t}\r\n\r\n\t/**\r\n\t * Сгенерировать опции для гостевой ссылки\r\n\t */\r\n\t#genOptionsForGuestLink() {\r\n\t\tconst data = new Map();\r\n\r\n\t\tthis.#namesGuestLink.forEach(name => {\r\n\t\t\t// формат параметров API: snake_case\r\n\t\t\tconst nameSnakeCase = camelToSnakeCase(name);\r\n\t\t\tdata.set(nameSnakeCase, this.#store[name]);\r\n\t\t});\r\n\r\n\t\treturn data;\r\n\t}\r\n\r\n\t/**\r\n\t * Установить опции из объекта без фиксации состояния\r\n\t */\r\n\t#setOptions(data: Map<string, any>) {\r\n\t\tif (Object.isFrozen(this)) throw 'Please, use setOptions only inner commit function';\r\n\r\n\t\tdata.forEach((value, name) => {\r\n\t\t\tconst currentValue = this.#store[name];\r\n\r\n\t\t\tif (value === null || value === undefined) return;\r\n\t\t\tif (!value?.constructor) return;\r\n\t\t\tif (value.constructor !== currentValue.constructor) return;\r\n\r\n\t\t\t// дополнительная проверка на формат даты\r\n\t\t\tif (name.indexOf('date') === 0) {\r\n\t\t\t\tif (Array.isArray(value)) {\r\n\t\t\t\t\t// value.forEach((valueI) => {\r\n\t\t\t\t\t// \tif (!/\\d\\d\\d\\d-\\d\\d-\\d\\d/.test(valueI)) return;\r\n\t\t\t\t\t// });\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (typeof (value) === 'string') {\r\n\t\t\t\t\t\tif (!/\\d\\d\\d\\d-\\d\\d-\\d\\d/.test(value)) return;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tthis.#store[name] = value;\r\n\t\t});\r\n\t}\r\n\r\n\t/**\r\n\t * Сгенерировать Map объект с опциями со значениями в виде json строк\r\n\t */\r\n\t#genDataFormat(data: Map<string, any>) {\r\n\t\tconst dataFormatted = new Map();\r\n\r\n\t\tdata.forEach((value, name) => {\r\n\t\t\tif (value === null) return;\r\n\r\n\t\t\tvalue = JSON.stringify(value);\r\n\r\n\t\t\tdataFormatted.set(name, value);\r\n\t\t});\r\n\r\n\t\treturn dataFormatted;\r\n\t}\r\n\r\n\t/**\r\n\t * Сгенерировать Map объект с опциями со значениями в оригинальном виде\r\n\t */\r\n\t#genDataUnFormat(dataFormatted: Map<string, string>) {\r\n\t\tconst data: Map<string, any> = new Map();\r\n\r\n\t\tdataFormatted.forEach((value, name) => {\r\n\t\t\tif (value === null || value === undefined || value === 'false') return;\r\n\r\n\t\t\ttry {\r\n\t\t\t\tif (typeof (value) === 'string' && !/^\\d\\d\\d\\d-\\d\\d-\\d\\d$/.test(value)) value = JSON.parse(value);\r\n\r\n\t\t\t\tif (value === null || value === undefined || value === 'false') return;\r\n\t\t\t} catch (e) {\r\n\t\t\t\t// не json строка\r\n\t\t\t}\r\n\r\n\t\t\tdata.set(name, value);\r\n\t\t});\r\n\r\n\t\treturn data;\r\n\t}\r\n\r\n\t/**\r\n\t * Установить опции из хеша адреса страницы\r\n\t */\r\n\t#loadFromHash() {\r\n\t\tlet dataHash: any;\r\n\t\ttry {\r\n\t\t\tdataHash = JSON.parse(getHash(this.#storeId));\r\n\t\t} catch (e) {\r\n\r\n\t\t}\r\n\t\tif (!dataHash) return;\r\n\r\n\t\tconst dataFormatted: Map<string, any> = new Map();\r\n\r\n\t\tthis.#namesUrlHash.forEach((name) => {\r\n\t\t\tconst value = dataHash[name];\r\n\t\t\tif (!value) return;\r\n\r\n\t\t\tdataFormatted.set(name, value);\r\n\t\t});\r\n\r\n\t\tconst data = this.#genDataUnFormat(dataFormatted);\r\n\r\n\t\tthis.#setOptions(data);\r\n\t}\r\n\r\n\t/**\r\n\t * Сохранить опции в хеш адреса страницы\r\n\t */\r\n\t#saveInHash() {\r\n\t\tconst data = new Map();\r\n\r\n\t\tthis.#namesUrlHash.forEach((name) => {\r\n\t\t\tconst value = this.#store[name];\r\n\r\n\t\t\tdata.set(name, value);\r\n\t\t});\r\n\r\n\t\tconst dataObject = Object.fromEntries(data);\r\n\t\tconst dataJSON = JSON.stringify(dataObject);\r\n\r\n\t\tsetHash(this.#storeId, dataJSON);\r\n\t};\r\n\r\n\t/**\r\n\t * Установить опции из localStorage\r\n\t * @param isLocal - сохранить с учетом адреса страницы\r\n\t */\r\n\t#loadFromStorage(isLocal = false) {\r\n\t\tconst dataFormatted = new Map();\r\n\r\n\t\t// let names = this.#namesStorage;\r\n\t\tlet storageNamespace = 'state:' + this.#storeId;\r\n\r\n\t\tif (isLocal) {\r\n\t\t\t// names = this.#namesStorageLocal;\r\n\t\t\tstorageNamespace = 'state:' + this.#storeId + ':' + location.pathname;\r\n\t\t}\r\n\r\n\t\tthis.#namesStorage.forEach((name) => {\r\n\t\t\tconst value = localStorage.getItem(storageNamespace + ':' + name);\r\n\t\t\tdataFormatted.set(name, value);\r\n\t\t});\r\n\r\n\t\tconst data = this.#genDataUnFormat(dataFormatted);\r\n\r\n\t\tthis.#setOptions(data);\r\n\t}\r\n\r\n\t/**\r\n\t * Сохранить опции в localStorage\r\n\t * @param isLocal - сохранить с учетом адреса страницы\r\n\t */\r\n\t#saveInStorage(isLocal = false) {\r\n\t\tconst data = new Map();\r\n\r\n\t\tlet names = this.#namesStorage;\r\n\t\tlet storageNamespace = 'state:' + this.#storeId;\r\n\r\n\t\tif (isLocal) {\r\n\t\t\tnames = this.#namesStorageLocal;\r\n\t\t\tstorageNamespace = 'state:' + this.#storeId + ':' + location.pathname;\r\n\t\t}\r\n\r\n\t\tnames.forEach((name) => {\r\n\t\t\tconst value = this.#store[name];\r\n\r\n\t\t\tdata.set(name, value);\r\n\t\t});\r\n\r\n\t\tconst dataFormatted = this.#genDataFormat(data);\r\n\r\n\t\tnames.forEach((name) => {\r\n\t\t\tconst value = dataFormatted.get(name);\r\n\r\n\t\t\tlocalStorage.setItem(storageNamespace + ':' + name, value);\r\n\t\t});\r\n\t}\r\n\r\n\t/**\r\n\t * Установить опции из гостевой ссылки\r\n\t */\r\n\t#loadFromGuestLink() {\r\n\t\tconst guestData = this.#user?.guest_data?.data;\r\n\t\tif (!guestData) return;\r\n\r\n\t\t// общие правила для гостевых сессий\r\n\t\tif (this.#user.id === -1) this.#user.positionsReverseDates = guestData.positionsReverseDates;\r\n\r\n\t\tconst dataFormatted = new Map();\r\n\r\n\t\tthis.#namesGuestLink.forEach((name) => {\r\n\t\t\tconst value = guestData[name];\r\n\t\t\tdataFormatted.set(name, value);\r\n\t\t});\r\n\r\n\t\tconst data = this.#genDataUnFormat(dataFormatted);\r\n\r\n\t\tthis.#setOptions(data);\r\n\r\n\t\tconst $guestTitle = $('.mod_guest_title');\r\n\r\n\t\t// TODO: вынести в опции плагина\r\n\t\tif (this.#store.competitorsIds?.length === 1 && this.#Page.page.data.competitors) {\r\n\t\t\tlet competitors = this.#Page.page.data.competitors.filter((competitor: any) => competitor.id === guestData.competitorsIds[0]);\r\n\t\t\tif (competitors.length) {\r\n\t\t\t\t$('a', $guestTitle).attr('href', 'http://' + competitors[0].url);\r\n\t\t\t\t$('a', $guestTitle).text(competitors[0].name);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Подготовить входные параметры перед инициализацией основного функционала\r\n\t *\r\n\t * Входные параметры устанавливаются при открытии страницы\r\n\t *\r\n\t * Входные параметры могут меняться пользоваталем и устаревать\r\n\t */\r\n\t#prepareParams() {\r\n\t\t// контролль за вводом регионов\r\n\t\t// TODO: вынести в опции плагина\r\n\t\tif (this.#store.regionsIndexes) {\r\n\t\t\twatch(this.#store, (regionsIndexes) => {\r\n\t\t\t\tif (!regionsIndexes.length) return;\r\n\r\n\t\t\t\t// приведение типа\r\n\t\t\t\tregionsIndexes.forEach((regionIndex: number, index: number) => regionsIndexes[index] = regionIndex);\r\n\r\n\t\t\t\t// оставить только включенные регионы\r\n\t\t\t\t// @ts-ignore\r\n\t\t\t\tconst mapSearchers = TplProjectSelectorRegion.genSearchersMap();\r\n\r\n\t\t\t\tconst availableRegionsIndexes: number[] = [];\r\n\t\t\t\tmapSearchers.forEach((searcher: any) => {\r\n\t\t\t\t\tsearcher.regions.forEach((region: any) => {\r\n\t\t\t\t\t\tif (region.index === -1) return;\r\n\r\n\t\t\t\t\t\tavailableRegionsIndexes.push(region.index);\r\n\t\t\t\t\t});\r\n\t\t\t\t});\r\n\r\n\t\t\t\tthis.#store.regionsIndexes = regionsIndexes.filter((regionIndex: number) => availableRegionsIndexes.includes(regionIndex));\r\n\t\t\t}, { immediate: true });\r\n\t\t}\r\n\r\n\t\t// контролль за вводом конкурентов\r\n\t\t// TODO: вынести в опции плагина\r\n\t\tif (this.#store.competitorsIds) {\r\n\t\t\twatch(this.#store, (competitorsIds) => {\r\n\t\t\t\tif (!competitorsIds.length) return;\r\n\r\n\t\t\t\t// приведение типа\r\n\t\t\t\tcompetitorsIds.forEach((competitorId: number, index: number) => competitorId[index] = competitorId);\r\n\r\n\t\t\t\t// оставить только включенных конкурентов\r\n\t\t\t\tconst availableCompetitorsIds = [this.#Page.page.data.project.id];\r\n\t\t\t\tthis.#Page.page.data.project.competitors.forEach((competitor: any) => {\r\n\t\t\t\t\tif (competitor.on >= 0) availableCompetitorsIds.push(competitor.id);\r\n\t\t\t\t});\r\n\r\n\t\t\t\tthis.#store.competitorsIds = competitorsIds.filter((competitorId: number) => availableCompetitorsIds.includes(competitorId));\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n}\r\n\r\ntype Options = {\r\n\t/**\r\n\t * TODO: Убрать из плагина\r\n\t */\r\n\tPage: any,\r\n\r\n\t/**\r\n\t * Объект с настройками пользователя\r\n\t */\r\n\tuser: any,\r\n\r\n\t/**\r\n\t * Объект для работы с API\r\n\t *\r\n\t * См. на айте: @/component/api/core/api.ts\r\n\t */\r\n\tApi: any;\r\n\r\n\t/**\r\n\t * Имена свойств для сохранения в URL\r\n\t */\r\n\ttpaNamesUrlHash?: string[],\r\n\r\n\t/**\r\n\t * Имена свойств для сохранения в localStorage\r\n\t */\r\n\ttpaNamesStorage?: string[],\r\n\r\n\t/**\r\n\t * Имена свойств для сохранения в localStorage с учетом пути URL\r\n\t *\r\n\t * Каждый URL будет работать со своим состоянием\r\n\t */\r\n\ttpaNamesStorageLocal?: string[],\r\n\r\n\t/**\r\n\t * Имена свойств для работы с гостевой ссылкой\r\n\t *\r\n\t * Для генерации гостевой ссылки используйте store.genGuestLink(data, url)\r\n\t */\r\n\ttpaNamesGuestLink?: string[],\r\n};\r\n\r\ntype Context = PiniaPluginContext & {\r\n\toptions: Options\r\n};\r\n\r\n/**\r\n * Плагин tpa (Third-party access) для pinia\r\n *\r\n * Добавляет возможность сохранять и загружать данные в/из:\r\n * \t- URL hash в адресе страницы\r\n * \t- localStorage\r\n * \t- гостевая ссылка\r\n *\r\n * Для подключения плагина нужно указань одну или несколько опций при определении defineStore():\r\n * - tpaNamesUrlHash\r\n * - tpaNamesStorage\r\n * - tpaNamesStorageLocal\r\n * - tpaNamesGuestLink\r\n */\r\nexport default (contextPinia: PiniaPluginContext) => {\r\n\tconst context = contextPinia as Context;\r\n\r\n\t// плагин подключать не нужно\r\n\tif (\r\n\t\t!context.options.tpaNamesUrlHash?.length &&\r\n\t\t!context.options.tpaNamesStorage?.length &&\r\n\t\t!context.options.tpaNamesStorageLocal?.length &&\r\n\t\t!context.options.tpaNamesGuestLink?.length\r\n\t) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tnew PiniaTPA(context);\r\n}\r\n"],"names":["focus","el","binding","appStickyObserver","sticky","_vnode","className","entries","condition","_el","_binding","appSwimUpInited","appSwimUpObserver","appSwimUpEls","swimUpElTransform","windowHeight","distance","percent","elTop","triggerHeightReducer","triggerHeight","swimUpInit","entry","swimUp","Core","_a","_b","$","tvTooltipGenOptions","vnode","options","tooltip","_prevVnode","instance","core","app","name","directiveFocus","directiveSticky","directiveSwimUp","directiveTooltip","Forms.TopAvatar","Forms.TopButton","Forms.TopCheckbox","Forms.TopControlLabel","Forms.TopHint","Forms.TopInput","Forms.TopInputDate","Forms.TopInputRange","Forms.TopLoadbar","Forms.TopRadio","Forms.TopSelect","Forms.TopSwitcher","Forms.TopTextarea","PiniaTPA","#storeId","#store","#Page","#user","#Api","#namesUrlHash","#namesStorage","#namesStorageLocal","#namesGuestLink","context","url","data","#loadFromStorage","#loadFromHash","#loadFromGuestLink","#prepareParams","save","debounce","#saveInHash","#saveInStorage","dataGuestLink","#genOptionsForGuestLink","res","setClipboard","nameSnakeCase","camelToSnakeCase","#setOptions","value","currentValue","#genDataFormat","dataFormatted","#genDataUnFormat","dataHash","getHash","dataObject","dataJSON","setHash","isLocal","storageNamespace","names","guestData","$guestTitle","_c","competitors","competitor","watch","regionsIndexes","regionIndex","index","mapSearchers","availableRegionsIndexes","searcher","region","competitorsIds","competitorId","availableCompetitorsIds","piniaTPA","contextPinia","_d"],"mappings":";;;;;;;AAKA,MAAMA,IAAQ;AAAA,EACb,SAAS,SAAUC,GAAiBC,GAA2B;AAC9D,IAAKA,EAAQ,MAAM,cAAa,MAAM;AAAA,EACvC;AACD;ACPA,IAAIC;AAMJ,MAAMC,IAAS;AAAA,EACd,QAAQH,GAAiBC,GAA2BG,GAAe;AAC5D,UAAAC,IAAYJ,EAAQ,SAAS;AAEf,IAAAC,IAAA,IAAI,qBAAqB,CAAWI,MAAA;AACvD,UAAIC,IAAYD,EAAQ,CAAC,EAAE,oBAAoB;AAC/C,MAAIC,KACCN,EAAQ,UAAU,UAAUK,EAAQ,CAAC,EAAE,iBAAiB,MAAM,MAAeC,IAAA,KAG/EP,EAAA,UAAU,OAAOK,GAAWE,CAAS;AAAA,IAAA,GACtC;AAAA,MACF,WAAW,CAAC,CAAC;AAAA,IAAA,CACb,GAEDL,EAAkB,QAAQF,CAAE;AAAA,EAC7B;AAAA,EAEA,UAAUQ,GAAkBC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AeE,IAAA,CAACC,MAAqC;;AACpD,QAAMhD,IAAUgD;AAGhB,EACC,GAACvF,IAAAuC,EAAQ,QAAQ,oBAAhB,QAAAvC,EAAiC,WAClC,GAACC,IAAAsC,EAAQ,QAAQ,oBAAhB,QAAAtC,EAAiC,WAClC,GAACuE,IAAAjC,EAAQ,QAAQ,yBAAhB,QAAAiC,EAAsC,WACvC,GAACgB,IAAAjD,EAAQ,QAAQ,sBAAhB,QAAAiD,EAAmC,WAKrC,IAAI3D,EAASU,CAAO;AACrB;"}
|
|
1
|
+
{"version":3,"file":"app.js","sources":["../../src/core/directives/focus.ts","../../src/core/directives/sticky.ts","../../src/core/directives/swimUp.ts","../../src/core/directives/tooltip.ts","../../src/core/plugins/core.ts","../../src/core/plugins/piniaTPA.ts"],"sourcesContent":["import type { DirectiveBinding, ObjectDirective } from 'vue';\r\n\r\n/**\r\n * Фокусировка на элементе сразу после его отображения\r\n */\r\nconst focus = {\r\n\tmounted: function (el: HTMLElement, binding: DirectiveBinding) {\r\n\t\tif (!binding.value.disabled) el.focus();\r\n\t},\r\n} satisfies ObjectDirective;\r\n\r\nexport default focus;\r\n","import type { DirectiveBinding, ObjectDirective, VNode } from 'vue';\r\n\r\nlet appStickyObserver: IntersectionObserver;\r\n\r\n/**\r\n * Добавление sticky\r\n * К элементу добляется класс переданный как значение диррективы либо **'top-sticky'** по умолчанию\r\n */\r\nconst sticky = {\r\n\tmounted(el: HTMLElement, binding: DirectiveBinding, _vnode: VNode) {\r\n\t\tconst className = binding.value || 'top-sticky';\r\n\r\n\t\tappStickyObserver = new IntersectionObserver(entries => {\r\n\t\t\tlet condition = entries[0].intersectionRatio < 1;\r\n\t\t\tif (condition) {\r\n\t\t\t\tif (binding.modifiers.bottom && entries[0].intersectionRect.y === 0) condition = false;\r\n\t\t\t}\r\n\r\n\t\t\tel.classList.toggle(className, condition);\r\n\t\t}, {\r\n\t\t\tthreshold: [1],\r\n\t\t});\r\n\r\n\t\tappStickyObserver.observe(el);\r\n\t},\r\n\r\n\tunmounted(_el: HTMLElement, _binding: DirectiveBinding, _vnode: VNode) {\r\n\t\tappStickyObserver?.disconnect();\r\n\t},\r\n} satisfies ObjectDirective;\r\n\r\nexport default sticky;\r\n","import type { DirectiveBinding, ObjectDirective, VNode } from 'vue';\r\nimport Core from '@/core/core/core';\r\n\r\ninterface HTMLElementWithSwimUpOptions extends HTMLElement {\r\n\tdirectiveSwipUpOptions: {\r\n\t\tdistance: number,\r\n\t\tpercent: number,\r\n\t};\r\n}\r\n\r\nlet appSwimUpInited = false;\r\nlet appSwimUpObserver: IntersectionObserver;\r\nconst appSwimUpEls = new Map();\r\n\r\n/**\r\n * Отодвинуть блок в зависимости от скролла старинцы\r\n * @param el\r\n * @param windowHeight\r\n */\r\nconst swimUpElTransform = (el: HTMLElementWithSwimUpOptions, windowHeight: number): void => {\r\n\tconst { distance, percent } = el.directiveSwipUpOptions;\r\n\r\n\tconst elTop = el.getBoundingClientRect().top;\r\n\r\n\t// во столько раз triggerHeight должен быть меньше, чтобы закончить подплытие к нужной высоте экрана\r\n\tconst triggerHeightReducer = windowHeight * percent / 100 / distance;\r\n\tconst triggerHeight = (windowHeight - elTop) / triggerHeightReducer;\r\n\r\n\tif (triggerHeight <= distance) {\r\n\t\tel.style.transform = `translateY(${distance - triggerHeight}px)`;\r\n\t} else {\r\n\t\tel.style.transform = 'translateY(0px)';\r\n\t}\r\n};\r\n\r\nconst swimUpInit = (el: HTMLElementWithSwimUpOptions): void => {\r\n\tlet windowHeight = window.innerHeight;\r\n\r\n\twindow.addEventListener('scroll', () => {\r\n\t\tappSwimUpEls.forEach((el) => swimUpElTransform(el, windowHeight));\r\n\t}, { passive: true });\r\n\r\n\t// проверка того, что элемент в зоне видимости\r\n\tappSwimUpObserver = new IntersectionObserver(entries => {\r\n\t\twindowHeight = window.innerHeight;\r\n\r\n\t\tentries.forEach((entry) => {\r\n\t\t\tconst el = entry.target as HTMLElementWithSwimUpOptions;\r\n\r\n\t\t\tif (entry.intersectionRatio < 0.1) {\r\n\t\t\t\t// элемент за областью видимости\r\n\t\t\t\tappSwimUpEls.delete(el);\r\n\t\t\t} else {\r\n\t\t\t\t// элемент на экране\r\n\t\t\t\tappSwimUpEls.set(el, el);\r\n\t\t\t}\r\n\r\n\t\t\tif (entry.intersectionRatio === 0) {\r\n\t\t\t\tconst { distance } = el.directiveSwipUpOptions;\r\n\t\t\t\tel.style.transform = `translateY(${distance}px)`;\r\n\t\t\t}\r\n\t\t});\r\n\t}, {\r\n\t\tthreshold: 0.1,\r\n\t});\r\n};\r\n\r\n/**\r\n * Добавление анимации подплытия вверх для блока\r\n */\r\nconst swimUp = {\r\n\tmounted(el: HTMLElementWithSwimUpOptions, binding: DirectiveBinding, _vnode: VNode): void {\r\n\t\tif (Core.state.isMobileUA) return;\r\n\r\n\t\tel.directiveSwipUpOptions = {\r\n\t\t\tdistance: binding.value?.distance ?? 100, // количество px на которые блок изначально смещен вниз,\r\n\t\t\tpercent: binding.value?.percent ?? 30, // процент высоты экрана поднявшись на который блок закончит подплытие\r\n\t\t};\r\n\r\n\t\tif (!appSwimUpInited) {\r\n\t\t\tswimUpInit(el);\r\n\r\n\t\t\tappSwimUpInited = true;\r\n\t\t}\r\n\r\n\t\tappSwimUpObserver.observe(el);\r\n\t},\r\n\r\n\tunmounted(el: HTMLElementWithSwimUpOptions, _binding: DirectiveBinding, _vnode: VNode) {\r\n\t\tappSwimUpEls.delete(el);\r\n\t\tappSwimUpObserver?.unobserve(el);\r\n\t},\r\n} satisfies ObjectDirective;\r\n\r\nexport default swimUp;\r\n","import type { DirectiveBinding, ObjectDirective, VNode } from 'vue';\r\nimport Core from '@/core/core/core';\r\n\r\nconst $ = (el: VNode) => {\r\n\tif (!Core.$?.ui?.tooltip) {\r\n\t\tconsole.info('Для работы v-top-tooltip требуется глобальная загрузка jQuery UI Tooltip');\r\n\r\n\t\treturn;\r\n\t}\r\n\r\n\treturn Core.$(el);\r\n};\r\n\r\nconst tvTooltipGenOptions = (binding: DirectiveBinding, vnode: VNode) => {\r\n\tconst options = binding.value ?? {};\r\n\r\n\toptions.content ??= vnode.props?.title;\r\n\toptions.content = String(options.content).replace(/\\r\\n|\\r|\\n/g, '<br>');\r\n\r\n\toptions.position ??= {\r\n\t\tmy: 'bottom-18px',\r\n\t\tat: 'top center',\r\n\t};\r\n\r\n\treturn options;\r\n};\r\n\r\n/**\r\n * Добавление всплывающей подсказки к элементу.\r\n */\r\nconst tooltip = {\r\n\tmounted(el: VNode, binding: DirectiveBinding, vnode: VNode) {\r\n\t\t$(el)?.tooltip(tvTooltipGenOptions(binding, vnode));\r\n\t},\r\n\r\n\tupdated(el: VNode, binding: DirectiveBinding, vnode: VNode, _prevVnode: VNode) {\r\n\t\t/**\r\n\t\t * В результате обновления может быть открыто несколько тултипов поэтому изменить опции, без перерисовки тултипа\r\n\t\t */\r\n\t\tconst options = tvTooltipGenOptions(binding, vnode);\r\n\t\tconst instance = $(el)?.tooltip('instance') as { options: JQueryUI.TooltipOptions } | undefined;\r\n\t\tif (!instance) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tinstance.options = {\r\n\t\t\t...instance.options,\r\n\t\t\t...options,\r\n\t\t};\r\n\t},\r\n\r\n\tunmounted(el: VNode, _binding: DirectiveBinding, _vnode: VNode) {\r\n\t\t$(el)?.tooltip('destroy');\r\n\t},\r\n} satisfies ObjectDirective;\r\n\r\nexport default tooltip;","import type { Plugin } from 'vue';\r\nimport Core from '@/core/core/core';\r\nimport coreDefaultOptions from '@/core/core/options';\r\nimport * as Forms from '../../components/forms/forms';\r\nimport directiveFocus from '@/core/directives/focus';\r\nimport directiveSticky from '@/core/directives/sticky';\r\nimport directiveSwimUp from '@/core/directives/swimUp';\r\nimport directiveTooltip from '@/core/directives/tooltip';\r\n\r\ndeclare module 'vue' {\r\n\texport interface ComponentCustomProperties {\r\n\t\t/**\r\n\t\t * Статический класс с текущим состоянимем UI\r\n\t\t */\r\n\t\t$core: typeof Core;\r\n\t}\r\n\r\n\t/**\r\n\t * Обязательные компоненты UI\r\n\t *\r\n\t * Они подключаются через плагин и доступны без явного указания импорта\r\n\t */\r\n\texport interface GlobalComponents {\r\n\t\tTopAvatar: typeof Forms.TopAvatar;\r\n\t\tTopButton: typeof Forms.TopButton;\r\n\t\tTopCheckbox: typeof Forms.TopCheckbox;\r\n\t\tTopControlLabel: typeof Forms.TopControlLabel;\r\n\t\tTopHint: typeof Forms.TopHint;\r\n\t\tTopInput: typeof Forms.TopInput;\r\n\t\tTopInputDate: typeof Forms.TopInputDate;\r\n\t\tTopInputRange: typeof Forms.TopInputRange;\r\n\t\tTopRadio: typeof Forms.TopRadio;\r\n\t\tTopSwitcher: typeof Forms.TopSwitcher;\r\n\t\tTopTextarea: typeof Forms.TopTextarea;\r\n\t\tTopSelect: typeof Forms.TopSelect;\r\n\t\tTopLoadbar: typeof Forms.TopLoadbar;\r\n\t}\r\n}\r\n\r\ntype PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\r\n\r\ntype Options = PartialBy<typeof coreDefaultOptions, 'gmt'>;\r\n\r\n/**\r\n * Плагин для интеграции UI во Vue приложение\r\n *\r\n * - В глобальную область видимости шаблонов будет добавлен объект $core\r\n * - Будут зарегистрирвоаны директивы UI: https://ui.topvisor.com/?path=/docs/core-directives-focus--docs\r\n * - Будут подключены базовые компоненты UI/Forms: https://ui.topvisor.com/?path=/docs/components-forms-readme--docs\r\n */\r\nexport default {\r\n\r\n\tinstall: (app, options: Options) => {\r\n\t\tapp.config.globalProperties.$core2 = Core;\r\n\r\n\t\t// начальные настройки UI\r\n\t\tfor (const name in options) {\r\n\t\t\tCore.state[name] = options[name];\r\n\t\t}\r\n\r\n\t\tCore._setState();\r\n\r\n\t\t// определение директив\r\n\t\tapp.directive('top-focus', directiveFocus);\r\n\t\tapp.directive('top-sticky', directiveSticky);\r\n\t\tapp.directive('top-swim-up', directiveSwimUp);\r\n\t\tapp.directive('top-tooltip', directiveTooltip);\r\n\r\n\t\t// определение базовых компонентов\r\n\t\tapp.component('TopAvatar', Forms.TopAvatar);\r\n\t\tapp.component('TopButton', Forms.TopButton);\r\n\t\tapp.component('TopCheckbox', Forms.TopCheckbox);\r\n\t\tapp.component('TopControlLabel', Forms.TopControlLabel);\r\n\t\tapp.component('TopHint', Forms.TopHint);\r\n\t\tapp.component('TopInput', Forms.TopInput);\r\n\t\tapp.component('TopInputDate', Forms.TopInputDate);\r\n\t\tapp.component('TopInputRange', Forms.TopInputRange);\r\n\t\tapp.component('TopLoadbar', Forms.TopLoadbar);\r\n\t\tapp.component('TopRadio', Forms.TopRadio);\r\n\t\tapp.component('TopSelect', Forms.TopSelect);\r\n\t\tapp.component('TopSwitcher', Forms.TopSwitcher);\r\n\t\tapp.component('TopTextarea', Forms.TopTextarea);\r\n\r\n\t},\r\n\r\n} satisfies Plugin<Options>;\r\n","import type { PiniaPluginContext, Store } from 'pinia';\r\nimport { watch } from 'vue';\r\nimport { debounce } from 'lodash';\r\nimport { setClipboard } from '@/core/utils/clipboard';\r\nimport { camelToSnakeCase } from '@/core/utils/string.js';\r\nimport type { paths as OpenAPIPaths } from 'topvisor-openapi/src/ts/Topvisor';\r\nimport { getHash, setHash } from '@/core/utils/route';\r\n\r\ntype OpenAPIPath = keyof OpenAPIPaths;\r\n\r\nclass PiniaTPA {\r\n\r\n\treadonly #storeId: string;\r\n\treadonly #store: Store<'test', any>;\r\n\r\n\t/**\r\n\t * @deprecated\r\n\t */\r\n\treadonly #Page: any;\r\n\r\n\treadonly #user: any;\r\n\treadonly #Api: any;\r\n\r\n\treadonly #namesUrlHash: string[] = [];\r\n\treadonly #namesStorage: string[] = [];\r\n\treadonly #namesStorageLocal: string[] = [];\r\n\treadonly #namesGuestLink: string[] = [];\r\n\r\n\tconstructor(context: Context) {\r\n\t\tthis.#store = context.store;\r\n\t\tthis.#storeId = this.#store.$id;\r\n\r\n\t\tthis.#Page = context.options.Page;\r\n\r\n\t\tthis.#user = context.options.user;\r\n\t\tthis.#Api = context.options.Api;\r\n\r\n\t\tthis.#namesUrlHash = context.options.tpaNamesUrlHash || [];\r\n\t\tthis.#namesStorage = context.options.tpaNamesStorage || [];\r\n\t\tthis.#namesStorageLocal = context.options.tpaNamesStorageLocal || [];\r\n\t\tthis.#namesGuestLink = context.options.tpaNamesGuestLink || [];\r\n\r\n\t\tcontext.store.genGuestLink = <Path extends OpenAPIPath>(url: Path, data: any) => this.genGuestLink(url, data);\r\n\r\n\t\tif (!this.#user.guest_data?.data) {\r\n\t\t\tthis.#loadFromStorage();\r\n\t\t\tthis.#loadFromStorage(true);\r\n\r\n\t\t\t// настройки URL hash имеют приоритет\r\n\t\t\tthis.#loadFromHash();\r\n\t\t}\r\n\r\n\t\t// настройки гостевой ссылки имеют приоритет\r\n\t\tthis.#loadFromGuestLink();\r\n\r\n\t\tthis.#prepareParams();\r\n\r\n\t\tconst save = debounce(() => {\r\n\t\t\tthis.#saveInHash();\r\n\t\t\tthis.#saveInStorage();\r\n\t\t});\r\n\r\n\t\tcontext.store.$subscribe(save);\r\n\t}\r\n\r\n\t/**\r\n\t * Сгенерировать гостевую ссылку\r\n\t *\r\n\t * Метод, путь к которому указан в url, должен возвращать сгенерированную ссылку\r\n\t */\r\n\tasync genGuestLink<Path extends OpenAPIPath>(url: Path, data: any) {\r\n\t\tconst dataGuestLink = this.#genOptionsForGuestLink();\r\n\t\tdata = Object.assign(data, Object.fromEntries(dataGuestLink));\r\n\r\n\t\tconst res = await this.#Api.gen(url, 'fetchColumn').call({} as any, data);\r\n\r\n\t\t// @ts-ignore - метод, который скачивает файл не возвращает json\r\n\t\tif (res?.errors) return;\r\n\r\n\t\t// @ts-ignore - метод, который скачивает файл не возвращает json\r\n\t\tawait setClipboard(res.result);\r\n\r\n\t\t// TODO: Оформить через компонент messages\r\n\t\talert('Link copied');\r\n\t}\r\n\r\n\t/**\r\n\t * Сгенерировать опции для гостевой ссылки\r\n\t */\r\n\t#genOptionsForGuestLink() {\r\n\t\tconst data = new Map();\r\n\r\n\t\tthis.#namesGuestLink.forEach(name => {\r\n\t\t\t// формат параметров API: snake_case\r\n\t\t\tconst nameSnakeCase = camelToSnakeCase(name);\r\n\t\t\tdata.set(nameSnakeCase, this.#store[name]);\r\n\t\t});\r\n\r\n\t\treturn data;\r\n\t}\r\n\r\n\t/**\r\n\t * Установить опции из объекта без фиксации состояния\r\n\t */\r\n\t#setOptions(data: Map<string, any>) {\r\n\t\tif (Object.isFrozen(this)) throw 'Please, use setOptions only inner commit function';\r\n\r\n\t\tdata.forEach((value, name) => {\r\n\t\t\tconst currentValue = this.#store[name];\r\n\r\n\t\t\tif (value === null || value === undefined) return;\r\n\t\t\tif (!value?.constructor) return;\r\n\t\t\tif (value.constructor !== currentValue.constructor) return;\r\n\r\n\t\t\t// дополнительная проверка на формат даты\r\n\t\t\tif (name.indexOf('date') === 0) {\r\n\t\t\t\tif (Array.isArray(value)) {\r\n\t\t\t\t\t// value.forEach((valueI) => {\r\n\t\t\t\t\t// \tif (!/\\d\\d\\d\\d-\\d\\d-\\d\\d/.test(valueI)) return;\r\n\t\t\t\t\t// });\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (typeof (value) === 'string') {\r\n\t\t\t\t\t\tif (!/\\d\\d\\d\\d-\\d\\d-\\d\\d/.test(value)) return;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tthis.#store[name] = value;\r\n\t\t});\r\n\t}\r\n\r\n\t/**\r\n\t * Сгенерировать Map объект с опциями со значениями в виде json строк\r\n\t */\r\n\t#genDataFormat(data: Map<string, any>) {\r\n\t\tconst dataFormatted = new Map();\r\n\r\n\t\tdata.forEach((value, name) => {\r\n\t\t\tif (value === null) return;\r\n\r\n\t\t\tvalue = JSON.stringify(value);\r\n\r\n\t\t\tdataFormatted.set(name, value);\r\n\t\t});\r\n\r\n\t\treturn dataFormatted;\r\n\t}\r\n\r\n\t/**\r\n\t * Сгенерировать Map объект с опциями со значениями в оригинальном виде\r\n\t */\r\n\t#genDataUnFormat(dataFormatted: Map<string, string>) {\r\n\t\tconst data: Map<string, any> = new Map();\r\n\r\n\t\tdataFormatted.forEach((value, name) => {\r\n\t\t\tif (value === null || value === undefined || value === 'false') return;\r\n\r\n\t\t\ttry {\r\n\t\t\t\tif (typeof (value) === 'string' && !/^\\d\\d\\d\\d-\\d\\d-\\d\\d$/.test(value)) value = JSON.parse(value);\r\n\r\n\t\t\t\tif (value === null || value === undefined || value === 'false') return;\r\n\t\t\t} catch (e) {\r\n\t\t\t\t// не json строка\r\n\t\t\t}\r\n\r\n\t\t\tdata.set(name, value);\r\n\t\t});\r\n\r\n\t\treturn data;\r\n\t}\r\n\r\n\t/**\r\n\t * Установить опции из хеша адреса страницы\r\n\t */\r\n\t#loadFromHash() {\r\n\t\tlet dataHash: any;\r\n\t\ttry {\r\n\t\t\tdataHash = JSON.parse(getHash(this.#storeId));\r\n\t\t} catch (e) {\r\n\r\n\t\t}\r\n\t\tif (!dataHash) return;\r\n\r\n\t\tconst dataFormatted: Map<string, any> = new Map();\r\n\r\n\t\tthis.#namesUrlHash.forEach((name) => {\r\n\t\t\tconst value = dataHash[name];\r\n\t\t\tif (!value) return;\r\n\r\n\t\t\tdataFormatted.set(name, value);\r\n\t\t});\r\n\r\n\t\tconst data = this.#genDataUnFormat(dataFormatted);\r\n\r\n\t\tthis.#setOptions(data);\r\n\t}\r\n\r\n\t/**\r\n\t * Сохранить опции в хеш адреса страницы\r\n\t */\r\n\t#saveInHash() {\r\n\t\tconst data = new Map();\r\n\r\n\t\tthis.#namesUrlHash.forEach((name) => {\r\n\t\t\tconst value = this.#store[name];\r\n\r\n\t\t\tdata.set(name, value);\r\n\t\t});\r\n\r\n\t\tconst dataObject = Object.fromEntries(data);\r\n\t\tconst dataJSON = JSON.stringify(dataObject);\r\n\r\n\t\tsetHash(this.#storeId, dataJSON);\r\n\t};\r\n\r\n\t/**\r\n\t * Установить опции из localStorage\r\n\t * @param isLocal - сохранить с учетом адреса страницы\r\n\t */\r\n\t#loadFromStorage(isLocal = false) {\r\n\t\tconst dataFormatted = new Map();\r\n\r\n\t\t// let names = this.#namesStorage;\r\n\t\tlet storageNamespace = 'state:' + this.#storeId;\r\n\r\n\t\tif (isLocal) {\r\n\t\t\t// names = this.#namesStorageLocal;\r\n\t\t\tstorageNamespace = 'state:' + this.#storeId + ':' + location.pathname;\r\n\t\t}\r\n\r\n\t\tthis.#namesStorage.forEach((name) => {\r\n\t\t\tconst value = localStorage.getItem(storageNamespace + ':' + name);\r\n\t\t\tdataFormatted.set(name, value);\r\n\t\t});\r\n\r\n\t\tconst data = this.#genDataUnFormat(dataFormatted);\r\n\r\n\t\tthis.#setOptions(data);\r\n\t}\r\n\r\n\t/**\r\n\t * Сохранить опции в localStorage\r\n\t * @param isLocal - сохранить с учетом адреса страницы\r\n\t */\r\n\t#saveInStorage(isLocal = false) {\r\n\t\tconst data = new Map();\r\n\r\n\t\tlet names = this.#namesStorage;\r\n\t\tlet storageNamespace = 'state:' + this.#storeId;\r\n\r\n\t\tif (isLocal) {\r\n\t\t\tnames = this.#namesStorageLocal;\r\n\t\t\tstorageNamespace = 'state:' + this.#storeId + ':' + location.pathname;\r\n\t\t}\r\n\r\n\t\tnames.forEach((name) => {\r\n\t\t\tconst value = this.#store[name];\r\n\r\n\t\t\tdata.set(name, value);\r\n\t\t});\r\n\r\n\t\tconst dataFormatted = this.#genDataFormat(data);\r\n\r\n\t\tnames.forEach((name) => {\r\n\t\t\tconst value = dataFormatted.get(name);\r\n\r\n\t\t\tlocalStorage.setItem(storageNamespace + ':' + name, value);\r\n\t\t});\r\n\t}\r\n\r\n\t/**\r\n\t * Установить опции из гостевой ссылки\r\n\t */\r\n\t#loadFromGuestLink() {\r\n\t\tconst guestData = this.#user?.guest_data?.data;\r\n\t\tif (!guestData) return;\r\n\r\n\t\t// общие правила для гостевых сессий\r\n\t\tif (this.#user.id === -1) this.#user.positionsReverseDates = guestData.positionsReverseDates;\r\n\r\n\t\tconst dataFormatted = new Map();\r\n\r\n\t\tthis.#namesGuestLink.forEach((name) => {\r\n\t\t\tconst value = guestData[name];\r\n\t\t\tdataFormatted.set(name, value);\r\n\t\t});\r\n\r\n\t\tconst data = this.#genDataUnFormat(dataFormatted);\r\n\r\n\t\tthis.#setOptions(data);\r\n\r\n\t\tconst $guestTitle = $('.mod_guest_title');\r\n\r\n\t\t// TODO: вынести в опции плагина\r\n\t\tif (this.#store.competitorsIds?.length === 1 && this.#Page.page.data.competitors) {\r\n\t\t\tlet competitors = this.#Page.page.data.competitors.filter((competitor: any) => competitor.id === guestData.competitorsIds[0]);\r\n\t\t\tif (competitors.length) {\r\n\t\t\t\t$('a', $guestTitle).attr('href', 'http://' + competitors[0].url);\r\n\t\t\t\t$('a', $guestTitle).text(competitors[0].name);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Подготовить входные параметры перед инициализацией основного функционала\r\n\t *\r\n\t * Входные параметры устанавливаются при открытии страницы\r\n\t *\r\n\t * Входные параметры могут меняться пользоваталем и устаревать\r\n\t */\r\n\t#prepareParams() {\r\n\t\t// контролль за вводом регионов\r\n\t\t// TODO: вынести в опции плагина\r\n\t\tif (this.#store.regionsIndexes) {\r\n\t\t\twatch(this.#store, (regionsIndexes) => {\r\n\t\t\t\tif (!regionsIndexes.length) return;\r\n\r\n\t\t\t\t// приведение типа\r\n\t\t\t\tregionsIndexes.forEach((regionIndex: number, index: number) => regionsIndexes[index] = regionIndex);\r\n\r\n\t\t\t\t// оставить только включенные регионы\r\n\t\t\t\t// @ts-ignore\r\n\t\t\t\tconst mapSearchers = TplProjectSelectorRegion.genSearchersMap();\r\n\r\n\t\t\t\tconst availableRegionsIndexes: number[] = [];\r\n\t\t\t\tmapSearchers.forEach((searcher: any) => {\r\n\t\t\t\t\tsearcher.regions.forEach((region: any) => {\r\n\t\t\t\t\t\tif (region.index === -1) return;\r\n\r\n\t\t\t\t\t\tavailableRegionsIndexes.push(region.index);\r\n\t\t\t\t\t});\r\n\t\t\t\t});\r\n\r\n\t\t\t\tthis.#store.regionsIndexes = regionsIndexes.filter((regionIndex: number) => availableRegionsIndexes.includes(regionIndex));\r\n\t\t\t}, { immediate: true });\r\n\t\t}\r\n\r\n\t\t// контролль за вводом конкурентов\r\n\t\t// TODO: вынести в опции плагина\r\n\t\tif (this.#store.competitorsIds) {\r\n\t\t\twatch(this.#store, (competitorsIds) => {\r\n\t\t\t\tif (!competitorsIds.length) return;\r\n\r\n\t\t\t\t// приведение типа\r\n\t\t\t\tcompetitorsIds.forEach((competitorId: number, index: number) => competitorId[index] = competitorId);\r\n\r\n\t\t\t\t// оставить только включенных конкурентов\r\n\t\t\t\tconst availableCompetitorsIds = [this.#Page.page.data.project.id];\r\n\t\t\t\tthis.#Page.page.data.project.competitors.forEach((competitor: any) => {\r\n\t\t\t\t\tif (competitor.on >= 0) availableCompetitorsIds.push(competitor.id);\r\n\t\t\t\t});\r\n\r\n\t\t\t\tthis.#store.competitorsIds = competitorsIds.filter((competitorId: number) => availableCompetitorsIds.includes(competitorId));\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n}\r\n\r\ntype Options = {\r\n\t/**\r\n\t * TODO: Убрать из плагина\r\n\t */\r\n\tPage: any,\r\n\r\n\t/**\r\n\t * Объект с настройками пользователя\r\n\t */\r\n\tuser: any,\r\n\r\n\t/**\r\n\t * Объект для работы с API\r\n\t *\r\n\t * См. на айте: @/component/api/core/api.ts\r\n\t */\r\n\tApi: any;\r\n\r\n\t/**\r\n\t * Имена свойств для сохранения в URL\r\n\t */\r\n\ttpaNamesUrlHash?: string[],\r\n\r\n\t/**\r\n\t * Имена свойств для сохранения в localStorage\r\n\t */\r\n\ttpaNamesStorage?: string[],\r\n\r\n\t/**\r\n\t * Имена свойств для сохранения в localStorage с учетом пути URL\r\n\t *\r\n\t * Каждый URL будет работать со своим состоянием\r\n\t */\r\n\ttpaNamesStorageLocal?: string[],\r\n\r\n\t/**\r\n\t * Имена свойств для работы с гостевой ссылкой\r\n\t *\r\n\t * Для генерации гостевой ссылки используйте store.genGuestLink(data, url)\r\n\t */\r\n\ttpaNamesGuestLink?: string[],\r\n};\r\n\r\ntype Context = PiniaPluginContext & {\r\n\toptions: Options\r\n};\r\n\r\n/**\r\n * Плагин tpa (Third-party access) для pinia\r\n *\r\n * Добавляет возможность сохранять и загружать данные в/из:\r\n * \t- URL hash в адресе страницы\r\n * \t- localStorage\r\n * \t- гостевая ссылка\r\n *\r\n * Для подключения плагина нужно указань одну или несколько опций при определении defineStore():\r\n * - tpaNamesUrlHash\r\n * - tpaNamesStorage\r\n * - tpaNamesStorageLocal\r\n * - tpaNamesGuestLink\r\n */\r\nexport default (contextPinia: PiniaPluginContext) => {\r\n\tconst context = contextPinia as Context;\r\n\r\n\t// плагин подключать не нужно\r\n\tif (\r\n\t\t!context.options.tpaNamesUrlHash?.length &&\r\n\t\t!context.options.tpaNamesStorage?.length &&\r\n\t\t!context.options.tpaNamesStorageLocal?.length &&\r\n\t\t!context.options.tpaNamesGuestLink?.length\r\n\t) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tnew PiniaTPA(context);\r\n}\r\n"],"names":["focus","el","binding","appStickyObserver","sticky","_vnode","className","entries","condition","_el","_binding","appSwimUpInited","appSwimUpObserver","appSwimUpEls","swimUpElTransform","windowHeight","distance","percent","elTop","triggerHeightReducer","triggerHeight","swimUpInit","entry","swimUp","Core","_a","_b","$","tvTooltipGenOptions","vnode","options","tooltip","_prevVnode","instance","core","app","name","directiveFocus","directiveSticky","directiveSwimUp","directiveTooltip","Forms.TopAvatar","Forms.TopButton","Forms.TopCheckbox","Forms.TopControlLabel","Forms.TopHint","Forms.TopInput","Forms.TopInputDate","Forms.TopInputRange","Forms.TopLoadbar","Forms.TopRadio","Forms.TopSelect","Forms.TopSwitcher","Forms.TopTextarea","PiniaTPA","#storeId","#store","#Page","#user","#Api","#namesUrlHash","#namesStorage","#namesStorageLocal","#namesGuestLink","context","url","data","#loadFromStorage","#loadFromHash","#loadFromGuestLink","#prepareParams","save","debounce","#saveInHash","#saveInStorage","dataGuestLink","#genOptionsForGuestLink","res","setClipboard","nameSnakeCase","camelToSnakeCase","#setOptions","value","currentValue","#genDataFormat","dataFormatted","#genDataUnFormat","dataHash","getHash","dataObject","dataJSON","setHash","isLocal","storageNamespace","names","guestData","$guestTitle","_c","competitors","competitor","watch","regionsIndexes","regionIndex","index","mapSearchers","availableRegionsIndexes","searcher","region","competitorsIds","competitorId","availableCompetitorsIds","piniaTPA","contextPinia","_d"],"mappings":";;;;;;;AAKA,MAAMA,IAAQ;AAAA,EACb,SAAS,SAAUC,GAAiBC,GAA2B;AAC9D,IAAKA,EAAQ,MAAM,cAAa,MAAM;AAAA,EACvC;AACD;ACPA,IAAIC;AAMJ,MAAMC,IAAS;AAAA,EACd,QAAQH,GAAiBC,GAA2BG,GAAe;AAC5D,UAAAC,IAAYJ,EAAQ,SAAS;AAEf,IAAAC,IAAA,IAAI,qBAAqB,CAAWI,MAAA;AACvD,UAAIC,IAAYD,EAAQ,CAAC,EAAE,oBAAoB;AAC/C,MAAIC,KACCN,EAAQ,UAAU,UAAUK,EAAQ,CAAC,EAAE,iBAAiB,MAAM,MAAeC,IAAA,KAG/EP,EAAA,UAAU,OAAOK,GAAWE,CAAS;AAAA,IAAA,GACtC;AAAA,MACF,WAAW,CAAC,CAAC;AAAA,IAAA,CACb,GAEDL,EAAkB,QAAQF,CAAE;AAAA,EAC7B;AAAA,EAEA,UAAUQ,GAAkBC,GAA4BL,GAAe;AACtE,IAAAF,KAAA,QAAAA,EAAmB;AAAA,EACpB;AACD;ACnBA,IAAIQ,IAAkB,IAClBC;AACJ,MAAMC,wBAAmB,OAOnBC,IAAoB,CAACb,GAAkCc,MAA+B;AAC3F,QAAM,EAAE,UAAAC,GAAU,SAAAC,MAAYhB,EAAG,wBAE3BiB,IAAQjB,EAAG,sBAAA,EAAwB,KAGnCkB,IAAuBJ,IAAeE,IAAU,MAAMD,GACtDI,KAAiBL,IAAeG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ASU,CAAO;AACrB;"}
|
package/core/core/core.d.ts
CHANGED
|
@@ -36,44 +36,4 @@ export default class Core {
|
|
|
36
36
|
* Проверить скрыта страница или нет
|
|
37
37
|
*/
|
|
38
38
|
static isHidden: () => boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Вставить css стили на страницу по ссылке с автоматическим добавлением правил media
|
|
41
|
-
*
|
|
42
|
-
* Правила media:
|
|
43
|
-
* - Файлы *.m.css будут грузиться, только на экранах с шириной менее, чем Core.widthForMobile
|
|
44
|
-
* - Файлы *.pc.css будут грузиться, только на экранах с шириной более, чем Core.widthForMobile
|
|
45
|
-
*
|
|
46
|
-
* Настройкой Core.widthForMobile можно управлять через plugin: @topvisor/ui/plugin/core
|
|
47
|
-
*
|
|
48
|
-
* @param fileNames - список ссылок на css файлы
|
|
49
|
-
* @param useSync - использовать синхронную загрузку css, только для css с того же домена. В синхронном режиме стили предзагружаются независимо от
|
|
50
|
-
* media
|
|
51
|
-
*/
|
|
52
|
-
static insertCSSLinkToPage: (fileNames: Array<string>, useSync?: boolean) => Promise<unknown[]>;
|
|
53
|
-
private static _insertToPage;
|
|
54
|
-
/**
|
|
55
|
-
* Вставить css стили на страницу с автоматическим добавлением правил media
|
|
56
|
-
*
|
|
57
|
-
* Загрузка с Vite:
|
|
58
|
-
*
|
|
59
|
-
* ```js
|
|
60
|
-
* import style from '/style.css?raw';
|
|
61
|
-
*
|
|
62
|
-
* insertToPageAsInine(style);
|
|
63
|
-
* ```
|
|
64
|
-
*
|
|
65
|
-
* Загрузка с fetch:
|
|
66
|
-
*
|
|
67
|
-
* ```js
|
|
68
|
-
* const style = await fetch('./style.css');
|
|
69
|
-
*
|
|
70
|
-
* insertToPageAsInine(style);
|
|
71
|
-
* ```
|
|
72
|
-
*
|
|
73
|
-
* @param style - css стили в строке
|
|
74
|
-
* @param type - если указать 'm' или 'pc', то стили будут применяться по условию в зависимости от настройки this.widthForMobile
|
|
75
|
-
*
|
|
76
|
-
* @see insertToPage
|
|
77
|
-
*/
|
|
78
|
-
static insertStyleToPage: (style: string, type?: "" | "m" | "pc") => void;
|
|
79
39
|
}
|
package/core/core.amd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
define(["require","exports","vue","../.chunks/forms-
|
|
1
|
+
define(["require","exports","vue","../.chunks/forms-oowSA2rF.amd"],function(i,e,u,r){"use strict";if(typeof u>"u")var u=window.Vue;e.default=r.Core,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
2
2
|
//# sourceMappingURL=core.amd.js.map
|
package/core/core.js
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Упраление загрузками стилей
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Вставить css стили на страницу по ссылке с автоматическим добавлением правил media
|
|
7
|
+
*
|
|
8
|
+
* Правила media:
|
|
9
|
+
* - Файлы *.m.css будут грузиться, только на экранах с шириной менее, чем Core.widthForMobile
|
|
10
|
+
* - Файлы *.pc.css будут грузиться, только на экранах с шириной более, чем Core.widthForMobile
|
|
11
|
+
*
|
|
12
|
+
* Настройкой Core.widthForMobile можно управлять через plugin: @topvisor/ui/plugin/core
|
|
13
|
+
*
|
|
14
|
+
* @param fileNames - список ссылок на css файлы
|
|
15
|
+
* @param useSync - использовать синхронную загрузку css, только для css с того же домена. В синхронном режиме стили предзагружаются независимо от
|
|
16
|
+
* media
|
|
17
|
+
*/
|
|
18
|
+
export declare const insertToPage: (fileNames: Array<string>, useSync?: boolean) => Promise<unknown[]>;
|
|
19
|
+
/**
|
|
20
|
+
* Вставить css стили на страницу с автоматическим добавлением правил media
|
|
21
|
+
*
|
|
22
|
+
* Загрузка с Vite:
|
|
23
|
+
*
|
|
24
|
+
* ```js
|
|
25
|
+
* import style from '/style.css?raw';
|
|
26
|
+
*
|
|
27
|
+
* insertToPageAsInine(style);
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* Загрузка с fetch:
|
|
31
|
+
*
|
|
32
|
+
* ```js
|
|
33
|
+
* const style = await fetch('./style.css');
|
|
34
|
+
*
|
|
35
|
+
* insertToPageAsInine(style);
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @param style - css стили в строке
|
|
39
|
+
* @param type - если указать 'm' или 'pc', то стили будут применяться по условию в зависимости от настройки this.widthForMobile
|
|
40
|
+
*
|
|
41
|
+
* @see insertToPage
|
|
42
|
+
*/
|
|
43
|
+
export declare const insertToPageAsInine: (style: string, type?: "" | "m" | "pc") => void;
|
package/forms/forms.amd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
define(["require","exports","../.chunks/forms-
|
|
1
|
+
define(["require","exports","../.chunks/forms-oowSA2rF.amd"],function(n,T,a){"use strict";if(typeof e>"u")var e=window.Vue;T.TopAvatar=a.TopAvatar,T.TopButton=a.TopButton$1,T.TopCheckbox=a.TopCheckbox,T.TopControlLabel=a.TopControlLabel,T.TopHint=a.TopHint,T.TopInput=a.TopInput$1,T.TopInputDate=a.TopInputDate,T.TopInputRange=a.TopInputRange,T.TopLoadbar=a.TopLoadbar,T.TopRadio=a.TopRadio,T.TopSelect=a.TopSelect,T.TopSwitcher=a.TopSwitcher,T.TopTextarea=a.TopTextarea,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})});
|
|
2
2
|
//# sourceMappingURL=forms.amd.js.map
|
package/forms/forms.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as p, c as T, e as s, f as t, g as e, h as n, j as r, k as b, l as c, m as l, n as u, o as h, p as i } from "../.chunks/forms-
|
|
1
|
+
import { b as p, c as T, e as s, f as t, g as e, h as n, j as r, k as b, l as c, m as l, n as u, o as h, p as i } from "../.chunks/forms-CPEVHoks.es.js";
|
|
2
2
|
export {
|
|
3
3
|
p as TopAvatar,
|
|
4
4
|
T as TopButton,
|
package/formsExt/formsExt.amd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
define(["require","exports","vue","../.chunks/forms-KR6uVX5Z.amd","../utils/keyboard.amd","../popup/popup.amd","lodash","../.chunks/menu-CNIQ9vFJ.amd","../require/css.amd!../assets/formsExt.css"],function(se,b,e,h,M,w,E,$){"use strict";if(typeof e>"u")var e=window.Vue;const S={class:"top-editArea_footer"},I=e.defineComponent({__name:"editArea",props:{defaultValue:{default:""},title:{},cancelText:{default:"Cancel"},submitText:{default:"Send"},closeText:{default:"Close"},isFocused:{type:Boolean},forceShowCloseBtn:{type:Boolean},attachToKeyboard:{type:Boolean},modelValue:{},name:{},placeholder:{},rows:{},minHeight:{},expandable:{type:Boolean,default:!0},disabled:{type:Boolean},readonly:{type:Boolean},isError:{type:Boolean},hint:{}},emits:["submit","close","clickOnTitle"],setup(i,{emit:c}){const t=i,r=c,m=e.ref(t.defaultValue),f=e.ref(t.isFocused),s=e.computed(()=>m.value!==t.defaultValue),p=e.computed(()=>t.attachToKeyboard?"":t.forceShowCloseBtn&&!s.value?t.closeText:t.cancelText),u=d=>{r("submit",d),m.value=t.defaultValue},v=()=>{if(t.forceShowCloseBtn&&!s.value){r("close");return}m.value=t.defaultValue},B=()=>{t.attachToKeyboard&&r("clickOnTitle")};return(d,l)=>{const V=e.resolveDirective("top-focus");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"top-editArea":!0,"top-editArea-attachedToKeyboard":d.attachToKeyboard})},[d.title?(e.openBlock(),e.createElementBlock("div",{key:0,class:"top-editArea_title",onClick:l[0]||(l[0]=y=>B())},e.toDisplayString(d.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass({"top-editArea_form":!0,"top-error":d.isError,"top-focus":f.value})},[e.withDirectives(e.createVNode(h.Textarea,{modelValue:m.value,"onUpdate:modelValue":l[1]||(l[1]=y=>m.value=y),name:d.name,placeholder:d.placeholder,rows:d.rows,minHeight:d.minHeight,expandable:d.expandable,disabled:d.disabled,readonly:d.readonly,isError:d.isError,hint:d.hint,class:"top-editArea_element",onFocus:l[2]||(l[2]=()=>f.value=!0),onBlur:l[3]||(l[3]=()=>f.value=!1),onKeyup:[e.withKeys(v,["esc"]),l[4]||(l[4]=e.withKeys(e.withModifiers(y=>u(m.value),["ctrl"]),["enter"]))]},null,8,["modelValue","name","placeholder","rows","minHeight","expandable","disabled","readonly","isError","hint"]),[[V,{disabled:!f.value}]]),e.createElementVNode("div",S,[s.value||d.forceShowCloseBtn?(e.openBlock(),e.createBlock(h.TopButton,{key:0,class:"top-editArea_button",color:"theme",styling:"soft",icon:d.attachToKeyboard?"":"",onClick:v},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(p.value),1)]),_:1},8,["icon"])):e.createCommentVNode("",!0),s.value?(e.openBlock(),e.createBlock(h.TopButton,{key:1,class:"top-editArea_button",icon:d.attachToKeyboard?"":"",onClick:l[5]||(l[5]=y=>u(m.value))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.attachToKeyboard?"":d.submitText),1)]),_:1},8,["icon"])):e.createCommentVNode("",!0)])],2)],2)}}}),N={$style:{"top-editArea":"top-editArea","top-editArea_title":"top-editArea_title","top-editArea_form":"top-editArea_form","top-focus":"top-focus","top-textarea":"top-textarea","top-editArea_element":"top-editArea_element","top-textarea_textarea":"top-textarea_textarea","top-editArea_footer":"top-editArea_footer","top-editArea-attachedToKeyboard":"top-editArea-attachedToKeyboard","top-button":"top-button","top-editArea_button":"top-editArea_button"}},K=h._export_sfc(I,[["__cssModules",N]]),L={class:"top-editInput"},P=e.defineComponent({__name:"editInput",props:{modelValue:{},input:{},button:{}},emits:["update:modelValue"],setup(i,{emit:c}){const t=i,r=e.ref(t.modelValue);e.watch(e.toRef(t.modelValue),()=>{r.value=t.modelValue});const m=c,f=()=>{m("update:modelValue",r.value)};return(s,p)=>(e.openBlock(),e.createElementBlock("div",L,[e.createVNode(h.TopInput,e.mergeProps(s.input,{onKeydownCapture:p[0]||(p[0]=e.withKeys(e.withModifiers(u=>r.value=s.modelValue,["stop"]),["esc"])),onKeydown:e.withKeys(e.withModifiers(f,["stop"]),["enter"]),modelValue:r.value,"onUpdate:modelValue":p[1]||(p[1]=u=>r.value=u)}),null,16,["onKeydown","modelValue"]),r.value!==s.modelValue?(e.openBlock(),e.createBlock(h.TopButton,e.mergeProps({key:0,icon:"",styling:"soft"},s.button,{onClick:f}),null,16)):e.createCommentVNode("",!0)]))}}),G={$style:{"top-editInput":"top-editInput","top-input":"top-input"}},D=h._export_sfc(P,[["__cssModules",G]]),O=["data-top-icon","onClick"],z={key:0,class:"top-radioGroup_circle"},F=["value","disabled"],H=e.defineComponent({__name:"radioGroup",props:e.mergeModels({modelValue:{},radiosProps:{},showIndicator:{type:Boolean},size:{default:"s"},isError:{type:Boolean}},{modelValue:{required:!0},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue"],["update:modelValue"]),setup(i,{emit:c}){const t=e.useModel(i,"modelValue"),r=i,m=e.ref(null);e.watch(t,()=>{var s,p,u,v,B;(s=r.radiosProps)!=null&&s.some(d=>d.value===t.value)||(t.value=((u=(p=r.radiosProps)==null?void 0:p[0])==null?void 0:u.value)??""),(B=(v=m.value)==null?void 0:v.querySelector(".radioGroup_item-selected"))==null||B.scrollIntoView()},{immediate:!0});const f="radioGroup-"+Math.random();return(s,p)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"elRef",ref:m,class:e.normalizeClass({"top-radioGroup":!0,"top-scrollBarXHidding":!0,["top-size_"+s.size]:!!s.size,"top-error":s.isError})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.radiosProps,u=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass({"top-radioGroup_item-selected":u.value===t.value,"top-radioGroup_item":!0,"top-forms-focusable":!0,"top-disabled":u.disabled}),"data-top-icon":u.icon,onClick:v=>t.value=u.value},[e.createTextVNode(e.toDisplayString(u.title)+" ",1),s.showIndicator?(e.openBlock(),e.createElementBlock("span",z)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":p[0]||(p[0]=v=>t.value=v),name:f,type:"radio",class:e.normalizeClass({"top-unvisible":!0}),value:u.value,disabled:u.disabled},null,8,F),[[e.vModelRadio,t.value]])],10,O))),256))],2))}}),x={$style:{"top-scrollBarXHidding":"top-scrollBarXHidding","top-radioGroup":"top-radioGroup","top-radioGroup_item":"top-radioGroup_item","top-radioGroup_item-selected":"top-radioGroup_item-selected","top-radioGroup_circle":"top-radioGroup_circle","top-disabled":"top-disabled","top-error":"top-error"}},U=h._export_sfc(H,[["__cssModules",x]]),W=(i,c,t)=>{const r=e.ref([]),m=e.ref(!1);let f="",s;i&&!i.params.limit&&(i.params.limit=100);const p=async()=>{if(!i)return;let l,V;if(t&&(i.cache??=new Map,V=JSON.stringify(i.params),l=i.cache.get(V),l))return l;if(m.value=!0,l=await i.call(),m.value=!1,l.errors)return;if(!Array.isArray(l.result)){console.warn("В result ожидался массив");return}const y=l.result.findIndex(A=>A.id===void 0||A.name===void 0);if(y!==-1){console.warn(`В result[${y}] нет id или name`);return}return t&&i.cache.set(V,l),l},u=async()=>{if(!i)return;i.params.offset=0,i.params.search=f;const l=await p();l&&(s=l.nextOffset,r.value=l.result)},v=async()=>{if(!i||!s||m.value)return;i.params.offset=s,i.params.search=f;const l=await p();l&&(s=l.nextOffset,r.value=r.value.concat(l.result))},B=E.debounce(()=>u(),200);return{items:r,isLoading:m,loadAppend:v,setSearchTextAndLoad:(l,V=!0)=>{i&&(l.length<c||l===f&&r.value.length||(f=l,V?B():u()))}}},J={class:"top-selector2_itemMulti top-ellipsis"},R=e.defineComponent({__name:"itemMulti",props:{id:{},name:{}},emits:["delete"],setup(i){return(c,t)=>(e.openBlock(),e.createElementBlock("div",J,[e.createTextVNode(e.toDisplayString(c.name)+" ",1),e.createElementVNode("span",{class:"top-selector2_itemMultiDelete","data-top-icon":"",onClick:t[0]||(t[0]=r=>c.$emit("delete",c.id)),onMousedown:t[1]||(t[1]=e.withModifiers(()=>{},["stop"]))},null,32)]))}}),X={$style:{"top-selector2_itemMulti":"top-selector2_itemMulti","top-selector2_itemMultiDelete":"top-selector2_itemMultiDelete","top-selector2":"top-selector2","top-active":"top-active"}},j=h._export_sfc(R,[["__cssModules",X]]),Y={key:0,class:"top-selector2_activeItems"},Q={key:1,class:"top-selector2_activeName top-ellipsis"},Z=e.defineComponent({__name:"selector2",props:e.mergeModels({modelValue:{},items:{default:()=>[]},multiselect:{type:Boolean},disabled:{type:Boolean},size:{default:"s"},isError:{type:Boolean},apiRequest:{},minLength:{default:0},useCache:{type:Boolean},appendSearchToResult:{type:Boolean},appendAllValue:{type:Boolean},addChanger:{type:Boolean},placeholder:{},showSelectedInInput:{type:Boolean,default:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(i){const c=i,t=e.useModel(i,"modelValue"),r=e.ref(""),m={id:0,name:"Все"},f=e.ref(null),s=()=>{var o;return(o=f.value)==null?void 0:o.popup};window.__STORYBOOK_PREVIEW__&&!c.modelValue&&e.watch(()=>c.multiselect,()=>{t.value=c.multiselect?[]:{id:null,name:""}},{immediate:!0});const p=W(c.apiRequest,c.minLength,c.useCache),u=e.computed(()=>{const o=[];return!c.multiselect&&c.appendAllValue&&o.push(m),c.items.forEach(n=>o.push({...n})),o}),v=(o,n=!0)=>n&&o.id===null?Array.isArray(t.value)?t.value.some(a=>a.id===o.id&&a.name===o.name):o.name===t.value.name:Array.isArray(t.value)?t.value.some(a=>a.id===o.id):o.id===t.value.id,B=e.computed(()=>{const o=r.value.toLowerCase(),n=M.invertKeyboardLayout(o);let a=[];return u.value.forEach(k=>{const g=k.name.toLowerCase();(k.id===Number(o)||g.includes(o)||g.includes(n))&&(g===o||g===n?a.unshift(k):a.push(k))}),a.push(...p.items.value),c.appendSearchToResult&&r.value&&(!a.length||a[0].name.toLowerCase()!==o)&&a.push({id:null,name:r.value}),c.multiselect&&(a=a.filter(k=>!v(k))),a}),d=async o=>{var n,a;if(c.multiselect){if(!Array.isArray(t.value)||v(o))return;const k=[...t.value];k.push({...o}),t.value=k,h.Core.state.isMobile?(n=s())==null||n.close():setTimeout(()=>{var g,C,T,_;(g=s())==null||g.recalcPosition(),(_=(T=(C=s())==null?void 0:C.elPopupWidget)==null?void 0:T.querySelector("input"))==null||_.focus(),r.value&&(B.value.length||(r.value="",p.items.value=[]))})}else r.value&&(r.value="",p.items.value=[]),JSON.stringify(o)!==JSON.stringify(t.value)&&(t.value={...o}),(a=s())==null||a.close()},l=()=>{if(!Array.isArray(t.value)){const n=(u.value.findIndex(a=>a.id===t.value.id)+1)%u.value.length;t.value={...u.value[n]}}},V=async o=>{Array.isArray(t.value)&&(t.value=t.value.filter(n=>n.id!==o),setTimeout(()=>{var n;(n=s())==null||n.recalcPosition()}))},y=e.ref(!1);c.apiRequest&&(e.watch(y,()=>{y.value&&p.setSearchTextAndLoad(r.value,!1)}),e.watch(r,()=>p.setSearchTextAndLoad(r.value)));const A=o=>{const n=o.target;n.scrollTop/(n.scrollHeight-n.offsetHeight)>.8&&p.loadAppend()};return(o,n)=>(e.openBlock(),e.createBlock(e.unref(w.TopPopup),{ref_key:"popupRef",ref:f,onOpen:n[1]||(n[1]=a=>y.value=!0),onClose:n[2]||(n[2]=a=>y.value=!1),onScrollContentList:n[3]||(n[3]=a=>o.apiRequest?A(a):void 0),notch:!1,transitionDuration:0},{opener:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass({"top-selector2":!0,"top-selector2-multiselect":o.multiselect,["top-size_"+o.size]:!0,"top-disabled":o.disabled,"top-forms-focusable":!o.disabled,"top-error":o.isError})},[o.multiselect?(e.openBlock(),e.createElementBlock("div",Y,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.value,a=>(e.openBlock(),e.createBlock(j,{id:a.id,name:a.name,onDelete:V},null,8,["id","name"]))),256))])):e.createCommentVNode("",!0),o.multiselect?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Q,e.toDisplayString(Array.isArray(t.value)?"":t.value.name),1)),o.addChanger&&!o.multiselect&&u.value.length>1&&!o.disabled?(e.openBlock(),e.createElementBlock("span",{key:2,class:"top-changer top-changer-selector",onClick:e.withModifiers(l,["stop"])})):e.createCommentVNode("",!0)],2)]),widget:e.withCtx(()=>[e.createVNode(e.unref(w.TopPopupWidgetInput),{title:"Поиск",icon:"",modelValue:r.value,"onUpdate:modelValue":n[0]||(n[0]=a=>r.value=a),isLoading:e.unref(p).isLoading.value,placeholder:!Array.isArray(t.value)&&!o.multiselect&&o.showSelectedInInput?t.value.name:o.placeholder},null,8,["modelValue","isLoading","placeholder"])]),contentList:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(B.value,a=>(e.openBlock(),e.createBlock(e.unref(w.TopPopupListItem),{class:e.normalizeClass({"top-active":!Array.isArray(t.value)&&!o.multiselect&&t.value.name===a.name}),key:a.id??void 0,onClick:e.withModifiers(k=>d(a),["stop"])},{default:e.withCtx(()=>[o.$slots.item?e.renderSlot(o.$slots,"item",{key:0,item:a}):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(a.name),1)],64))]),_:2},1032,["class","onClick"]))),128)),B.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(w.TopPopupListItem),{key:0,type:"regular"},{default:e.withCtx(()=>[e.createTextVNode(" Нет результатов ")]),_:1}))]),_:3},512))}}),q={$style:{"top-selector2":"top-selector2","top-selector2-multiselect":"top-selector2-multiselect","top-active":"top-active","top-selector2_activeItems":"top-selector2_activeItems","top-selector2_activeName":"top-selector2_activeName","top-changer-selector":"top-changer-selector"}},ee=h._export_sfc(Z,[["__cssModules",q]]),te=K,oe=D,le=U,ae=ee,re=$.Menu;b.TopEditArea=te,b.TopEditInput=oe,b.TopMenu=re,b.TopRadioGroup=le,b.TopSelector2=ae,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
define(["require","exports","vue","../.chunks/forms-oowSA2rF.amd","../utils/keyboard.amd","../popup/popup.amd","lodash","../.chunks/menu-SmyeSNWQ.amd","../require/css.amd!../assets/formsExt.css"],function(se,b,e,h,M,w,E,$){"use strict";if(typeof e>"u")var e=window.Vue;const S={class:"top-editArea_footer"},I=e.defineComponent({__name:"editArea",props:{defaultValue:{default:""},title:{},cancelText:{default:"Cancel"},submitText:{default:"Send"},closeText:{default:"Close"},isFocused:{type:Boolean},forceShowCloseBtn:{type:Boolean},attachToKeyboard:{type:Boolean},modelValue:{},name:{},placeholder:{},rows:{},minHeight:{},expandable:{type:Boolean,default:!0},disabled:{type:Boolean},readonly:{type:Boolean},isError:{type:Boolean},hint:{}},emits:["submit","close","clickOnTitle"],setup(i,{emit:c}){const t=i,r=c,m=e.ref(t.defaultValue),f=e.ref(t.isFocused),s=e.computed(()=>m.value!==t.defaultValue),p=e.computed(()=>t.attachToKeyboard?"":t.forceShowCloseBtn&&!s.value?t.closeText:t.cancelText),u=d=>{r("submit",d),m.value=t.defaultValue},v=()=>{if(t.forceShowCloseBtn&&!s.value){r("close");return}m.value=t.defaultValue},B=()=>{t.attachToKeyboard&&r("clickOnTitle")};return(d,l)=>{const V=e.resolveDirective("top-focus");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"top-editArea":!0,"top-editArea-attachedToKeyboard":d.attachToKeyboard})},[d.title?(e.openBlock(),e.createElementBlock("div",{key:0,class:"top-editArea_title",onClick:l[0]||(l[0]=y=>B())},e.toDisplayString(d.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass({"top-editArea_form":!0,"top-error":d.isError,"top-focus":f.value})},[e.withDirectives(e.createVNode(h.Textarea,{modelValue:m.value,"onUpdate:modelValue":l[1]||(l[1]=y=>m.value=y),name:d.name,placeholder:d.placeholder,rows:d.rows,minHeight:d.minHeight,expandable:d.expandable,disabled:d.disabled,readonly:d.readonly,isError:d.isError,hint:d.hint,class:"top-editArea_element",onFocus:l[2]||(l[2]=()=>f.value=!0),onBlur:l[3]||(l[3]=()=>f.value=!1),onKeyup:[e.withKeys(v,["esc"]),l[4]||(l[4]=e.withKeys(e.withModifiers(y=>u(m.value),["ctrl"]),["enter"]))]},null,8,["modelValue","name","placeholder","rows","minHeight","expandable","disabled","readonly","isError","hint"]),[[V,{disabled:!f.value}]]),e.createElementVNode("div",S,[s.value||d.forceShowCloseBtn?(e.openBlock(),e.createBlock(h.TopButton,{key:0,class:"top-editArea_button",color:"theme",styling:"soft",icon:d.attachToKeyboard?"":"",onClick:v},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(p.value),1)]),_:1},8,["icon"])):e.createCommentVNode("",!0),s.value?(e.openBlock(),e.createBlock(h.TopButton,{key:1,class:"top-editArea_button",icon:d.attachToKeyboard?"":"",onClick:l[5]||(l[5]=y=>u(m.value))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.attachToKeyboard?"":d.submitText),1)]),_:1},8,["icon"])):e.createCommentVNode("",!0)])],2)],2)}}}),N={$style:{"top-editArea":"top-editArea","top-editArea_title":"top-editArea_title","top-editArea_form":"top-editArea_form","top-focus":"top-focus","top-textarea":"top-textarea","top-editArea_element":"top-editArea_element","top-textarea_textarea":"top-textarea_textarea","top-editArea_footer":"top-editArea_footer","top-editArea-attachedToKeyboard":"top-editArea-attachedToKeyboard","top-button":"top-button","top-editArea_button":"top-editArea_button"}},K=h._export_sfc(I,[["__cssModules",N]]),L={class:"top-editInput"},P=e.defineComponent({__name:"editInput",props:{modelValue:{},input:{},button:{}},emits:["update:modelValue"],setup(i,{emit:c}){const t=i,r=e.ref(t.modelValue);e.watch(e.toRef(t.modelValue),()=>{r.value=t.modelValue});const m=c,f=()=>{m("update:modelValue",r.value)};return(s,p)=>(e.openBlock(),e.createElementBlock("div",L,[e.createVNode(h.TopInput,e.mergeProps(s.input,{onKeydownCapture:p[0]||(p[0]=e.withKeys(e.withModifiers(u=>r.value=s.modelValue,["stop"]),["esc"])),onKeydown:e.withKeys(e.withModifiers(f,["stop"]),["enter"]),modelValue:r.value,"onUpdate:modelValue":p[1]||(p[1]=u=>r.value=u)}),null,16,["onKeydown","modelValue"]),r.value!==s.modelValue?(e.openBlock(),e.createBlock(h.TopButton,e.mergeProps({key:0,icon:"",styling:"soft"},s.button,{onClick:f}),null,16)):e.createCommentVNode("",!0)]))}}),G={$style:{"top-editInput":"top-editInput","top-input":"top-input"}},D=h._export_sfc(P,[["__cssModules",G]]),O=["data-top-icon","onClick"],z={key:0,class:"top-radioGroup_circle"},F=["value","disabled"],H=e.defineComponent({__name:"radioGroup",props:e.mergeModels({modelValue:{},radiosProps:{},showIndicator:{type:Boolean},size:{default:"s"},isError:{type:Boolean}},{modelValue:{required:!0},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue"],["update:modelValue"]),setup(i,{emit:c}){const t=e.useModel(i,"modelValue"),r=i,m=e.ref(null);e.watch(t,()=>{var s,p,u,v,B;(s=r.radiosProps)!=null&&s.some(d=>d.value===t.value)||(t.value=((u=(p=r.radiosProps)==null?void 0:p[0])==null?void 0:u.value)??""),(B=(v=m.value)==null?void 0:v.querySelector(".radioGroup_item-selected"))==null||B.scrollIntoView()},{immediate:!0});const f="radioGroup-"+Math.random();return(s,p)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"elRef",ref:m,class:e.normalizeClass({"top-radioGroup":!0,"top-scrollBarXHidding":!0,["top-size_"+s.size]:!!s.size,"top-error":s.isError})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.radiosProps,u=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass({"top-radioGroup_item-selected":u.value===t.value,"top-radioGroup_item":!0,"top-forms-focusable":!0,"top-disabled":u.disabled}),"data-top-icon":u.icon,onClick:v=>t.value=u.value},[e.createTextVNode(e.toDisplayString(u.title)+" ",1),s.showIndicator?(e.openBlock(),e.createElementBlock("span",z)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":p[0]||(p[0]=v=>t.value=v),name:f,type:"radio",class:e.normalizeClass({"top-unvisible":!0}),value:u.value,disabled:u.disabled},null,8,F),[[e.vModelRadio,t.value]])],10,O))),256))],2))}}),x={$style:{"top-scrollBarXHidding":"top-scrollBarXHidding","top-radioGroup":"top-radioGroup","top-radioGroup_item":"top-radioGroup_item","top-radioGroup_item-selected":"top-radioGroup_item-selected","top-radioGroup_circle":"top-radioGroup_circle","top-disabled":"top-disabled","top-error":"top-error"}},U=h._export_sfc(H,[["__cssModules",x]]),W=(i,c,t)=>{const r=e.ref([]),m=e.ref(!1);let f="",s;i&&!i.params.limit&&(i.params.limit=100);const p=async()=>{if(!i)return;let l,V;if(t&&(i.cache??=new Map,V=JSON.stringify(i.params),l=i.cache.get(V),l))return l;if(m.value=!0,l=await i.call(),m.value=!1,l.errors)return;if(!Array.isArray(l.result)){console.warn("В result ожидался массив");return}const y=l.result.findIndex(A=>A.id===void 0||A.name===void 0);if(y!==-1){console.warn(`В result[${y}] нет id или name`);return}return t&&i.cache.set(V,l),l},u=async()=>{if(!i)return;i.params.offset=0,i.params.search=f;const l=await p();l&&(s=l.nextOffset,r.value=l.result)},v=async()=>{if(!i||!s||m.value)return;i.params.offset=s,i.params.search=f;const l=await p();l&&(s=l.nextOffset,r.value=r.value.concat(l.result))},B=E.debounce(()=>u(),200);return{items:r,isLoading:m,loadAppend:v,setSearchTextAndLoad:(l,V=!0)=>{i&&(l.length<c||l===f&&r.value.length||(f=l,V?B():u()))}}},J={class:"top-selector2_itemMulti top-ellipsis"},R=e.defineComponent({__name:"itemMulti",props:{id:{},name:{}},emits:["delete"],setup(i){return(c,t)=>(e.openBlock(),e.createElementBlock("div",J,[e.createTextVNode(e.toDisplayString(c.name)+" ",1),e.createElementVNode("span",{class:"top-selector2_itemMultiDelete","data-top-icon":"",onClick:t[0]||(t[0]=r=>c.$emit("delete",c.id)),onMousedown:t[1]||(t[1]=e.withModifiers(()=>{},["stop"]))},null,32)]))}}),X={$style:{"top-selector2_itemMulti":"top-selector2_itemMulti","top-selector2_itemMultiDelete":"top-selector2_itemMultiDelete","top-selector2":"top-selector2","top-active":"top-active"}},j=h._export_sfc(R,[["__cssModules",X]]),Y={key:0,class:"top-selector2_activeItems"},Q={key:1,class:"top-selector2_activeName top-ellipsis"},Z=e.defineComponent({__name:"selector2",props:e.mergeModels({modelValue:{},items:{default:()=>[]},multiselect:{type:Boolean},disabled:{type:Boolean},size:{default:"s"},isError:{type:Boolean},apiRequest:{},minLength:{default:0},useCache:{type:Boolean},appendSearchToResult:{type:Boolean},appendAllValue:{type:Boolean},addChanger:{type:Boolean},placeholder:{},showSelectedInInput:{type:Boolean,default:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(i){const c=i,t=e.useModel(i,"modelValue"),r=e.ref(""),m={id:0,name:"Все"},f=e.ref(null),s=()=>{var o;return(o=f.value)==null?void 0:o.popup};window.__STORYBOOK_PREVIEW__&&!c.modelValue&&e.watch(()=>c.multiselect,()=>{t.value=c.multiselect?[]:{id:null,name:""}},{immediate:!0});const p=W(c.apiRequest,c.minLength,c.useCache),u=e.computed(()=>{const o=[];return!c.multiselect&&c.appendAllValue&&o.push(m),c.items.forEach(n=>o.push({...n})),o}),v=(o,n=!0)=>n&&o.id===null?Array.isArray(t.value)?t.value.some(a=>a.id===o.id&&a.name===o.name):o.name===t.value.name:Array.isArray(t.value)?t.value.some(a=>a.id===o.id):o.id===t.value.id,B=e.computed(()=>{const o=r.value.toLowerCase(),n=M.invertKeyboardLayout(o);let a=[];return u.value.forEach(k=>{const g=k.name.toLowerCase();(k.id===Number(o)||g.includes(o)||g.includes(n))&&(g===o||g===n?a.unshift(k):a.push(k))}),a.push(...p.items.value),c.appendSearchToResult&&r.value&&(!a.length||a[0].name.toLowerCase()!==o)&&a.push({id:null,name:r.value}),c.multiselect&&(a=a.filter(k=>!v(k))),a}),d=async o=>{var n,a;if(c.multiselect){if(!Array.isArray(t.value)||v(o))return;const k=[...t.value];k.push({...o}),t.value=k,h.Core.state.isMobile?(n=s())==null||n.close():setTimeout(()=>{var g,C,T,_;(g=s())==null||g.recalcPosition(),(_=(T=(C=s())==null?void 0:C.elPopupWidget)==null?void 0:T.querySelector("input"))==null||_.focus(),r.value&&(B.value.length||(r.value="",p.items.value=[]))})}else r.value&&(r.value="",p.items.value=[]),JSON.stringify(o)!==JSON.stringify(t.value)&&(t.value={...o}),(a=s())==null||a.close()},l=()=>{if(!Array.isArray(t.value)){const n=(u.value.findIndex(a=>a.id===t.value.id)+1)%u.value.length;t.value={...u.value[n]}}},V=async o=>{Array.isArray(t.value)&&(t.value=t.value.filter(n=>n.id!==o),setTimeout(()=>{var n;(n=s())==null||n.recalcPosition()}))},y=e.ref(!1);c.apiRequest&&(e.watch(y,()=>{y.value&&p.setSearchTextAndLoad(r.value,!1)}),e.watch(r,()=>p.setSearchTextAndLoad(r.value)));const A=o=>{const n=o.target;n.scrollTop/(n.scrollHeight-n.offsetHeight)>.8&&p.loadAppend()};return(o,n)=>(e.openBlock(),e.createBlock(e.unref(w.TopPopup),{ref_key:"popupRef",ref:f,onOpen:n[1]||(n[1]=a=>y.value=!0),onClose:n[2]||(n[2]=a=>y.value=!1),onScrollContentList:n[3]||(n[3]=a=>o.apiRequest?A(a):void 0),notch:!1,transitionDuration:0},{opener:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass({"top-selector2":!0,"top-selector2-multiselect":o.multiselect,["top-size_"+o.size]:!0,"top-disabled":o.disabled,"top-forms-focusable":!o.disabled,"top-error":o.isError})},[o.multiselect?(e.openBlock(),e.createElementBlock("div",Y,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.value,a=>(e.openBlock(),e.createBlock(j,{id:a.id,name:a.name,onDelete:V},null,8,["id","name"]))),256))])):e.createCommentVNode("",!0),o.multiselect?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Q,e.toDisplayString(Array.isArray(t.value)?"":t.value.name),1)),o.addChanger&&!o.multiselect&&u.value.length>1&&!o.disabled?(e.openBlock(),e.createElementBlock("span",{key:2,class:"top-changer top-changer-selector",onClick:e.withModifiers(l,["stop"])})):e.createCommentVNode("",!0)],2)]),widget:e.withCtx(()=>[e.createVNode(e.unref(w.TopPopupWidgetInput),{title:"Поиск",icon:"",modelValue:r.value,"onUpdate:modelValue":n[0]||(n[0]=a=>r.value=a),isLoading:e.unref(p).isLoading.value,placeholder:!Array.isArray(t.value)&&!o.multiselect&&o.showSelectedInInput?t.value.name:o.placeholder},null,8,["modelValue","isLoading","placeholder"])]),contentList:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(B.value,a=>(e.openBlock(),e.createBlock(e.unref(w.TopPopupListItem),{class:e.normalizeClass({"top-active":!Array.isArray(t.value)&&!o.multiselect&&t.value.name===a.name}),key:a.id??void 0,onClick:e.withModifiers(k=>d(a),["stop"])},{default:e.withCtx(()=>[o.$slots.item?e.renderSlot(o.$slots,"item",{key:0,item:a}):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(a.name),1)],64))]),_:2},1032,["class","onClick"]))),128)),B.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(w.TopPopupListItem),{key:0,type:"regular"},{default:e.withCtx(()=>[e.createTextVNode(" Нет результатов ")]),_:1}))]),_:3},512))}}),q={$style:{"top-selector2":"top-selector2","top-selector2-multiselect":"top-selector2-multiselect","top-active":"top-active","top-selector2_activeItems":"top-selector2_activeItems","top-selector2_activeName":"top-selector2_activeName","top-changer-selector":"top-changer-selector"}},ee=h._export_sfc(Z,[["__cssModules",q]]),te=K,oe=D,le=U,ae=ee,re=$.Menu;b.TopEditArea=te,b.TopEditInput=oe,b.TopMenu=re,b.TopRadioGroup=le,b.TopSelector2=ae,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
|
|
2
2
|
//# sourceMappingURL=formsExt.amd.js.map
|