@topvisor/ui 1.0.41 → 1.0.42-TopSelector.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.chunks/{core-D2o3elGA.amd.js → core-CNHOrWnw.amd.js} +2 -2
- package/.chunks/{core-D2o3elGA.amd.js.map → core-CNHOrWnw.amd.js.map} +1 -1
- package/.chunks/{core-CwjGTMhd.es.js → core-CZLRhkk2.es.js} +4 -4
- package/.chunks/{core-CwjGTMhd.es.js.map → core-CZLRhkk2.es.js.map} +1 -1
- package/.chunks/{datepicker-N83oX3hx.es.js → datepicker-BZ-GKoJc.es.js} +2 -2
- package/.chunks/{datepicker-N83oX3hx.es.js.map → datepicker-BZ-GKoJc.es.js.map} +1 -1
- package/.chunks/{datepicker-Byyye2pn.amd.js → datepicker-DnMEQ2c7.amd.js} +2 -2
- package/.chunks/{datepicker-Byyye2pn.amd.js.map → datepicker-DnMEQ2c7.amd.js.map} +1 -1
- package/.chunks/{dialog_selectorRegions-pDIYvl7b.amd.js → dialog_selectorRegions-B7ylHRje.amd.js} +2 -2
- package/.chunks/{dialog_selectorRegions-pDIYvl7b.amd.js.map → dialog_selectorRegions-B7ylHRje.amd.js.map} +1 -1
- package/.chunks/{dialog_selectorRegions-lYV2SJBx.es.js → dialog_selectorRegions-CR77RefG.es.js} +4 -4
- package/.chunks/{dialog_selectorRegions-lYV2SJBx.es.js.map → dialog_selectorRegions-CR77RefG.es.js.map} +1 -1
- package/.chunks/dialogs.vue_vue_type_script_setup_true_lang-C0n3o7PD.amd.js +2 -0
- package/.chunks/dialogs.vue_vue_type_script_setup_true_lang-C0n3o7PD.amd.js.map +1 -0
- package/.chunks/{dialogs.vue_vue_type_script_setup_true_lang-X3S_WcSV.es.js → dialogs.vue_vue_type_script_setup_true_lang-sExyADFk.es.js} +113 -97
- package/.chunks/dialogs.vue_vue_type_script_setup_true_lang-sExyADFk.es.js.map +1 -0
- package/.chunks/{forms-C-fyoosd.es.js → forms-1PEYT7sp.es.js} +482 -470
- package/.chunks/{forms-C-fyoosd.es.js.map → forms-1PEYT7sp.es.js.map} +1 -1
- package/.chunks/forms-BduN5hFf.amd.js +3 -0
- package/.chunks/{forms-DO87ZZk9.amd.js.map → forms-BduN5hFf.amd.js.map} +1 -1
- package/.chunks/{listItem.vue_vue_type_script_setup_true_lang-DDQSxC8E.amd.js → listItem.vue_vue_type_script_setup_true_lang-C660hIcG.amd.js} +2 -2
- package/.chunks/{listItem.vue_vue_type_script_setup_true_lang-DDQSxC8E.amd.js.map → listItem.vue_vue_type_script_setup_true_lang-C660hIcG.amd.js.map} +1 -1
- package/.chunks/{listItem.vue_vue_type_script_setup_true_lang-BJTTvdc7.es.js → listItem.vue_vue_type_script_setup_true_lang-DPwnYUm-.es.js} +2 -2
- package/.chunks/{listItem.vue_vue_type_script_setup_true_lang-BJTTvdc7.es.js.map → listItem.vue_vue_type_script_setup_true_lang-DPwnYUm-.es.js.map} +1 -1
- package/.chunks/{menu.vue_vue_type_style_index_0_lang-Bi9Z81pC.es.js → menu.vue_vue_type_style_index_0_lang-BYP0xpzD.es.js} +2 -2
- package/.chunks/{menu.vue_vue_type_style_index_0_lang-Bi9Z81pC.es.js.map → menu.vue_vue_type_style_index_0_lang-BYP0xpzD.es.js.map} +1 -1
- package/.chunks/{menu.vue_vue_type_style_index_0_lang-7eYwnVLw.amd.js → menu.vue_vue_type_style_index_0_lang-C9cIXmj2.amd.js} +2 -2
- package/.chunks/{menu.vue_vue_type_style_index_0_lang-7eYwnVLw.amd.js.map → menu.vue_vue_type_style_index_0_lang-C9cIXmj2.amd.js.map} +1 -1
- package/.chunks/{notice-DCONQ8rR.es.js → notice-C505E22P.es.js} +2 -2
- package/.chunks/{notice-DCONQ8rR.es.js.map → notice-C505E22P.es.js.map} +1 -1
- package/.chunks/{notice-B8nfJMJN.amd.js → notice-CEYLelBs.amd.js} +2 -2
- package/.chunks/{notice-B8nfJMJN.amd.js.map → notice-CEYLelBs.amd.js.map} +1 -1
- package/.chunks/{page.vue_vue_type_script_setup_true_lang-Cg3dLy7K.amd.js → page.vue_vue_type_script_setup_true_lang-DpmKeCWn.amd.js} +2 -2
- package/.chunks/page.vue_vue_type_script_setup_true_lang-DpmKeCWn.amd.js.map +1 -0
- package/.chunks/{page.vue_vue_type_script_setup_true_lang-Dze2ZUr3.es.js → page.vue_vue_type_script_setup_true_lang-_-EoskSt.es.js} +4 -4
- package/.chunks/page.vue_vue_type_script_setup_true_lang-_-EoskSt.es.js.map +1 -0
- package/.chunks/{popup-PpCQY5Zi.es.js → popup-Bh3WbTKH.es.js} +106 -73
- package/.chunks/popup-Bh3WbTKH.es.js.map +1 -0
- package/.chunks/popup-C5-ffkMJ.amd.js +2 -0
- package/.chunks/popup-C5-ffkMJ.amd.js.map +1 -0
- package/.chunks/{utils-DAIrXU57.amd.js → utils-BgjhCn4H.amd.js} +2 -2
- package/.chunks/{utils-DAIrXU57.amd.js.map → utils-BgjhCn4H.amd.js.map} +1 -1
- package/.chunks/{utils-BcKnFj1j.es.js → utils-CMJHpNDX.es.js} +246 -169
- package/.chunks/utils-CMJHpNDX.es.js.map +1 -0
- package/.chunks/{utils-DsICGMuv.es.js → utils-DEyMm4Iq.es.js} +2 -2
- package/.chunks/{utils-DsICGMuv.es.js.map → utils-DEyMm4Iq.es.js.map} +1 -1
- package/.chunks/utils-DWmOkm95.amd.js +2 -0
- package/.chunks/utils-DWmOkm95.amd.js.map +1 -0
- package/assets/core.css +1 -1
- package/assets/forms.css +1 -1
- package/assets/formsExt.css +1 -1
- package/assets/notice.css +1 -1
- package/assets/project.css +1 -1
- package/charts/charts.amd.js +1 -1
- package/charts/charts.js +1 -1
- package/components/dialog/dialog/dialogs/dialogs.vue.d.ts +3 -0
- package/components/dialog/lib/types.d.ts +23 -0
- package/components/dialog/lib/utils.d.ts +8 -8
- package/components/dialog/lib/utils.globalEvents.d.ts +2 -2
- package/components/dialog/lib/worker.d.ts +12 -11
- package/components/forms/button/button.vue.d.ts +2 -5
- package/components/forms/button/types.d.ts +10 -0
- package/components/formsExt/formsExt.d.ts +2 -0
- package/components/formsExt/policy/policy.vue.d.ts +4 -0
- package/components/formsExt/policy/types.d.ts +10 -0
- package/components/formsExt/selector2/composables/useAPI.d.ts +1 -1
- package/components/formsExt/selector2/composables/useMenu.d.ts +5 -1
- package/components/formsExt/selector2/selector2.vue.d.ts +3 -4
- package/components/formsExt/selector2/stories/dummyAPIRequest.d.ts +1 -2
- package/components/formsExt/selector2/types.d.ts +48 -22
- package/components/popup/lib/popup.d.ts +1 -0
- package/components/popup/lib/worker.d.ts +4 -2
- package/core/app.amd.js +1 -1
- package/core/app.js +5 -5
- package/core/core/core.d.ts +1 -1
- package/core/core/options.d.ts +7 -6
- package/core/core/state.d.ts +1 -1
- package/core/plugins/core.d.ts +1 -1
- package/core/utils/date.d.ts +30 -12
- package/core/utils/dom.d.ts +11 -1
- package/core/utils/string.d.ts +1 -1
- package/dialog/dialog.amd.js +1 -1
- package/dialog/dialog.js +2 -2
- package/forms/forms.amd.js +1 -1
- package/forms/forms.js +1 -1
- package/formsExt/formsExt.amd.js +1 -1
- package/formsExt/formsExt.amd.js.map +1 -1
- package/formsExt/formsExt.js +432 -309
- package/formsExt/formsExt.js.map +1 -1
- package/icomoon/demo.html +15 -1
- package/icomoon/fonts/Topvisor-2.eot +0 -0
- package/icomoon/fonts/Topvisor-2.svg +1 -0
- package/icomoon/fonts/Topvisor-2.ttf +0 -0
- package/icomoon/fonts/Topvisor-2.woff +0 -0
- package/icomoon/selection.json +1 -1
- package/icomoon/style.css +8 -5
- package/layout/layout.amd.js +1 -1
- package/layout/layout.js +1 -1
- package/package.json +1 -1
- package/popup/popup.amd.js +1 -1
- package/popup/popup.js +2 -2
- package/popup/worker.amd.js +1 -1
- package/popup/worker.amd.js.map +1 -1
- package/popup/worker.js +30 -21
- package/popup/worker.js.map +1 -1
- package/project/project.amd.js +1 -1
- package/project/project.amd.js.map +1 -1
- package/project/project.js +6 -6
- package/project/project.js.map +1 -1
- package/tabsView/tabsView.amd.js +1 -1
- package/tabsView/tabsView.js +1 -1
- package/utils/clipboard.amd.js +1 -1
- package/utils/clipboard.js +1 -1
- package/utils/date.amd.js +1 -1
- package/utils/date.js +4 -3
- package/utils/device.amd.js +1 -1
- package/utils/device.js +1 -1
- package/utils/dom.amd.js +1 -1
- package/utils/dom.amd.js.map +1 -1
- package/utils/dom.js +27 -22
- package/utils/dom.js.map +1 -1
- package/utils/lodash.amd.js +1 -1
- package/utils/lodash.js +1 -1
- package/utils/price.amd.js +1 -1
- package/utils/price.js +1 -1
- package/utils/searchers.amd.js +1 -1
- package/utils/searchers.js +3 -3
- package/utils/string.amd.js +1 -1
- package/utils/string.amd.js.map +1 -1
- package/utils/string.js +34 -30
- package/utils/string.js.map +1 -1
- package/.chunks/dialogs.vue_vue_type_script_setup_true_lang-B14m3p7q.amd.js +0 -2
- package/.chunks/dialogs.vue_vue_type_script_setup_true_lang-B14m3p7q.amd.js.map +0 -1
- package/.chunks/dialogs.vue_vue_type_script_setup_true_lang-X3S_WcSV.es.js.map +0 -1
- package/.chunks/forms-DO87ZZk9.amd.js +0 -3
- package/.chunks/page.vue_vue_type_script_setup_true_lang-Cg3dLy7K.amd.js.map +0 -1
- package/.chunks/page.vue_vue_type_script_setup_true_lang-Dze2ZUr3.es.js.map +0 -1
- package/.chunks/popup-PpCQY5Zi.es.js.map +0 -1
- package/.chunks/popup-XXfdNLmr.amd.js +0 -2
- package/.chunks/popup-XXfdNLmr.amd.js.map +0 -1
- package/.chunks/utils-BcKnFj1j.es.js.map +0 -1
- package/.chunks/utils-pvFg1FqE.amd.js +0 -2
- package/.chunks/utils-pvFg1FqE.amd.js.map +0 -1
- package/icomoon/Topvisor icons.json +0 -6612
package/icomoon/style.css
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
@font-face {
|
|
2
2
|
font-family: 'Topvisor-2';
|
|
3
|
-
src: url('fonts/Topvisor-2.eot?
|
|
4
|
-
src: url('fonts/Topvisor-2.eot?
|
|
5
|
-
url('fonts/Topvisor-2.ttf?
|
|
6
|
-
url('fonts/Topvisor-2.woff?
|
|
7
|
-
url('fonts/Topvisor-2.svg?
|
|
3
|
+
src: url('fonts/Topvisor-2.eot?jwzdqo');
|
|
4
|
+
src: url('fonts/Topvisor-2.eot?jwzdqo#iefix') format('embedded-opentype'),
|
|
5
|
+
url('fonts/Topvisor-2.ttf?jwzdqo') format('truetype'),
|
|
6
|
+
url('fonts/Topvisor-2.woff?jwzdqo') format('woff'),
|
|
7
|
+
url('fonts/Topvisor-2.svg?jwzdqo#Topvisor-2') format('svg');
|
|
8
8
|
font-weight: normal;
|
|
9
9
|
font-style: normal;
|
|
10
10
|
font-display: block;
|
|
@@ -193,6 +193,9 @@
|
|
|
193
193
|
.icon2-snapshot:before {
|
|
194
194
|
content: "\e91b";
|
|
195
195
|
}
|
|
196
|
+
.icon2-question-fill:before {
|
|
197
|
+
content: "\ea0a";
|
|
198
|
+
}
|
|
196
199
|
.icon2-restore:before {
|
|
197
200
|
content: "\ea09";
|
|
198
201
|
}
|
package/layout/layout.amd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
define(["require","exports","vue","../.chunks/forms-
|
|
1
|
+
define(["require","exports","vue","../.chunks/forms-BduN5hFf.amd","../require/css.amd!../assets/layout.css"],function(v,t,e,n){"use strict";if(typeof e>"u")var e=window.Vue;const l=e.defineComponent({__name:"rows",props:{gap:{default:"none"}},setup(s){const o=s;return(c,B)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"top-rows":!0,["top-rows-gap_"+o.gap]:!0})},[e.renderSlot(c.$slots,"default")],2))}}),r={class:"top-islandRows"},a={key:0,class:"top-islandRows_title"},d=e.defineComponent({__name:"islandRows",setup(s){return(o,c)=>(e.openBlock(),e.createElementBlock("div",r,[o.$slots.title?(e.openBlock(),e.createElementBlock("div",a,[e.renderSlot(o.$slots,"title")])):e.createCommentVNode("",!0),e.createVNode(l,{gap:"l",class:"top-islandRows_rows"},{default:e.withCtx(()=>[e.renderSlot(o.$slots,"default")]),_:3})]))}}),i={},_={class:"top-islandRows_row"};function u(s,o){return e.openBlock(),e.createElementBlock("div",_,[e.renderSlot(s.$slots,"default")])}const p=n._export_sfc(i,[["render",u]]),w={},f={class:"top-islandRows_subTitle"};function m(s,o){return e.openBlock(),e.createElementBlock("div",f,[e.renderSlot(s.$slots,"default")])}const R=n._export_sfc(w,[["render",m]]),T=d,k=p,$=R,h=l;t.TopIslandRows=T,t.TopIslandRowsRow=k,t.TopIslandRowsSubTitle=$,t.TopRows=h,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
|
|
2
2
|
//# sourceMappingURL=layout.amd.js.map
|
package/layout/layout.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Core as i } from "../core/app.js";
|
|
2
2
|
import { defineComponent as r, createElementBlock as t, openBlock as e, normalizeClass as d, renderSlot as n, createCommentVNode as p, createVNode as u, withCtx as m } from "vue";
|
|
3
|
-
import { t as l } from "../.chunks/forms-
|
|
3
|
+
import { t as l } from "../.chunks/forms-1PEYT7sp.es.js";
|
|
4
4
|
const _ = ["../assets/layout.css"].map((s) => import.meta.resolve(s));
|
|
5
5
|
i.insertCSSLinkToPage(_, !0);
|
|
6
6
|
const c = /* @__PURE__ */ r({
|
package/package.json
CHANGED
package/popup/popup.amd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
define(["require","exports","../.chunks/listItem.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
define(["require","exports","../.chunks/listItem.vue_vue_type_script_setup_true_lang-C660hIcG.amd","vue","../.chunks/forms-BduN5hFf.amd","../require/css.amd!../assets/popup.css"],function(h,p,f,e,c){"use strict";if(typeof e>"u")var e=window.Vue;const $=e.defineComponent({__name:"widgetInput",props:e.mergeModels({modelValue:{},name:{},disabled:{type:Boolean},readonly:{type:Boolean},modificator:{},size:{},styling:{},isError:{type:Boolean},isLoading:{type:Boolean},icon:{},icon2:{},addCleaner:{type:Boolean,default:!0},title:{},captionType:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(u){const d=e.useModel(u,"modelValue");return(r,o)=>(e.openBlock(),e.createBlock(c._sfc_main$2,e.mergeProps(r.$props,{modificator:"popupWidgetInput",modelValue:d.value,"onUpdate:modelValue":o[0]||(o[0]=l=>d.value=l)}),null,16,["modelValue"]))}}),S=e.defineComponent({__name:"alert",props:{submitText:{},id:{},class:{},transitionDuration:{},footerSupportLink:{},pos:{},notch:{type:Boolean},openByHover:{type:Boolean},posBy:{}},emits:["open","close","scrollContentList"],setup(u){const r={...u,submitText:void 0};return delete r.submitText,(o,l)=>(e.openBlock(),e.createBlock(f._sfc_main,e.mergeProps({class:"top-popupAlert"},r,{onOpen:l[0]||(l[0]=s=>o.$emit("open",s)),onClose:l[1]||(l[1]=s=>o.$emit("close",s)),onScrollContentList:l[2]||(l[2]=(...s)=>o.$emit("scrollContentList",...s))}),e.createSlots({opener:e.withCtx(()=>[e.renderSlot(o.$slots,"opener")]),footer:e.withCtx(()=>[e.renderSlot(o.$slots,"footer"),e.createVNode(c._sfc_main,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.submitText||o.$i18n.Common.Close),1)]),_:1})]),_:2},[o.$slots.header?{name:"header",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"header")]),key:"0"}:void 0,o.$slots.default?{name:"content",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"default")]),key:"1"}:void 0]),1040))}}),y=e.defineComponent({__name:"confirm",props:{cancelText:{},submitText:{},isWarning:{type:Boolean},id:{},class:{},transitionDuration:{},footerSupportLink:{},pos:{},notch:{type:Boolean},openByHover:{type:Boolean},posBy:{}},emits:["open","close","scrollContentList","submit"],setup(u,{emit:d}){const r=u,o=d,l=e.ref(!1),s=()=>{l.value=!0,o("submit")},C=n=>{if(l.value){l.value=!1;return}o("close",n)},T={...r,submitText:void 0,cancelText:void 0,isWarning:void 0};return delete T.submitText,delete T.cancelText,delete T.isWarning,(n,i)=>(e.openBlock(),e.createBlock(f._sfc_main,e.mergeProps({class:"top-popupConfirm"},T,{onOpen:i[0]||(i[0]=t=>n.$emit("open",t)),onClose:i[1]||(i[1]=t=>C(t)),onScrollContentList:i[2]||(i[2]=(...t)=>n.$emit("scrollContentList",...t))}),e.createSlots({opener:e.withCtx(()=>[e.renderSlot(n.$slots,"opener")]),footer:e.withCtx(()=>[e.renderSlot(n.$slots,"footer"),e.createVNode(c._sfc_main,{color:"theme"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(n.cancelText||n.$i18n.Common.Cancel),1)]),_:1}),e.createVNode(c._sfc_main,{onClick:s,color:n.isWarning?"red":"blue"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(n.submitText||n.$i18n.Common.Continue),1)]),_:1},8,["color"])]),_:2},[n.$slots.header?{name:"header",fn:e.withCtx(()=>[e.renderSlot(n.$slots,"header")]),key:"0"}:void 0,n.$slots.default?{name:"content",fn:e.withCtx(()=>[e.renderSlot(n.$slots,"default")]),key:"1"}:void 0]),1040))}}),V=e.defineComponent({__name:"prompt",props:{submitText:{},cancelText:{},defaultValue:{},id:{},class:{},transitionDuration:{},footerSupportLink:{},pos:{},notch:{type:Boolean},openByHover:{type:Boolean},posBy:{}},emits:["open","close","scrollContentList","submit"],setup(u,{emit:d}){const r=u,o=d,l=()=>C.value=r.defaultValue??"",s=e.ref(!1),C=e.ref();e.watch(()=>r.defaultValue,()=>l(),{immediate:!0});const T=()=>{s.value=!0},n=t=>{if(s.value){s.value=!1,o("submit",C.value),l();return}l(),o("close",t)},i={...r,submitText:void 0,cancelText:void 0,defaultValue:void 0};return delete i.submitText,delete i.cancelText,delete i.defaultValue,(t,a)=>(e.openBlock(),e.createBlock(f._sfc_main,e.mergeProps({class:"top-popupPrompt"},i,{onOpen:a[1]||(a[1]=m=>t.$emit("open",m)),onClose:a[2]||(a[2]=m=>n(m)),onScrollContentList:a[3]||(a[3]=(...m)=>t.$emit("scrollContentList",...m))}),e.createSlots({opener:e.withCtx(()=>[e.renderSlot(t.$slots,"opener")]),footer:e.withCtx(()=>[e.renderSlot(t.$slots,"footer"),e.createVNode(c._sfc_main,{color:"theme"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.cancelText||t.$i18n.Common.Cancel),1)]),_:1}),e.createVNode(c._sfc_main,{onClick:T},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.submitText||t.$i18n.Common.OK),1)]),_:1})]),_:2},[t.$slots.header?{name:"header",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"header")]),key:"0"}:void 0,t.$slots.default?{name:"content",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"default"),e.createVNode($,{modelValue:C.value,"onUpdate:modelValue":a[0]||(a[0]=m=>C.value=m),modelModifiers:{trim:!0}},null,8,["modelValue"])]),key:"1"}:void 0]),1040))}}),B=f._sfc_main,v=f._sfc_main$2,P=f._sfc_main$1,b=$,k=S,w=y,g=V;p.TopPopup=B,p.TopPopupAlert=k,p.TopPopupConfirm=w,p.TopPopupListItem=P,p.TopPopupOpener=v,p.TopPopupPrompt=g,p.TopPopupWidgetInput=b,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
|
|
2
2
|
//# sourceMappingURL=popup.amd.js.map
|
package/popup/popup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Core as g } from "../core/app.js";
|
|
2
|
-
import { _ as y, a as O, b as D } from "../.chunks/listItem.vue_vue_type_script_setup_true_lang-
|
|
2
|
+
import { _ as y, a as O, b as D } from "../.chunks/listItem.vue_vue_type_script_setup_true_lang-DPwnYUm-.es.js";
|
|
3
3
|
import { defineComponent as b, mergeModels as I, useModel as M, createBlock as B, openBlock as V, mergeProps as S, createSlots as k, withCtx as n, renderSlot as l, createVNode as c, createTextVNode as C, toDisplayString as T, ref as L, watch as w } from "vue";
|
|
4
|
-
import { f as H, _ as v } from "../.chunks/forms-
|
|
4
|
+
import { f as H, _ as v } from "../.chunks/forms-1PEYT7sp.es.js";
|
|
5
5
|
const W = ["../assets/popup.css"].map((a) => import.meta.resolve(a));
|
|
6
6
|
g.insertCSSLinkToPage(W, !0);
|
|
7
7
|
const P = /* @__PURE__ */ b({
|
package/popup/worker.amd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
define(["require","exports","../.chunks/forms-
|
|
1
|
+
define(["require","exports","../.chunks/forms-BduN5hFf.amd","../utils/dom.amd"],function(require,exports,forms,utils_dom){"use strict";if(typeof vue>"u")var vue=window.Vue;class Worker{static noClose=!1;static vueConnectors=new Map;static options={};static getPopup(t){return utils_dom.default.storage(t,"TopPopup")}static getElPopupOpener(t){return t.closest("[data-top-popup]")}static getPopupFromOpener(t){const o=Worker.getElPopupOpener(t);return o?utils_dom.default.storage(o,"#TopPopup"):null}static getAll(){return utils_dom.default.querySelectorAllArray(document,".top-popup-wrapper")}static getAllVisible(){return utils_dom.default.querySelectorAllVisible(document,".top-popup-wrapper")}static async openByOpener(t){if(!(t instanceof HTMLElement))return;const o={};return o.popup=t.dataset.topPopup,o.id=t.dataset.topPopupId,t.dataset.topPopupP&&(o.p=parseInt(t.dataset.topPopupP)),t.dataset.topPopupPos&&(o.p=parseInt(t.dataset.topPopupPos)),t.dataset.topPopupNotch&&(o.notch=t.dataset.topPopupNotch==="true"||t.dataset.topPopupNotch==="1"),t.dataset.topPopupClass&&(o.class=t.dataset.topPopupClass),t.dataset.topPopupPosBy&&(o.posBy=t.dataset.topPopupPosBy),t.dataset.topPopupFront&&(o.frontSelector=t.dataset.topPopupFront),t.dataset.topPopupInvertX&&(o.invertX=t.dataset.topPopupInvertX==="true"||t.dataset.topPopupInvertX==="1"),t.dataset.topPopupOpenByHover&&(o.openByHover=t.dataset.topPopupOpenByHover==="true"||t.dataset.topPopupOpenByHover==="1"),t.dataset.topPopupUseOriginal&&(o.useOriginal=t.dataset.topPopupUseOriginal==="true"||t.dataset.topPopupUseOriginal==="1"),await Worker.open(t,o)}static async open(elOpener,options){elOpener instanceof HTMLElement&&(elOpener.dataset.topPopupOpened="opened");const{TopLibPopup}=await new Promise((t,o)=>require(["../.chunks/popup-C5-ffkMJ.amd"],t,o));if(forms.Core.$){const $elOpener=forms.Core.$(elOpener);if($elOpener.data("aftershow")){let afterShow=$elOpener.data("aftershow");typeof afterShow=="string"&&(afterShow=eval(afterShow.replace(/\W/g,""))),$elOpener.one("aftershow.top-menu-popup",afterShow)}if($elOpener.data("afterclose")){let afterclose=$elOpener.data("afterclose");typeof afterclose=="string"&&(afterclose=eval(afterclose.replace(/\W/g,""))),$elOpener.one("afterclose.top-menu-popup",afterclose)}}return options.isFullScreen=forms.Core.state.isMobile,new TopLibPopup(elOpener,options)}static close(t,o=!0){const e=Worker.getPopup(t);e&&(e.close(),o&&setTimeout(()=>{e.el.focus()}))}static recalcPosition(t){const o=Worker.getPopup(t);o&&o.elPopupBody instanceof HTMLElement&&o.recalcPosition()}static scrollToActive(t){if(!utils_dom.default.querySelectorVisible(t,"ul.top-popup_content > li > .top-active"))return;const e=t.querySelector("ul.top-popup_content"),r=utils_dom.default.querySelectorAllVisible(t,"ul.top-popup_content > li");t.classList.add("top-popup-wrapper-no_animate"),setTimeout(()=>t.classList.remove("top-popup-wrapper-no_animate"),100);let s=100;for(const p of r){if(p.querySelector(":scope > .top-active"))break;p instanceof HTMLElement&&(s+=p.offsetHeight)}if(e instanceof HTMLElement){const p=e.offsetHeight;s>p?e.scrollTop=s-p:e.scrollTop=0}}static decoratorBeforeOpen(t){this.options.decoratorBeforeOpen&&this.options.decoratorBeforeOpen(t)}static decoratorAfterOpen(t){this.options.decoratorAfterOpen&&this.options.decoratorAfterOpen(t)}static decoratorIsIgnoreOuterClick(t){return this.options.decoratorIsIgnoreOuterClick?this.options.decoratorIsIgnoreOuterClick(t):!1}static regVueComponent(t,o){if(Worker.vueConnectors.get(t))throw"Vue component Popup use duplicated id: "+t;Worker.vueConnectors.set(t,o)}static unregVueComponent(t){Worker.vueConnectors.delete(t)}static genElPopupOpener(t,o,...e){const r=utils_dom.default.genEl(t,{},...e);r.dataset.topPopup="#"+o.id;for(let s in o){const p="topPopup"+s.charAt(0).toUpperCase()+s.slice(1);r.dataset[p]=o[s]}return r}}exports.TopPopupWorker=Worker,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|
|
2
2
|
//# sourceMappingURL=worker.amd.js.map
|
package/popup/worker.amd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.amd.js","sources":["../../src/components/popup/lib/worker.ts"],"sourcesContent":["/**\n * PopupWorker управляет работой Popup\n *\n * Должен грузить TopLibPopup только в отложенном режиме\n */\n\nimport Core from '@/core/core/core';\nimport DOM from '@/core/utils/dom';\nimport type { TopLibPopup, PopupOptions } from '@/components/popup/lib/popup';\nimport type { OpenerProps } from '@/components/popup/popup/types';\n\nexport type Options = {\n\t/**\n\t * Глобальное событие, которое будет вызвано перед открытием TopPopup\n\t */\n\tdecoratorBeforeOpen?: (popup: TopLibPopup) => void,\n\n\t/**\n\t * Глобальное событие, которое будет вызвано после открытия TopPopup\n\t */\n\tdecoratorAfterOpen?: (popup: TopLibPopup) => void;\n\n\t/**\n\t * Определитель того, что клик вне Popup нужно игнорировать\n\t * @returns {boolean} - если true, то click не приведет к закрытию Popup\n\t */\n\tdecoratorIsIgnoreOuterClick?: (e: MouseEvent) => boolean\n}\n\nclass Worker {\n\n\t/**\n\t * Глобальное выключение закрытия меню, используется при различных оверлеях\n\t */\n\tstatic noClose = false;\n\n\t/**\n\t * Для взаимодействия с vue\n\t */\n\tstatic vueConnectors = new Map();\n\n\tstatic options: Options = {};\n\n\t/**\n\t * Вернуть объект компонента popup, привязанный к элементу\n\t */\n\tstatic getPopup(elPopup: HTMLElement): TopLibPopup {\n\t\treturn DOM.storage(elPopup, 'TopPopup') as TopLibPopup;\n\t}\n\n\t/**\n\t * Вернуть все элементы с Popup\n\t */\n\tstatic getAll(): HTMLElement[] {\n\t\treturn DOM.querySelectorAllArray(document, '.top-popup-wrapper');\n\t}\n\n\t/**\n\t * Вернуть все элементы с открытыми Popup\n\t */\n\tstatic getAllVisible(): HTMLElement[] {\n\t\treturn DOM.querySelectorAllVisible(document, '.top-popup-wrapper');\n\t}\n\n\t/**\n\t * Открыть Popup от указанного elOpener\n\t * @param {HTMLElement} elOpener - элемент, который должен вызвать открытие Popup\n\t */\n\tstatic async openByOpener(elOpener: HTMLElement): Promise<TopLibPopup | undefined> {\n\t\tif (!(elOpener instanceof HTMLElement)) return;\n\n\t\tconst options: PopupOptions = {};\n\n\t\toptions.popup = elOpener.dataset.topPopup;\n\n\t\toptions.id = elOpener.dataset.topPopupId;\n\n\t\t/**\n\t\t * @deprecated topPopupP - добавлено для обратной совместимости\n\t\t */\n\t\tif (elOpener.dataset.topPopupP) {\n\t\t\toptions.p = parseInt(elOpener.dataset.topPopupP);\n\t\t}\n\n\t\tif (elOpener.dataset.topPopupPos) {\n\t\t\toptions.p = parseInt(elOpener.dataset.topPopupPos);\n\t\t}\n\n\t\t/**\n\t\t * @deprecated '1' - добавлено для обратной совместимости\n\t\t */\n\t\tif (elOpener.dataset.topPopupNotch) {\n\t\t\toptions.notch = elOpener.dataset.topPopupNotch === 'true' || elOpener.dataset.topPopupNotch === '1';\n\t\t}\n\n\t\tif (elOpener.dataset.topPopupClass) {\n\t\t\toptions.class = elOpener.dataset.topPopupClass;\n\t\t}\n\n\t\tif (elOpener.dataset.topPopupPosBy) {\n\t\t\toptions.posBy = elOpener.dataset.topPopupPosBy as PopupOptions['posBy'];\n\t\t}\n\n\t\tif (elOpener.dataset.topPopupFront) {\n\t\t\toptions.frontSelector = elOpener.dataset.topPopupFront;\n\t\t}\n\n\t\t/**\n\t\t * @deprecated '1' - добавлено для обратной совместимости\n\t\t */\n\t\tif (elOpener.dataset.topPopupInvertX) {\n\t\t\toptions.invertX = elOpener.dataset.topPopupInvertX === 'true' || elOpener.dataset.topPopupInvertX === '1';\n\t\t}\n\n\t\t/**\n\t\t * @deprecated '1' - добавлено для обратной совместимости\n\t\t */\n\t\tif (elOpener.dataset.topPopupOpenByHover) {\n\t\t\toptions.openByHover = elOpener.dataset.topPopupOpenByHover === 'true' || elOpener.dataset.topPopupOpenByHover === '1';\n\t\t}\n\n\t\t/**\n\t\t * @deprecated '1' - добавлено для обратной совместимости\n\t\t */\n\t\tif (elOpener.dataset.topPopupUseOriginal) {\n\t\t\toptions.useOriginal = elOpener.dataset.topPopupUseOriginal === 'true' || elOpener.dataset.topPopupUseOriginal === '1';\n\t\t}\n\n\t\treturn await Worker.open(elOpener, options);\n\t}\n\n\t/**\n\t * Создать и открыть Popup\n\t * @param elOpener - элемент, вызвавший открытие Popup\n\t * @param options - опции Popup\n\t */\n\tprivate static async open(elOpener: HTMLElement, options: PopupOptions): Promise<TopLibPopup> {\n\t\tif (elOpener instanceof HTMLElement) elOpener.dataset.topPopupOpened = 'opened';\n\n\t\tconst { TopLibPopup } = await import('./popup');\n\n\t\tif (Core.$) {\n\t\t\tconst $elOpener = Core.$(elOpener);\n\n\t\t\t// deprecated, используется aftershow.top-menu-popup\n\t\t\tif ($elOpener.data('aftershow')) {\n\t\t\t\tlet afterShow = $elOpener.data('aftershow');\n\t\t\t\tif (typeof (afterShow) == 'string') {\n\t\t\t\t\t// TODO: Удалить с сайта указание кода функции в html\n\t\t\t\t\t// @deprecated\n\t\t\t\t\tafterShow = eval(afterShow.replace(/\\W/g, ''));\n\t\t\t\t}\n\n\t\t\t\t$elOpener.one('aftershow.top-menu-popup', afterShow);\n\t\t\t}\n\n\t\t\t// deprecated, используется afterclose.top-menu-popup\n\t\t\tif ($elOpener.data('afterclose')) {\n\t\t\t\tlet afterclose = $elOpener.data('afterclose');\n\t\t\t\tif (typeof (afterclose) == 'string') {\n\t\t\t\t\t// TODO: Удалить с сайта указание кода функции в html\n\t\t\t\t\t// @deprecated\n\t\t\t\t\tafterclose = eval(afterclose.replace(/\\W/g, ''));\n\t\t\t\t}\n\n\t\t\t\t$elOpener.one('afterclose.top-menu-popup', afterclose);\n\t\t\t}\n\t\t}\n\n\t\toptions.isFullScreen = Core.state.isMobile;\n\n\t\treturn new TopLibPopup(elOpener, options);\n\t}\n\n\tstatic close(elPopup: HTMLElement): void {\n\t\tconst popup = Worker.getPopup(elPopup);\n\t\tif (popup) {\n\t\t\tpopup.close();\n\t\t}\n\t}\n\n\tstatic recalcPosition(elPopup: HTMLElement): void {\n\t\tconst popup = Worker.getPopup(elPopup);\n\t\tif (popup && popup.elPopupBody instanceof HTMLElement) {\n\t\t\tpopup.recalcPosition();\n\t\t}\n\t}\n\n\t/**\n\t * Скролл к активному элементу списка\n\t */\n\tstatic scrollToActive(elPopup: HTMLElement): void {\n\t\tconst elItemActive = DOM.querySelectorVisible(elPopup, 'ul.top-popup_content > li > .top-active');\n\t\tif (!elItemActive) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst elUl = elPopup.querySelector('ul.top-popup_content');\n\t\tconst elsLi = DOM.querySelectorAllVisible(elPopup, 'ul.top-popup_content > li');\n\n\t\telPopup.classList.add('top-popup-wrapper-no_animate');\n\t\tsetTimeout(() => elPopup.classList.remove('top-popup-wrapper-no_animate'), 100);\n\n\t\tlet top = 100;\n\t\tfor (const elLi of elsLi) {\n\t\t\tif (elLi.querySelector(':scope > .top-active')) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (elLi instanceof HTMLElement) top += elLi.offsetHeight;\n\t\t}\n\n\t\tif (elUl instanceof HTMLElement) {\n\t\t\tconst heightWrapper = elUl.offsetHeight;\n\t\t\tif (top > heightWrapper) {\n\t\t\t\telUl.scrollTop = top - heightWrapper;\n\t\t\t} else {\n\t\t\t\telUl.scrollTop = 0;\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic decoratorBeforeOpen(popup: TopLibPopup): void {\n\t\tif (this.options.decoratorBeforeOpen) {\n\t\t\tthis.options.decoratorBeforeOpen(popup);\n\t\t}\n\t};\n\n\tstatic decoratorAfterOpen(popup: TopLibPopup): void {\n\t\tif (this.options.decoratorAfterOpen) {\n\t\t\tthis.options.decoratorAfterOpen(popup);\n\t\t}\n\t};\n\n\tstatic decoratorIsIgnoreOuterClick(e: MouseEvent): boolean {\n\t\tif (this.options.decoratorIsIgnoreOuterClick) {\n\t\t\treturn this.options.decoratorIsIgnoreOuterClick(e);\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Зарегистрировать Vue компонент\n\t *\n\t * Каждый экземляр Popup регистрируется в словаре vueConnectors для последующего доступа из js\n\t */\n\tstatic regVueComponent(id: string, vueConnector: any): void {\n\t\tif (Worker.vueConnectors.get(id)) {\n\t\t\tthrow 'Vue component Popup use duplicated id: ' + id;\n\t\t}\n\n\t\tWorker.vueConnectors.set(id, vueConnector);\n\t}\n\n\t/**\n\t * Снять с регистрации Vue компонент\n\t */\n\tstatic unregVueComponent(id: string): void {\n\t\tWorker.vueConnectors.delete(id);\n\t}\n\n\t/**\n\t * Сгенерировтаь элемент для открытия popup\n\t */\n\tstatic genElPopupOpener(tagName: string, props: OpenerProps, ...elsChildrens: HTMLElement[] | string[]): HTMLElement {\n\t\tconst el = DOM.genEl(tagName, {}, ...elsChildrens);\n\n\t\tel.dataset.topPopup = '#' + props.id;\n\n\t\t// if (props.pos === undefined) props.pos = '3';\n\t\t// if (props.notch === undefined) props.notch = true;\n\t\t// if (props.posBy === undefined) props.posBy = 'fixed';\n\n\t\tfor (let name in props) {\n\t\t\tconst attrName = 'topPopup' + name.charAt(0).toUpperCase() + name.slice(1);\n\n\t\t\tel.dataset[attrName] = props[name];\n\t\t}\n\n\t\treturn el;\n\t}\n\n}\n\nexport default Worker;\n"],"names":["elPopup","elOpener2","options2","elLi","elsLi","elUl","heightWrapper","top","popup","e","id","vueConnector","el","tagName","elsChildrens","name","props"],"mappings":"4KA6BA,MAAA,MAAA,mBAKkB,OAAA,cAAA,IAAA,sBAOU,OAAA,SAAAA,EAAA,+CAMY,8FAOyB,uGAOE,CAClE,aAAA,aAAAC,EAAA,CAOC,GAAA,EAAAA,aAAA,aAAA,8EAWAA,EAAA,QAAA,+CAIAA,EAAA,QAAA,mDAOAA,EAAA,QAAA,gBACCC,EAAA,MAAAD,EAAA,QAAA,gBAAA,QAAAA,EAAA,QAAA,gBAAA,KAGDA,EAAA,QAAA,iDAIAA,EAAA,QAAA,iDAIAA,EAAA,QAAA,yDAOAA,EAAA,QAAA,kBACCC,EAAA,QAAAD,EAAA,QAAA,kBAAA,QAAAA,EAAA,QAAA,kBAAA,KAMDA,EAAA,QAAA,sBACCC,EAAA,YAAAD,EAAA,QAAA,sBAAA,QAAAA,EAAA,QAAA,sBAAA,KAMDA,EAAA,QAAA,sBACCC,EAAA,YAAAD,EAAA,QAAA,sBAAA,QAAAA,EAAA,QAAA,sBAAA,2BAGyC,CAC3C,aAAA,KAAA,SAAA,QAAA,yKAYC,GAAA,MAAA,KAAA,EAAA,wCAIC,GAAA,UAAA,KAAA,WAAA,EAAA,2CAEC,OAAA,WAAA,WAGC,UAAA,KAAA,UAAA,QAAA,MAAA,EAAA,CAAA,GAGD,UAAA,IAAA,2BAAA,SAAA,CAAmD,CAIpD,GAAA,UAAA,KAAA,YAAA,EAAA,6CAEC,OAAA,YAAA,WAGC,WAAA,KAAA,WAAA,QAAA,MAAA,EAAA,CAAA,GAGD,UAAA,IAAA,4BAAA,UAAA,CAAqD,CACtD,uDAKD,IAAA,YAAA,SAAA,OAAA,CAAwC,CACzC,OAAA,MAAAD,EAAA,wCAMC,CACD,OAAA,eAAAA,EAAA,uFAMC,CACD,OAAA,eAAAA,EAAA,2NAcCA,EAAA,UAAA,IAAA,8BAAA,EACA,WAAA,IAAAA,EAAA,UAAA,OAAA,8BAAA,EAAA,GAAA,YAGA,UAAAG,KAAAC,EAAA,CACC,GAAAD,EAAA,cAAA,sBAAA,qDAI6C,CAG9C,GAAAE,aAAA,YAAA,CACC,MAAAC,EAAAD,EAAA,aACAE,EAAAD,EACCD,EAAA,UAAAE,EAAAD,EAEAD,EAAA,UAAA,CACD,CACD,CACD,OAAA,oBAAAG,EAAA,CAGC,KAAA,QAAA,qBACC,KAAA,QAAA,oBAAAA,CAAA,CACD,CACD,OAAA,mBAAAA,EAAA,CAGC,KAAA,QAAA,oBACC,KAAA,QAAA,mBAAAA,CAAA,CACD,CACD,OAAA,4BAAAC,EAAA,CAGC,OAAA,KAAA,QAAA,wEAIA,EAAO,CACR,OAAA,gBAAAC,EAAAC,EAAA,8GAY0C,CAC1C,OAAA,kBAAAD,EAAA,CAMC,OAAA,cAAA,OAAAA,CAAA,CAA8B,mCAO9B,MAAAE,EAAA,UAAA,QAAA,MAAAC,EAAA,CAAA,EAAA,GAAAC,CAAA,8BAQA,QAAAC,KAAAC,EAAA,0EAGkC,CAGlC,OAAAJ,CAAO,CAGT"}
|
|
1
|
+
{"version":3,"file":"worker.amd.js","sources":["../../src/components/popup/lib/worker.ts"],"sourcesContent":["/**\n * PopupWorker управляет работой Popup\n *\n * Должен грузить TopLibPopup только в отложенном режиме\n */\n\nimport Core from '@/core/core/core';\nimport DOM from '@/core/utils/dom';\nimport type { PopupOptions, TopLibPopup } from '@/components/popup/lib/popup';\nimport type { OpenerProps } from '@/components/popup/popup/types';\n\nexport type Options = {\n\t/**\n\t * Глобальное событие, которое будет вызвано перед открытием TopPopup\n\t */\n\tdecoratorBeforeOpen?: (popup: TopLibPopup) => void,\n\n\t/**\n\t * Глобальное событие, которое будет вызвано после открытия TopPopup\n\t */\n\tdecoratorAfterOpen?: (popup: TopLibPopup) => void;\n\n\t/**\n\t * Определитель того, что клик вне Popup нужно игнорировать\n\t * @returns {boolean} - если true, то click не приведет к закрытию Popup\n\t */\n\tdecoratorIsIgnoreOuterClick?: (e: MouseEvent) => boolean\n}\n\nclass Worker {\n\n\t/**\n\t * Глобальное выключение закрытия меню, используется при различных оверлеях\n\t */\n\tstatic noClose = false;\n\n\t/**\n\t * Для взаимодействия с vue\n\t */\n\tstatic vueConnectors = new Map();\n\n\tstatic options: Options = {};\n\n\t/**\n\t * Вернуть объект компонента popup, привязанный к элементу\n\t */\n\tstatic getPopup(elPopup: HTMLElement): TopLibPopup {\n\t\treturn DOM.storage(elPopup, 'TopPopup') as TopLibPopup;\n\t}\n\n\tstatic getElPopupOpener(el: Element): HTMLElement | null {\n\t\treturn el.closest<HTMLElement>('[data-top-popup]');\n\t}\n\n\tstatic getPopupFromOpener(el: HTMLElement): TopLibPopup | null {\n\t\tconst elOpener = Worker.getElPopupOpener(el);\n\t\tif (!elOpener) return null;\n\n\t\treturn DOM.storage(elOpener, '#TopPopup');\n\t}\n\n\t/**\n\t * Вернуть все элементы с Popup\n\t */\n\tstatic getAll(): HTMLElement[] {\n\t\treturn DOM.querySelectorAllArray(document, '.top-popup-wrapper');\n\t}\n\n\t/**\n\t * Вернуть все элементы с открытыми Popup\n\t */\n\tstatic getAllVisible(): HTMLElement[] {\n\t\treturn DOM.querySelectorAllVisible(document, '.top-popup-wrapper');\n\t}\n\n\t/**\n\t * Открыть Popup от указанного elOpener\n\t * @param {HTMLElement} elOpener - элемент, который должен вызвать открытие Popup\n\t */\n\tstatic async openByOpener(elOpener: HTMLElement): Promise<TopLibPopup | undefined> {\n\t\tif (!(elOpener instanceof HTMLElement)) return;\n\n\t\tconst options: PopupOptions = {};\n\n\t\toptions.popup = elOpener.dataset.topPopup;\n\n\t\toptions.id = elOpener.dataset.topPopupId;\n\n\t\t/**\n\t\t * @deprecated topPopupP - добавлено для обратной совместимости\n\t\t */\n\t\tif (elOpener.dataset.topPopupP) {\n\t\t\toptions.p = parseInt(elOpener.dataset.topPopupP);\n\t\t}\n\n\t\tif (elOpener.dataset.topPopupPos) {\n\t\t\toptions.p = parseInt(elOpener.dataset.topPopupPos);\n\t\t}\n\n\t\t/**\n\t\t * @deprecated '1' - добавлено для обратной совместимости\n\t\t */\n\t\tif (elOpener.dataset.topPopupNotch) {\n\t\t\toptions.notch = elOpener.dataset.topPopupNotch === 'true' || elOpener.dataset.topPopupNotch === '1';\n\t\t}\n\n\t\tif (elOpener.dataset.topPopupClass) {\n\t\t\toptions.class = elOpener.dataset.topPopupClass;\n\t\t}\n\n\t\tif (elOpener.dataset.topPopupPosBy) {\n\t\t\toptions.posBy = elOpener.dataset.topPopupPosBy as PopupOptions['posBy'];\n\t\t}\n\n\t\tif (elOpener.dataset.topPopupFront) {\n\t\t\toptions.frontSelector = elOpener.dataset.topPopupFront;\n\t\t}\n\n\t\t/**\n\t\t * @deprecated '1' - добавлено для обратной совместимости\n\t\t */\n\t\tif (elOpener.dataset.topPopupInvertX) {\n\t\t\toptions.invertX = elOpener.dataset.topPopupInvertX === 'true' || elOpener.dataset.topPopupInvertX === '1';\n\t\t}\n\n\t\t/**\n\t\t * @deprecated '1' - добавлено для обратной совместимости\n\t\t */\n\t\tif (elOpener.dataset.topPopupOpenByHover) {\n\t\t\toptions.openByHover = elOpener.dataset.topPopupOpenByHover === 'true' || elOpener.dataset.topPopupOpenByHover === '1';\n\t\t}\n\n\t\t/**\n\t\t * @deprecated '1' - добавлено для обратной совместимости\n\t\t */\n\t\tif (elOpener.dataset.topPopupUseOriginal) {\n\t\t\toptions.useOriginal = elOpener.dataset.topPopupUseOriginal === 'true' || elOpener.dataset.topPopupUseOriginal === '1';\n\t\t}\n\n\t\treturn await Worker.open(elOpener, options);\n\t}\n\n\t/**\n\t * Создать и открыть Popup\n\t * @param elOpener - элемент, вызвавший открытие Popup\n\t * @param options - опции Popup\n\t */\n\tprivate static async open(elOpener: HTMLElement, options: PopupOptions): Promise<TopLibPopup> {\n\t\tif (elOpener instanceof HTMLElement) elOpener.dataset.topPopupOpened = 'opened';\n\n\t\tconst { TopLibPopup } = await import('./popup');\n\n\t\tif (Core.$) {\n\t\t\tconst $elOpener = Core.$(elOpener);\n\n\t\t\t// deprecated, используется aftershow.top-menu-popup\n\t\t\tif ($elOpener.data('aftershow')) {\n\t\t\t\tlet afterShow = $elOpener.data('aftershow');\n\t\t\t\tif (typeof (afterShow) == 'string') {\n\t\t\t\t\t// TODO: Удалить с сайта указание кода функции в html\n\t\t\t\t\t// @deprecated\n\t\t\t\t\tafterShow = eval(afterShow.replace(/\\W/g, ''));\n\t\t\t\t}\n\n\t\t\t\t$elOpener.one('aftershow.top-menu-popup', afterShow);\n\t\t\t}\n\n\t\t\t// deprecated, используется afterclose.top-menu-popup\n\t\t\tif ($elOpener.data('afterclose')) {\n\t\t\t\tlet afterclose = $elOpener.data('afterclose');\n\t\t\t\tif (typeof (afterclose) == 'string') {\n\t\t\t\t\t// TODO: Удалить с сайта указание кода функции в html\n\t\t\t\t\t// @deprecated\n\t\t\t\t\tafterclose = eval(afterclose.replace(/\\W/g, ''));\n\t\t\t\t}\n\n\t\t\t\t$elOpener.one('afterclose.top-menu-popup', afterclose);\n\t\t\t}\n\t\t}\n\n\t\toptions.isFullScreen = Core.state.isMobile;\n\n\t\treturn new TopLibPopup(elOpener, options);\n\t}\n\n\tstatic close(elPopup: HTMLElement, restoreFocus = true): void {\n\t\tconst popup = Worker.getPopup(elPopup);\n\t\tif (popup) {\n\t\t\tpopup.close();\n\n\t\t\tif (restoreFocus) {\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tpopup.el.focus();\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic recalcPosition(elPopup: HTMLElement): void {\n\t\tconst popup = Worker.getPopup(elPopup);\n\t\tif (popup && popup.elPopupBody instanceof HTMLElement) {\n\t\t\tpopup.recalcPosition();\n\t\t}\n\t}\n\n\t/**\n\t * Скролл к активному элементу списка\n\t */\n\tstatic scrollToActive(elPopup: HTMLElement): void {\n\t\tconst elItemActive = DOM.querySelectorVisible(elPopup, 'ul.top-popup_content > li > .top-active');\n\t\tif (!elItemActive) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst elUl = elPopup.querySelector('ul.top-popup_content');\n\t\tconst elsLi = DOM.querySelectorAllVisible(elPopup, 'ul.top-popup_content > li');\n\n\t\telPopup.classList.add('top-popup-wrapper-no_animate');\n\t\tsetTimeout(() => elPopup.classList.remove('top-popup-wrapper-no_animate'), 100);\n\n\t\tlet top = 100;\n\t\tfor (const elLi of elsLi) {\n\t\t\tif (elLi.querySelector(':scope > .top-active')) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (elLi instanceof HTMLElement) top += elLi.offsetHeight;\n\t\t}\n\n\t\tif (elUl instanceof HTMLElement) {\n\t\t\tconst heightWrapper = elUl.offsetHeight;\n\t\t\tif (top > heightWrapper) {\n\t\t\t\telUl.scrollTop = top - heightWrapper;\n\t\t\t} else {\n\t\t\t\telUl.scrollTop = 0;\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic decoratorBeforeOpen(popup: TopLibPopup): void {\n\t\tif (this.options.decoratorBeforeOpen) {\n\t\t\tthis.options.decoratorBeforeOpen(popup);\n\t\t}\n\t};\n\n\tstatic decoratorAfterOpen(popup: TopLibPopup): void {\n\t\tif (this.options.decoratorAfterOpen) {\n\t\t\tthis.options.decoratorAfterOpen(popup);\n\t\t}\n\t};\n\n\tstatic decoratorIsIgnoreOuterClick(e: MouseEvent): boolean {\n\t\tif (this.options.decoratorIsIgnoreOuterClick) {\n\t\t\treturn this.options.decoratorIsIgnoreOuterClick(e);\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Зарегистрировать Vue компонент\n\t *\n\t * Каждый экземляр Popup регистрируется в словаре vueConnectors для последующего доступа из js\n\t */\n\tstatic regVueComponent(id: string, vueConnector: any): void {\n\t\tif (Worker.vueConnectors.get(id)) {\n\t\t\tthrow 'Vue component Popup use duplicated id: ' + id;\n\t\t}\n\n\t\tWorker.vueConnectors.set(id, vueConnector);\n\t}\n\n\t/**\n\t * Снять с регистрации Vue компонент\n\t */\n\tstatic unregVueComponent(id: string): void {\n\t\tWorker.vueConnectors.delete(id);\n\t}\n\n\t/**\n\t * Сгенерировать элемент для открытия popup\n\t */\n\tstatic genElPopupOpener(tagName: string, props: OpenerProps, ...elsChildrens: HTMLElement[] | string[]): HTMLElement {\n\t\tconst el = DOM.genEl(tagName, {}, ...elsChildrens);\n\n\t\tel.dataset.topPopup = '#' + props.id;\n\n\t\t// if (props.pos === undefined) props.pos = '3';\n\t\t// if (props.notch === undefined) props.notch = true;\n\t\t// if (props.posBy === undefined) props.posBy = 'fixed';\n\n\t\tfor (let name in props) {\n\t\t\tconst attrName = 'topPopup' + name.charAt(0).toUpperCase() + name.slice(1);\n\n\t\t\tel.dataset[attrName] = props[name];\n\t\t}\n\n\t\treturn el;\n\t}\n\n}\n\nexport default Worker;\n"],"names":["elPopup","el","elOpener2","options2","popup","elLi","elsLi","elUl","heightWrapper","top","e","id","vueConnector","tagName","elsChildrens","name","props"],"mappings":"4KA6BA,MAAA,MAAA,mBAKkB,OAAA,cAAA,IAAA,sBAOU,OAAA,SAAAA,EAAA,+CAMY,CACvC,OAAA,iBAAAC,EAAA,CAGC,OAAAA,EAAA,QAAA,kBAAA,CAAiD,CAClD,OAAA,mBAAAA,EAAA,oCAIC,OAAAC,2CAAA,IAEwC,8FAOuB,uGAOE,CAClE,aAAA,aAAAA,EAAA,CAOC,GAAA,EAAAA,aAAA,aAAA,8EAWAA,EAAA,QAAA,+CAIAA,EAAA,QAAA,mDAOAA,EAAA,QAAA,gBACCC,EAAA,MAAAD,EAAA,QAAA,gBAAA,QAAAA,EAAA,QAAA,gBAAA,KAGDA,EAAA,QAAA,iDAIAA,EAAA,QAAA,iDAIAA,EAAA,QAAA,yDAOAA,EAAA,QAAA,kBACCC,EAAA,QAAAD,EAAA,QAAA,kBAAA,QAAAA,EAAA,QAAA,kBAAA,KAMDA,EAAA,QAAA,sBACCC,EAAA,YAAAD,EAAA,QAAA,sBAAA,QAAAA,EAAA,QAAA,sBAAA,KAMDA,EAAA,QAAA,sBACCC,EAAA,YAAAD,EAAA,QAAA,sBAAA,QAAAA,EAAA,QAAA,sBAAA,2BAGyC,CAC3C,aAAA,KAAA,SAAA,QAAA,yKAYC,GAAA,MAAA,KAAA,EAAA,wCAIC,GAAA,UAAA,KAAA,WAAA,EAAA,2CAEC,OAAA,WAAA,WAGC,UAAA,KAAA,UAAA,QAAA,MAAA,EAAA,CAAA,GAGD,UAAA,IAAA,2BAAA,SAAA,CAAmD,CAIpD,GAAA,UAAA,KAAA,YAAA,EAAA,6CAEC,OAAA,YAAA,WAGC,WAAA,KAAA,WAAA,QAAA,MAAA,EAAA,CAAA,GAGD,UAAA,IAAA,4BAAA,UAAA,CAAqD,CACtD,uDAKD,IAAA,YAAA,SAAA,OAAA,CAAwC,kFAUrCE,EAAA,GAAA,MAAA,CAAe,CAAA,EAGlB,CACD,OAAA,eAAAJ,EAAA,uFAMC,CACD,OAAA,eAAAA,EAAA,2NAcCA,EAAA,UAAA,IAAA,8BAAA,EACA,WAAA,IAAAA,EAAA,UAAA,OAAA,8BAAA,EAAA,GAAA,YAGA,UAAAK,KAAAC,EAAA,CACC,GAAAD,EAAA,cAAA,sBAAA,qDAI6C,CAG9C,GAAAE,aAAA,YAAA,CACC,MAAAC,EAAAD,EAAA,aACAE,EAAAD,EACCD,EAAA,UAAAE,EAAAD,EAEAD,EAAA,UAAA,CACD,CACD,CACD,OAAA,oBAAAH,EAAA,CAGC,KAAA,QAAA,qBACC,KAAA,QAAA,oBAAAA,CAAA,CACD,CACD,OAAA,mBAAAA,EAAA,CAGC,KAAA,QAAA,oBACC,KAAA,QAAA,mBAAAA,CAAA,CACD,CACD,OAAA,4BAAAM,EAAA,CAGC,OAAA,KAAA,QAAA,wEAIA,EAAO,CACR,OAAA,gBAAAC,EAAAC,EAAA,8GAY0C,CAC1C,OAAA,kBAAAD,EAAA,CAMC,OAAA,cAAA,OAAAA,CAAA,CAA8B,mCAO9B,MAAAV,EAAA,UAAA,QAAA,MAAAY,EAAA,CAAA,EAAA,GAAAC,CAAA,8BAQA,QAAAC,KAAAC,EAAA,0EAGkC,CAGlC,OAAAf,CAAO,CAGT"}
|
package/popup/worker.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as Core } from "../.chunks/forms-
|
|
1
|
+
import { C as Core } from "../.chunks/forms-1PEYT7sp.es.js";
|
|
2
2
|
import DOM from "../utils/dom.js";
|
|
3
3
|
class Worker {
|
|
4
4
|
/**
|
|
@@ -16,6 +16,13 @@ class Worker {
|
|
|
16
16
|
static getPopup(t) {
|
|
17
17
|
return DOM.storage(t, "TopPopup");
|
|
18
18
|
}
|
|
19
|
+
static getElPopupOpener(t) {
|
|
20
|
+
return t.closest("[data-top-popup]");
|
|
21
|
+
}
|
|
22
|
+
static getPopupFromOpener(t) {
|
|
23
|
+
const o = Worker.getElPopupOpener(t);
|
|
24
|
+
return o ? DOM.storage(o, "#TopPopup") : null;
|
|
25
|
+
}
|
|
19
26
|
/**
|
|
20
27
|
* Вернуть все элементы с Popup
|
|
21
28
|
*/
|
|
@@ -44,7 +51,7 @@ class Worker {
|
|
|
44
51
|
*/
|
|
45
52
|
static async open(elOpener, options) {
|
|
46
53
|
elOpener instanceof HTMLElement && (elOpener.dataset.topPopupOpened = "opened");
|
|
47
|
-
const { TopLibPopup } = await import("../.chunks/popup-
|
|
54
|
+
const { TopLibPopup } = await import("../.chunks/popup-Bh3WbTKH.es.js");
|
|
48
55
|
if (Core.$) {
|
|
49
56
|
const $elOpener = Core.$(elOpener);
|
|
50
57
|
if ($elOpener.data("aftershow")) {
|
|
@@ -58,9 +65,11 @@ class Worker {
|
|
|
58
65
|
}
|
|
59
66
|
return options.isFullScreen = Core.state.isMobile, new TopLibPopup(elOpener, options);
|
|
60
67
|
}
|
|
61
|
-
static close(t) {
|
|
62
|
-
const
|
|
63
|
-
|
|
68
|
+
static close(t, o = !0) {
|
|
69
|
+
const e = Worker.getPopup(t);
|
|
70
|
+
e && (e.close(), o && setTimeout(() => {
|
|
71
|
+
e.el.focus();
|
|
72
|
+
}));
|
|
64
73
|
}
|
|
65
74
|
static recalcPosition(t) {
|
|
66
75
|
const o = Worker.getPopup(t);
|
|
@@ -72,17 +81,17 @@ class Worker {
|
|
|
72
81
|
static scrollToActive(t) {
|
|
73
82
|
if (!DOM.querySelectorVisible(t, "ul.top-popup_content > li > .top-active"))
|
|
74
83
|
return;
|
|
75
|
-
const
|
|
84
|
+
const e = t.querySelector("ul.top-popup_content"), a = DOM.querySelectorAllVisible(t, "ul.top-popup_content > li");
|
|
76
85
|
t.classList.add("top-popup-wrapper-no_animate"), setTimeout(() => t.classList.remove("top-popup-wrapper-no_animate"), 100);
|
|
77
|
-
let
|
|
78
|
-
for (const
|
|
79
|
-
if (
|
|
86
|
+
let r = 100;
|
|
87
|
+
for (const p of a) {
|
|
88
|
+
if (p.querySelector(":scope > .top-active"))
|
|
80
89
|
break;
|
|
81
|
-
|
|
90
|
+
p instanceof HTMLElement && (r += p.offsetHeight);
|
|
82
91
|
}
|
|
83
|
-
if (
|
|
84
|
-
const
|
|
85
|
-
|
|
92
|
+
if (e instanceof HTMLElement) {
|
|
93
|
+
const p = e.offsetHeight;
|
|
94
|
+
r > p ? e.scrollTop = r - p : e.scrollTop = 0;
|
|
86
95
|
}
|
|
87
96
|
}
|
|
88
97
|
static decoratorBeforeOpen(t) {
|
|
@@ -111,16 +120,16 @@ class Worker {
|
|
|
111
120
|
Worker.vueConnectors.delete(t);
|
|
112
121
|
}
|
|
113
122
|
/**
|
|
114
|
-
*
|
|
123
|
+
* Сгенерировать элемент для открытия popup
|
|
115
124
|
*/
|
|
116
|
-
static genElPopupOpener(t, o, ...
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
for (let
|
|
120
|
-
const
|
|
121
|
-
|
|
125
|
+
static genElPopupOpener(t, o, ...e) {
|
|
126
|
+
const a = DOM.genEl(t, {}, ...e);
|
|
127
|
+
a.dataset.topPopup = "#" + o.id;
|
|
128
|
+
for (let r in o) {
|
|
129
|
+
const p = "topPopup" + r.charAt(0).toUpperCase() + r.slice(1);
|
|
130
|
+
a.dataset[p] = o[r];
|
|
122
131
|
}
|
|
123
|
-
return
|
|
132
|
+
return a;
|
|
124
133
|
}
|
|
125
134
|
}
|
|
126
135
|
export {
|
package/popup/worker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.js","sources":["../../src/components/popup/lib/worker.ts"],"sourcesContent":["/**\n * PopupWorker управляет работой Popup\n *\n * Должен грузить TopLibPopup только в отложенном режиме\n */\n\nimport Core from '@/core/core/core';\nimport DOM from '@/core/utils/dom';\nimport type { TopLibPopup, PopupOptions } from '@/components/popup/lib/popup';\nimport type { OpenerProps } from '@/components/popup/popup/types';\n\nexport type Options = {\n\t/**\n\t * Глобальное событие, которое будет вызвано перед открытием TopPopup\n\t */\n\tdecoratorBeforeOpen?: (popup: TopLibPopup) => void,\n\n\t/**\n\t * Глобальное событие, которое будет вызвано после открытия TopPopup\n\t */\n\tdecoratorAfterOpen?: (popup: TopLibPopup) => void;\n\n\t/**\n\t * Определитель того, что клик вне Popup нужно игнорировать\n\t * @returns {boolean} - если true, то click не приведет к закрытию Popup\n\t */\n\tdecoratorIsIgnoreOuterClick?: (e: MouseEvent) => boolean\n}\n\nclass Worker {\n\n\t/**\n\t * Глобальное выключение закрытия меню, используется при различных оверлеях\n\t */\n\tstatic noClose = false;\n\n\t/**\n\t * Для взаимодействия с vue\n\t */\n\tstatic vueConnectors = new Map();\n\n\tstatic options: Options = {};\n\n\t/**\n\t * Вернуть объект компонента popup, привязанный к элементу\n\t */\n\tstatic getPopup(elPopup: HTMLElement): TopLibPopup {\n\t\treturn DOM.storage(elPopup, 'TopPopup') as TopLibPopup;\n\t}\n\n\t/**\n\t * Вернуть все элементы с Popup\n\t */\n\tstatic getAll(): HTMLElement[] {\n\t\treturn DOM.querySelectorAllArray(document, '.top-popup-wrapper');\n\t}\n\n\t/**\n\t * Вернуть все элементы с открытыми Popup\n\t */\n\tstatic getAllVisible(): HTMLElement[] {\n\t\treturn DOM.querySelectorAllVisible(document, '.top-popup-wrapper');\n\t}\n\n\t/**\n\t * Открыть Popup от указанного elOpener\n\t * @param {HTMLElement} elOpener - элемент, который должен вызвать открытие Popup\n\t */\n\tstatic async openByOpener(elOpener: HTMLElement): Promise<TopLibPopup | undefined> {\n\t\tif (!(elOpener instanceof HTMLElement)) return;\n\n\t\tconst options: PopupOptions = {};\n\n\t\toptions.popup = elOpener.dataset.topPopup;\n\n\t\toptions.id = elOpener.dataset.topPopupId;\n\n\t\t/**\n\t\t * @deprecated topPopupP - добавлено для обратной совместимости\n\t\t */\n\t\tif (elOpener.dataset.topPopupP) {\n\t\t\toptions.p = parseInt(elOpener.dataset.topPopupP);\n\t\t}\n\n\t\tif (elOpener.dataset.topPopupPos) {\n\t\t\toptions.p = parseInt(elOpener.dataset.topPopupPos);\n\t\t}\n\n\t\t/**\n\t\t * @deprecated '1' - добавлено для обратной совместимости\n\t\t */\n\t\tif (elOpener.dataset.topPopupNotch) {\n\t\t\toptions.notch = elOpener.dataset.topPopupNotch === 'true' || elOpener.dataset.topPopupNotch === '1';\n\t\t}\n\n\t\tif (elOpener.dataset.topPopupClass) {\n\t\t\toptions.class = elOpener.dataset.topPopupClass;\n\t\t}\n\n\t\tif (elOpener.dataset.topPopupPosBy) {\n\t\t\toptions.posBy = elOpener.dataset.topPopupPosBy as PopupOptions['posBy'];\n\t\t}\n\n\t\tif (elOpener.dataset.topPopupFront) {\n\t\t\toptions.frontSelector = elOpener.dataset.topPopupFront;\n\t\t}\n\n\t\t/**\n\t\t * @deprecated '1' - добавлено для обратной совместимости\n\t\t */\n\t\tif (elOpener.dataset.topPopupInvertX) {\n\t\t\toptions.invertX = elOpener.dataset.topPopupInvertX === 'true' || elOpener.dataset.topPopupInvertX === '1';\n\t\t}\n\n\t\t/**\n\t\t * @deprecated '1' - добавлено для обратной совместимости\n\t\t */\n\t\tif (elOpener.dataset.topPopupOpenByHover) {\n\t\t\toptions.openByHover = elOpener.dataset.topPopupOpenByHover === 'true' || elOpener.dataset.topPopupOpenByHover === '1';\n\t\t}\n\n\t\t/**\n\t\t * @deprecated '1' - добавлено для обратной совместимости\n\t\t */\n\t\tif (elOpener.dataset.topPopupUseOriginal) {\n\t\t\toptions.useOriginal = elOpener.dataset.topPopupUseOriginal === 'true' || elOpener.dataset.topPopupUseOriginal === '1';\n\t\t}\n\n\t\treturn await Worker.open(elOpener, options);\n\t}\n\n\t/**\n\t * Создать и открыть Popup\n\t * @param elOpener - элемент, вызвавший открытие Popup\n\t * @param options - опции Popup\n\t */\n\tprivate static async open(elOpener: HTMLElement, options: PopupOptions): Promise<TopLibPopup> {\n\t\tif (elOpener instanceof HTMLElement) elOpener.dataset.topPopupOpened = 'opened';\n\n\t\tconst { TopLibPopup } = await import('./popup');\n\n\t\tif (Core.$) {\n\t\t\tconst $elOpener = Core.$(elOpener);\n\n\t\t\t// deprecated, используется aftershow.top-menu-popup\n\t\t\tif ($elOpener.data('aftershow')) {\n\t\t\t\tlet afterShow = $elOpener.data('aftershow');\n\t\t\t\tif (typeof (afterShow) == 'string') {\n\t\t\t\t\t// TODO: Удалить с сайта указание кода функции в html\n\t\t\t\t\t// @deprecated\n\t\t\t\t\tafterShow = eval(afterShow.replace(/\\W/g, ''));\n\t\t\t\t}\n\n\t\t\t\t$elOpener.one('aftershow.top-menu-popup', afterShow);\n\t\t\t}\n\n\t\t\t// deprecated, используется afterclose.top-menu-popup\n\t\t\tif ($elOpener.data('afterclose')) {\n\t\t\t\tlet afterclose = $elOpener.data('afterclose');\n\t\t\t\tif (typeof (afterclose) == 'string') {\n\t\t\t\t\t// TODO: Удалить с сайта указание кода функции в html\n\t\t\t\t\t// @deprecated\n\t\t\t\t\tafterclose = eval(afterclose.replace(/\\W/g, ''));\n\t\t\t\t}\n\n\t\t\t\t$elOpener.one('afterclose.top-menu-popup', afterclose);\n\t\t\t}\n\t\t}\n\n\t\toptions.isFullScreen = Core.state.isMobile;\n\n\t\treturn new TopLibPopup(elOpener, options);\n\t}\n\n\tstatic close(elPopup: HTMLElement): void {\n\t\tconst popup = Worker.getPopup(elPopup);\n\t\tif (popup) {\n\t\t\tpopup.close();\n\t\t}\n\t}\n\n\tstatic recalcPosition(elPopup: HTMLElement): void {\n\t\tconst popup = Worker.getPopup(elPopup);\n\t\tif (popup && popup.elPopupBody instanceof HTMLElement) {\n\t\t\tpopup.recalcPosition();\n\t\t}\n\t}\n\n\t/**\n\t * Скролл к активному элементу списка\n\t */\n\tstatic scrollToActive(elPopup: HTMLElement): void {\n\t\tconst elItemActive = DOM.querySelectorVisible(elPopup, 'ul.top-popup_content > li > .top-active');\n\t\tif (!elItemActive) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst elUl = elPopup.querySelector('ul.top-popup_content');\n\t\tconst elsLi = DOM.querySelectorAllVisible(elPopup, 'ul.top-popup_content > li');\n\n\t\telPopup.classList.add('top-popup-wrapper-no_animate');\n\t\tsetTimeout(() => elPopup.classList.remove('top-popup-wrapper-no_animate'), 100);\n\n\t\tlet top = 100;\n\t\tfor (const elLi of elsLi) {\n\t\t\tif (elLi.querySelector(':scope > .top-active')) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (elLi instanceof HTMLElement) top += elLi.offsetHeight;\n\t\t}\n\n\t\tif (elUl instanceof HTMLElement) {\n\t\t\tconst heightWrapper = elUl.offsetHeight;\n\t\t\tif (top > heightWrapper) {\n\t\t\t\telUl.scrollTop = top - heightWrapper;\n\t\t\t} else {\n\t\t\t\telUl.scrollTop = 0;\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic decoratorBeforeOpen(popup: TopLibPopup): void {\n\t\tif (this.options.decoratorBeforeOpen) {\n\t\t\tthis.options.decoratorBeforeOpen(popup);\n\t\t}\n\t};\n\n\tstatic decoratorAfterOpen(popup: TopLibPopup): void {\n\t\tif (this.options.decoratorAfterOpen) {\n\t\t\tthis.options.decoratorAfterOpen(popup);\n\t\t}\n\t};\n\n\tstatic decoratorIsIgnoreOuterClick(e: MouseEvent): boolean {\n\t\tif (this.options.decoratorIsIgnoreOuterClick) {\n\t\t\treturn this.options.decoratorIsIgnoreOuterClick(e);\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Зарегистрировать Vue компонент\n\t *\n\t * Каждый экземляр Popup регистрируется в словаре vueConnectors для последующего доступа из js\n\t */\n\tstatic regVueComponent(id: string, vueConnector: any): void {\n\t\tif (Worker.vueConnectors.get(id)) {\n\t\t\tthrow 'Vue component Popup use duplicated id: ' + id;\n\t\t}\n\n\t\tWorker.vueConnectors.set(id, vueConnector);\n\t}\n\n\t/**\n\t * Снять с регистрации Vue компонент\n\t */\n\tstatic unregVueComponent(id: string): void {\n\t\tWorker.vueConnectors.delete(id);\n\t}\n\n\t/**\n\t * Сгенерировтаь элемент для открытия popup\n\t */\n\tstatic genElPopupOpener(tagName: string, props: OpenerProps, ...elsChildrens: HTMLElement[] | string[]): HTMLElement {\n\t\tconst el = DOM.genEl(tagName, {}, ...elsChildrens);\n\n\t\tel.dataset.topPopup = '#' + props.id;\n\n\t\t// if (props.pos === undefined) props.pos = '3';\n\t\t// if (props.notch === undefined) props.notch = true;\n\t\t// if (props.posBy === undefined) props.posBy = 'fixed';\n\n\t\tfor (let name in props) {\n\t\t\tconst attrName = 'topPopup' + name.charAt(0).toUpperCase() + name.slice(1);\n\n\t\t\tel.dataset[attrName] = props[name];\n\t\t}\n\n\t\treturn el;\n\t}\n\n}\n\nexport default Worker;\n"],"names":["elPopup","elOpener","options","popup","elUl","elsLi","top","elLi","heightWrapper","e","id","vueConnector","tagName","props","elsChildrens","el","name","attrName"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"worker.js","sources":["../../src/components/popup/lib/worker.ts"],"sourcesContent":["/**\n * PopupWorker управляет работой Popup\n *\n * Должен грузить TopLibPopup только в отложенном режиме\n */\n\nimport Core from '@/core/core/core';\nimport DOM from '@/core/utils/dom';\nimport type { PopupOptions, TopLibPopup } from '@/components/popup/lib/popup';\nimport type { OpenerProps } from '@/components/popup/popup/types';\n\nexport type Options = {\n\t/**\n\t * Глобальное событие, которое будет вызвано перед открытием TopPopup\n\t */\n\tdecoratorBeforeOpen?: (popup: TopLibPopup) => void,\n\n\t/**\n\t * Глобальное событие, которое будет вызвано после открытия TopPopup\n\t */\n\tdecoratorAfterOpen?: (popup: TopLibPopup) => void;\n\n\t/**\n\t * Определитель того, что клик вне Popup нужно игнорировать\n\t * @returns {boolean} - если true, то click не приведет к закрытию Popup\n\t */\n\tdecoratorIsIgnoreOuterClick?: (e: MouseEvent) => boolean\n}\n\nclass Worker {\n\n\t/**\n\t * Глобальное выключение закрытия меню, используется при различных оверлеях\n\t */\n\tstatic noClose = false;\n\n\t/**\n\t * Для взаимодействия с vue\n\t */\n\tstatic vueConnectors = new Map();\n\n\tstatic options: Options = {};\n\n\t/**\n\t * Вернуть объект компонента popup, привязанный к элементу\n\t */\n\tstatic getPopup(elPopup: HTMLElement): TopLibPopup {\n\t\treturn DOM.storage(elPopup, 'TopPopup') as TopLibPopup;\n\t}\n\n\tstatic getElPopupOpener(el: Element): HTMLElement | null {\n\t\treturn el.closest<HTMLElement>('[data-top-popup]');\n\t}\n\n\tstatic getPopupFromOpener(el: HTMLElement): TopLibPopup | null {\n\t\tconst elOpener = Worker.getElPopupOpener(el);\n\t\tif (!elOpener) return null;\n\n\t\treturn DOM.storage(elOpener, '#TopPopup');\n\t}\n\n\t/**\n\t * Вернуть все элементы с Popup\n\t */\n\tstatic getAll(): HTMLElement[] {\n\t\treturn DOM.querySelectorAllArray(document, '.top-popup-wrapper');\n\t}\n\n\t/**\n\t * Вернуть все элементы с открытыми Popup\n\t */\n\tstatic getAllVisible(): HTMLElement[] {\n\t\treturn DOM.querySelectorAllVisible(document, '.top-popup-wrapper');\n\t}\n\n\t/**\n\t * Открыть Popup от указанного elOpener\n\t * @param {HTMLElement} elOpener - элемент, который должен вызвать открытие Popup\n\t */\n\tstatic async openByOpener(elOpener: HTMLElement): Promise<TopLibPopup | undefined> {\n\t\tif (!(elOpener instanceof HTMLElement)) return;\n\n\t\tconst options: PopupOptions = {};\n\n\t\toptions.popup = elOpener.dataset.topPopup;\n\n\t\toptions.id = elOpener.dataset.topPopupId;\n\n\t\t/**\n\t\t * @deprecated topPopupP - добавлено для обратной совместимости\n\t\t */\n\t\tif (elOpener.dataset.topPopupP) {\n\t\t\toptions.p = parseInt(elOpener.dataset.topPopupP);\n\t\t}\n\n\t\tif (elOpener.dataset.topPopupPos) {\n\t\t\toptions.p = parseInt(elOpener.dataset.topPopupPos);\n\t\t}\n\n\t\t/**\n\t\t * @deprecated '1' - добавлено для обратной совместимости\n\t\t */\n\t\tif (elOpener.dataset.topPopupNotch) {\n\t\t\toptions.notch = elOpener.dataset.topPopupNotch === 'true' || elOpener.dataset.topPopupNotch === '1';\n\t\t}\n\n\t\tif (elOpener.dataset.topPopupClass) {\n\t\t\toptions.class = elOpener.dataset.topPopupClass;\n\t\t}\n\n\t\tif (elOpener.dataset.topPopupPosBy) {\n\t\t\toptions.posBy = elOpener.dataset.topPopupPosBy as PopupOptions['posBy'];\n\t\t}\n\n\t\tif (elOpener.dataset.topPopupFront) {\n\t\t\toptions.frontSelector = elOpener.dataset.topPopupFront;\n\t\t}\n\n\t\t/**\n\t\t * @deprecated '1' - добавлено для обратной совместимости\n\t\t */\n\t\tif (elOpener.dataset.topPopupInvertX) {\n\t\t\toptions.invertX = elOpener.dataset.topPopupInvertX === 'true' || elOpener.dataset.topPopupInvertX === '1';\n\t\t}\n\n\t\t/**\n\t\t * @deprecated '1' - добавлено для обратной совместимости\n\t\t */\n\t\tif (elOpener.dataset.topPopupOpenByHover) {\n\t\t\toptions.openByHover = elOpener.dataset.topPopupOpenByHover === 'true' || elOpener.dataset.topPopupOpenByHover === '1';\n\t\t}\n\n\t\t/**\n\t\t * @deprecated '1' - добавлено для обратной совместимости\n\t\t */\n\t\tif (elOpener.dataset.topPopupUseOriginal) {\n\t\t\toptions.useOriginal = elOpener.dataset.topPopupUseOriginal === 'true' || elOpener.dataset.topPopupUseOriginal === '1';\n\t\t}\n\n\t\treturn await Worker.open(elOpener, options);\n\t}\n\n\t/**\n\t * Создать и открыть Popup\n\t * @param elOpener - элемент, вызвавший открытие Popup\n\t * @param options - опции Popup\n\t */\n\tprivate static async open(elOpener: HTMLElement, options: PopupOptions): Promise<TopLibPopup> {\n\t\tif (elOpener instanceof HTMLElement) elOpener.dataset.topPopupOpened = 'opened';\n\n\t\tconst { TopLibPopup } = await import('./popup');\n\n\t\tif (Core.$) {\n\t\t\tconst $elOpener = Core.$(elOpener);\n\n\t\t\t// deprecated, используется aftershow.top-menu-popup\n\t\t\tif ($elOpener.data('aftershow')) {\n\t\t\t\tlet afterShow = $elOpener.data('aftershow');\n\t\t\t\tif (typeof (afterShow) == 'string') {\n\t\t\t\t\t// TODO: Удалить с сайта указание кода функции в html\n\t\t\t\t\t// @deprecated\n\t\t\t\t\tafterShow = eval(afterShow.replace(/\\W/g, ''));\n\t\t\t\t}\n\n\t\t\t\t$elOpener.one('aftershow.top-menu-popup', afterShow);\n\t\t\t}\n\n\t\t\t// deprecated, используется afterclose.top-menu-popup\n\t\t\tif ($elOpener.data('afterclose')) {\n\t\t\t\tlet afterclose = $elOpener.data('afterclose');\n\t\t\t\tif (typeof (afterclose) == 'string') {\n\t\t\t\t\t// TODO: Удалить с сайта указание кода функции в html\n\t\t\t\t\t// @deprecated\n\t\t\t\t\tafterclose = eval(afterclose.replace(/\\W/g, ''));\n\t\t\t\t}\n\n\t\t\t\t$elOpener.one('afterclose.top-menu-popup', afterclose);\n\t\t\t}\n\t\t}\n\n\t\toptions.isFullScreen = Core.state.isMobile;\n\n\t\treturn new TopLibPopup(elOpener, options);\n\t}\n\n\tstatic close(elPopup: HTMLElement, restoreFocus = true): void {\n\t\tconst popup = Worker.getPopup(elPopup);\n\t\tif (popup) {\n\t\t\tpopup.close();\n\n\t\t\tif (restoreFocus) {\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tpopup.el.focus();\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic recalcPosition(elPopup: HTMLElement): void {\n\t\tconst popup = Worker.getPopup(elPopup);\n\t\tif (popup && popup.elPopupBody instanceof HTMLElement) {\n\t\t\tpopup.recalcPosition();\n\t\t}\n\t}\n\n\t/**\n\t * Скролл к активному элементу списка\n\t */\n\tstatic scrollToActive(elPopup: HTMLElement): void {\n\t\tconst elItemActive = DOM.querySelectorVisible(elPopup, 'ul.top-popup_content > li > .top-active');\n\t\tif (!elItemActive) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst elUl = elPopup.querySelector('ul.top-popup_content');\n\t\tconst elsLi = DOM.querySelectorAllVisible(elPopup, 'ul.top-popup_content > li');\n\n\t\telPopup.classList.add('top-popup-wrapper-no_animate');\n\t\tsetTimeout(() => elPopup.classList.remove('top-popup-wrapper-no_animate'), 100);\n\n\t\tlet top = 100;\n\t\tfor (const elLi of elsLi) {\n\t\t\tif (elLi.querySelector(':scope > .top-active')) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (elLi instanceof HTMLElement) top += elLi.offsetHeight;\n\t\t}\n\n\t\tif (elUl instanceof HTMLElement) {\n\t\t\tconst heightWrapper = elUl.offsetHeight;\n\t\t\tif (top > heightWrapper) {\n\t\t\t\telUl.scrollTop = top - heightWrapper;\n\t\t\t} else {\n\t\t\t\telUl.scrollTop = 0;\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic decoratorBeforeOpen(popup: TopLibPopup): void {\n\t\tif (this.options.decoratorBeforeOpen) {\n\t\t\tthis.options.decoratorBeforeOpen(popup);\n\t\t}\n\t};\n\n\tstatic decoratorAfterOpen(popup: TopLibPopup): void {\n\t\tif (this.options.decoratorAfterOpen) {\n\t\t\tthis.options.decoratorAfterOpen(popup);\n\t\t}\n\t};\n\n\tstatic decoratorIsIgnoreOuterClick(e: MouseEvent): boolean {\n\t\tif (this.options.decoratorIsIgnoreOuterClick) {\n\t\t\treturn this.options.decoratorIsIgnoreOuterClick(e);\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Зарегистрировать Vue компонент\n\t *\n\t * Каждый экземляр Popup регистрируется в словаре vueConnectors для последующего доступа из js\n\t */\n\tstatic regVueComponent(id: string, vueConnector: any): void {\n\t\tif (Worker.vueConnectors.get(id)) {\n\t\t\tthrow 'Vue component Popup use duplicated id: ' + id;\n\t\t}\n\n\t\tWorker.vueConnectors.set(id, vueConnector);\n\t}\n\n\t/**\n\t * Снять с регистрации Vue компонент\n\t */\n\tstatic unregVueComponent(id: string): void {\n\t\tWorker.vueConnectors.delete(id);\n\t}\n\n\t/**\n\t * Сгенерировать элемент для открытия popup\n\t */\n\tstatic genElPopupOpener(tagName: string, props: OpenerProps, ...elsChildrens: HTMLElement[] | string[]): HTMLElement {\n\t\tconst el = DOM.genEl(tagName, {}, ...elsChildrens);\n\n\t\tel.dataset.topPopup = '#' + props.id;\n\n\t\t// if (props.pos === undefined) props.pos = '3';\n\t\t// if (props.notch === undefined) props.notch = true;\n\t\t// if (props.posBy === undefined) props.posBy = 'fixed';\n\n\t\tfor (let name in props) {\n\t\t\tconst attrName = 'topPopup' + name.charAt(0).toUpperCase() + name.slice(1);\n\n\t\t\tel.dataset[attrName] = props[name];\n\t\t}\n\n\t\treturn el;\n\t}\n\n}\n\nexport default Worker;\n"],"names":["elPopup","el","elOpener","options","restoreFocus","popup","elUl","elsLi","top","elLi","heightWrapper","e","id","vueConnector","tagName","props","elsChildrens","name","attrName"],"mappings":"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"}
|
package/project/project.amd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
define(["require","exports","vue","../.chunks/forms-DO87ZZk9.amd","../.chunks/listItem.vue_vue_type_script_setup_true_lang-DDQSxC8E.amd","../.chunks/menu.vue_vue_type_style_index_0_lang-7eYwnVLw.amd","../.chunks/utils-DAIrXU57.amd","../utils/searchers.amd","../utils/dom.amd","../popup/worker.amd","../require/css.amd!../assets/project.css"],function(ne,T,e,x,E,oe,le,P,_,ae){"use strict";if(typeof e>"u")var e=window.Vue;const re={class:"top-selectorCompetitors"},ie={class:"top-ellipsis1"},de=e.defineComponent({__name:"selectorCompetitors",props:e.mergeModels({modelValue:{},items:{},showSelectAllItem:{type:Boolean,default:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const l=n,r=e.useModel(n,"modelValue"),t=e.computed(()=>{if(l.showSelectAllItem)return{icon:"",title:x.useI18n().Common.Select_all,value:"all",content:""}});return(d,o)=>(e.openBlock(),e.createElementBlock("div",re,[e.unref(x.Core).state.isMobile?(e.openBlock(),e.createBlock(E._sfc_main,{key:0},{opener:e.withCtx(()=>[e.createVNode(x._sfc_main,{class:"top-selectorCompetitors_opener",color:"theme",icon:"",icon2:""},{default:e.withCtx(()=>{var a;return[e.createTextVNode(e.toDisplayString((a=d.items.find(s=>{var v;return s.value===((v=r.value)==null?void 0:v[0])}))==null?void 0:a.content),1)]}),_:1})]),contentList:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.items,a=>{var s;return e.openBlock(),e.createBlock(E._sfc_main$1,{class:e.normalizeClass({"top-active":(s=r.value)==null?void 0:s.includes(a.value)}),"data-top-icon":a.icon,title:a.title,onClick:()=>r.value=[a.value]},{default:e.withCtx(()=>[e.createElementVNode("span",ie,e.toDisplayString(a.content),1)]),_:2},1032,["class","data-top-icon","title","onClick"])}),256))]),_:1})):(e.openBlock(),e.createBlock(oe._sfc_main,{key:1,modelValue:r.value,"onUpdate:modelValue":o[0]||(o[0]=a=>r.value=a),items:d.items,isMultiple:!0,styling:"bar",canBeEmptyMultiple:!1,selectAllItem:t.value},null,8,["modelValue","items","selectAllItem"]))]))}}),w=-1,p=-2,L=-1,ue={0:"Yandex",1:"Google",4:"YouTube",5:"Bing",7:"Seznam",8:"AppStore",9:"GoogleStore",20:"Yandex.com",21:"Yandex.com.tr"},J={key:p,name:"--",index:p},G={key:p,name:"--",regions:[J],regionByIndex:new Map([[p,J]])},A={key:p,name:"Autoselect",index:p},U={key:p,name:"Autoselect",regions:[A],regionByIndex:new Map([[p,A]])},Y={countryCode:"00",depth:1,device:0,key:L,index:L,lang:"ru",name:"Without region"},se=()=>(A.name=x.useI18n().Common.Autoselect,A),ce=()=>(se(),U.name=x.useI18n().Common.Autoselect,console.log(U),U),ge=()=>(Y.name=x.useI18n().Keywords.Without_region,Y),z=(n=!1,l=!1,r=[])=>{let t;return n?t=me(r):t=W(r),l&&t.set(p,ce()),t.size||t.set(p,G),t},W=(n,l=!0,r=[],t=!1)=>{const d=new Map;return n.forEach(o=>{if(!o.enabled||t&&typeof o.key=="number"&&o.key>1)return;const a={...o};a.regionByIndex=new Map,o.regions&&o.regions.forEach(s=>{if(l&&!s.enabled)return;const v={...s};a.regionByIndex.set(v.index,v)}),!a.regionByIndex.size&&r.length,(!o.regions||a.regionByIndex.size||r.length)&&typeof a.key=="number"&&d.set(a.key,a)}),r.forEach(o=>{if(d.has(o))return;const a={key:o,name:ue[o],regions:[],regionByIndex:new Map};d.set(a.key,a)}),d},me=n=>{const l=W(n,!1,[0,1],!0);if(l.has(2)){const r=l.get(2);r&&(r.regionByIndex=new Map)}return l.forEach(r=>{if(!r.regionByIndex)return;const t={...ge()};r.regionByIndex.set(t.index,t)}),l},H=(n,l,r=[])=>{const t=z(n,!1,r);let d;return t.forEach(o=>{if(!(l.searcher_key!==void 0&&l.searcher_key!=o.key)&&o.regions&&(o.regions.forEach(a=>{if(!d&&!(l.key!==void 0&&l.key!=a.key)&&!(l.index!==void 0&&l.index!=a.index)&&!(!n&&(l.lang!==void 0&&l.lang!=a.lang||l.device!==void 0&&l.device!=a.device)))return a.searcher_key=o.key,d=a,!1}),d))return!1}),d},Q=le.useAsyncTopDialog(()=>new Promise((n,l)=>ne(["../.chunks/dialog_selectorRegions-pDIYvl7b.amd"],n,l))),fe=(n,l)=>{const r=x.useI18n(),t=e.ref(l.value.keys().next().value??p),d=e.computed(()=>{const o=new Map;if(l.value.forEach(a=>{let s={value:a.key,title:a.name};n.addSearcherIcon&&(s.icon=P.getSearcherGIcon(a.key)),o.set(a.key,s)}),n.addCompare&&!o.has(p)){const a={value:"",title:"--------------------",disabled:!0};o.set(a.value,a);const s={value:w,title:r.Common.Compare};o.set(s.value,s)}return o});return{searcherKey:t,optionBySearcherKey:d}},ve=(n,l)=>{var o,a,s;const r=x.useI18n(),t=e.ref(p);n.modelValue.length===1&&(t.value=n.modelValue[0]),t.value===p&&(n.forFrequency?t.value=((a=(o=l.value)==null?void 0:o.regionByIndex.values().next().value)==null?void 0:a.key)??p:t.value=((s=l.value)==null?void 0:s.regionByIndex.keys().next().value)??p);const d=e.computed(()=>{var h;const v=new Map;return(h=l.value.regionByIndex)==null||h.forEach(S=>{let i=S.name;if(n.forFrequency){const I={value:S.key,title:i};v.has(S.key)||v.set(S.key,I);return}S.device&&(i+=" ("+r.Common["Device_"+S.device]+")");const m=P.getLangLabel(l.value.key||0,S.lang??"");m&&(i+=" / "+m);const c={value:S.index,title:i,icon:S.device?P.getDeviceGIcon(S.device):void 0};v.set(S.index,c)}),v});return e.watch(d,(v,h)=>{var c;if(n.onlySearcher||t.value!==void 0&&v.get(t.value))return;let S=v.keys().next().value;if(t.value===p||S===p){t.value=S;return}let i=((c=h==null?void 0:h.get(t.value))==null?void 0:c.title)||"",m=-1;for(const[I,B]of v.entries()){const C=B.title;if(typeof C!="string"||typeof I=="string")break;if(C===i){S=I;break}const V=new RegExp(` \\((${r.Common.Device_1}|${r.Common.Device_2})\\)`);let f=i,u=3;C.indexOf(f)===-1&&(f=i.replace(/^[^a-zа-я]/i,"").replace(V,""),u--),C.indexOf(f)===-1&&(f=i.replace(/ \/.*/,""),u--),C.indexOf(f)===-1&&(f=i.replace(/ \/.*/,""),f=f.replace(/^[^a-zа-я]/i,"").replace(V,""),u--),C.indexOf(f)!==-1&&(u<=m||(m=u,S=I))}t.value=S}),{regionIndex:t,optionByRegionIndex:d}},ye=(n,l,r)=>{const t=e.ref([]),d=()=>{if(n.onlySearcher&&l.value){t.value=Array.from(l.value.keys());return}let a=[];if(n.modelValue.length>1)a=[...n.modelValue];else try{a=JSON.parse(localStorage.getItem("ui:project:regionSelector"+n.projectId+":regionsIndexes"))??[]}catch{}a.length&&(a=a.filter(s=>r.value.has(s))),a.length||(a=Array.from(r.value)),t.value=[...a]},o=()=>{t.value.length?localStorage.setItem("ui:project:regionSelector:"+n.projectId+":regionsIndexes",JSON.stringify(t.value)):localStorage.removeItem("ui:project:regionSelector:"+n.projectId+":regionsIndexes")};return e.watch(t,()=>{o()}),n.addCompare&&d(),{regionsIndexes:t}},pe=n=>{const l=e.computed(()=>z(n.forFrequency,n.autoRegion,n.searchers)),r=e.computed(()=>l.value.get(d.searcherKey.value)||G),t=e.computed(()=>{const i=new Set;return l.value.forEach(m=>{m.regionByIndex.forEach(c=>{c.index!==L&&c.index!==p&&i.add(c.index)})}),i}),d=fe(n,l),o=ve(n,r),a=ye(n,l,t);e.watch(l,()=>{var m,c,I,B;if(n.onlySearcher?a.regionsIndexes.value=Array.from(l.value.keys()):a.regionsIndexes.value=a.regionsIndexes.value.filter(C=>t.value.has(C)),d.searcherKey.value===w)return;let i=l.value.keys().next().value;l.value.forEach(C=>{var V,f,u;if(n.onlySearcher&&C.key===d.searcherKey.value){i=d.searcherKey.value;return}if(o.regionIndex.value&&((V=C.regionByIndex)!=null&&V.has(o.regionIndex.value))&&(i=C.key),!n.onlySearcher){let g;i!==void 0&&(g=(f=l.value.get(i))==null?void 0:f.regionByIndex);const y=(u=l.value.get(C.key))==null?void 0:u.regionByIndex;g!=null&&g.has(p)&&!(y!=null&&y.has(p))&&(i=C.key)}}),i!==void 0&&(d.searcherKey.value=i),o.regionIndex.value!==void 0&&!((c=(m=r.value)==null?void 0:m.regionByIndex)!=null&&c.has(o.regionIndex.value))&&(o.regionIndex.value=(B=(I=r.value)==null?void 0:I.regions)==null?void 0:B.keys().next().value)},{immediate:!0});const s=()=>{if(!(d.searcherKey.value===w||d.searcherKey.value===p))return d.searcherKey.value},v=()=>{if(n.onlySearcher||o.regionIndex.value===p)return;let i=o.regionIndex.value;if(n.forFrequency){const m=o.regionIndex.value,c=H(n.forFrequency,{searcher_key:s(),key:m},n.searchers);i=c==null?void 0:c.index}return i},h=()=>{const i=s();if(i!==void 0)return l.value.get(i)};return{selectSearcher:d,selectRegion:o,compare:a,searcherByKey:l,allRegionsIndexes:t,getSearcher:h,getRegion:()=>{var m,c;const i=v();if(i!==void 0)return(c=(m=h())==null?void 0:m.regionByIndex)==null?void 0:c.get(i)}}},he=e.defineComponent({__name:"selectorRegion",props:e.mergeModels({projectId:{},searchers:{default:()=>[]},modelValue:{},modelValueSingle:{},addCompare:{type:Boolean},forFrequency:{type:Boolean},autoRegion:{type:Boolean},onlySearcher:{type:Boolean},addChanger:{type:Boolean,default:!0},addSearcherIcon:{type:Boolean,default:!0},addRegionIcon:{type:Boolean,default:!0}},{modelValue:{required:!0},modelModifiers:{},modelValueSingle:{},modelValueSingleModifiers:{}}),emits:["update:modelValue","update:modelValueSingle"],setup(n,{expose:l}){const r=n,t=e.useModel(n,"modelValue"),d=e.useModel(n,"modelValueSingle"),{selectSearcher:o,selectRegion:a,compare:s,searcherByKey:v,allRegionsIndexes:h,getSearcher:S,getRegion:i}=pe(r),m=()=>{const c=[];v.value.forEach(I=>{I.enabled&&I.regions.forEach(B=>{B.enabled&&c.push(B)})}),Q.open("selectorRegions",{regions:c,regionsIndexes:s.regionsIndexes.value,"@update:regionsIndexes":I=>s.regionsIndexes.value=I})};return e.watch([a.regionIndex,o.searcherKey,s.regionsIndexes],()=>{if(o.searcherKey.value===w&&s.regionsIndexes.value.length){if(JSON.stringify(t.value)===JSON.stringify(s.regionsIndexes.value))return;t.value=[...s.regionsIndexes.value]}else r.onlySearcher?(t.value=[o.searcherKey.value],o.searcherKey.value===p&&!r.autoRegion&&(t.value.length=0)):(t.value=[a.regionIndex.value],a.regionIndex.value===p&&!r.autoRegion&&(t.value.length=0));!r.onlySearcher&&!h.value.size&&(o.searcherKey.value=p)}),d.value&&e.watch(d,()=>{d.value&&(t.value=[d.value])},{immediate:!0}),e.watch(t,()=>{var c,I,B,C,V;if(t.value[0]&&(d.value=t.value[0]),r.onlySearcher){if(!t.value.length||t.value.length===1&&!v.value.has(t.value[0])||t.value.length===1&&t.value[0]===p&&!r.autoRegion){let f=v.value.keys().next().value;f===p&&!r.autoRegion&&(f=void 0,d.value=p),f!==void 0?t.value=[f]:t.value.length=0;return}if(t.value.length>1&&JSON.stringify(t.value)!==JSON.stringify(s.regionsIndexes.value)){t.value=[...s.regionsIndexes.value];return}}else{let f=[...new Set(t.value)],u=(I=(c=v.value.values().next().value)==null?void 0:c.regionByIndex)==null?void 0:I.keys().next().value;if(r.forFrequency&&(u=(V=(C=(B=v.value.values().next().value)==null?void 0:B.regionByIndex)==null?void 0:C.values().next().value)==null?void 0:V.key),u===p&&!r.autoRegion&&(u=void 0,d.value=p),!f.length)u!==void 0&&f.push(u);else if(f.length===1){let g=h.value;r.forFrequency&&(g=new Set,v.value.forEach(y=>{y.regionByIndex.forEach(k=>{k.index!==L&&k.index!==p&&g.add(k.key)})})),g.has(f[0])||(f=[],u!==void 0&&f.push(u))}else f=f.filter(g=>h.value.has(g)),!f.length&&u!==void 0&&f.push(u);if(JSON.stringify(t.value)!==JSON.stringify(f)){t.value=f;return}}if(!(t.value.length===1&&t.value[0]===(r.onlySearcher?o.searcherKey.value:a.regionIndex.value)))if(r.onlySearcher){if(t.value.length===1){o.searcherKey.value=t.value[0];return}o.searcherKey.value=w;return}else{if(!t.value.length)return;if(t.value.length===1&&o.searcherKey.value!==w){a.regionIndex.value=t.value[0];let f;for(const u of v.value.values()){for(const g of u.regionByIndex.values())if((r.forFrequency?g.key:g.index)===a.regionIndex.value){f=u.key;break}if(f!==void 0)break}f!==void 0&&(o.searcherKey.value=f)}else o.searcherKey.value=w,s.regionsIndexes.value=[...t.value]}},{immediate:!0}),l({getSearcher:S,getRegion:i}),(c,I)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"top-selectorRegion":!0,"top-selectorRegion-onlySearcher":c.onlySearcher})},[e.createVNode(x._sfc_main$4,{options:e.unref(o).optionBySearcherKey.value,modelValue:e.unref(o).searcherKey.value,"onUpdate:modelValue":I[0]||(I[0]=B=>e.unref(o).searcherKey.value=B),name:"searcher_key",addChanger:c.addChanger},null,8,["options","modelValue","addChanger"]),!c.onlySearcher&&e.unref(o).searcherKey.value!==e.unref(w)?(e.openBlock(),e.createBlock(x._sfc_main$4,{key:0,class:"top-select-region",options:e.unref(a).optionByRegionIndex.value,modelValue:e.unref(a).regionIndex.value,"onUpdate:modelValue":I[1]||(I[1]=B=>e.unref(a).regionIndex.value=B),name:c.forFrequency?"region_key":"region_index",addChanger:c.addChanger,"data-top-icon":c.addRegionIcon?"":void 0},null,8,["options","modelValue","name","addChanger","data-top-icon"])):e.createCommentVNode("",!0),c.addCompare&&!c.onlySearcher&&e.unref(o).searcherKey.value===e.unref(w)?(e.openBlock(),e.createBlock(x._sfc_main,{key:1,name:"compare",onClick:m,"data-count-compare-regions-indexes":e.unref(s).regionsIndexes.value.length},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.$i18n.Common.Selected_regions),1)]),_:1},8,["data-count-compare-regions-indexes"])):e.createCommentVNode("",!0)],2))}}),Se=[{id:"1",name:"Without Tag",color_id:"1"},{id:"2",name:"Red",color_id:"2"},{id:"3",name:"Orange",color_id:"3"},{id:"4",name:"Yellow",color_id:"4"},{id:"5",name:"Blue",color_id:"5"},{id:"6",name:"Purple",color_id:"6"},{id:"7",name:"Green",color_id:"7"},{id:"8",name:"Magenta",color_id:"8"},{id:"9",name:"Dark blue",color_id:"9"},{id:"10",name:"Turquoise",color_id:"10"}],X=n=>"-"+n,K=n=>n[0]==="-"?n.substring(1):n,O=(n,l)=>{n=K(n);const r=l.find(t=>t.id===n);if(r)return r},ke=["data-tag_id","data-tag_color_id","title"],D=e.defineComponent({__name:"tagIcon",props:{id:{},colorId:{},name:{},state:{}},setup(n){return(l,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"top-tagSelector_tagIcon":!0,"top-tagSelector-active":!!l.state,"top-tagSelector-excluded":l.state==="excluded"}),"data-tag_id":l.id,"data-tag_color_id":l.colorId,title:l.name},null,10,ke))}}),Ie=["contenteditable","onKeydown"],Z=e.defineComponent({__name:"tagPopupListItem",props:e.mergeModels({editable:{type:Boolean},disabled:{type:Boolean},canExclude:{type:Boolean},id:{},colorId:{},name:{},state:{}},{name:{required:!0},nameModifiers:{}}),emits:e.mergeModels(["update:name","unselect","exclude","select"],["update:name"]),setup(n,{emit:l}){const r=n,t=l,d=e.useModel(n,"name"),o=e.ref(null),a=e.computed(()=>navigator.userAgent.indexOf("Firefox")!=-1?{contenteditable:s.value,onpaste:m=>m.preventDefault()}:{}),s=e.ref(!1),v=async()=>{var m;s.value=!0,await e.nextTick(),(m=o.value)==null||m.focus()},h=()=>{var c;const m=(c=o.value)==null?void 0:c.innerText;if(!m)return S();o.value&&(o.value.innerText=m),s.value=!1,t("update:name",m)},S=async()=>{o.value&&(o.value.innerText=r.name),s.value=!1},i=m=>{if(s.value||r.disabled)return;let c="selected";r.canExclude&&(m.ctrlKey||m.metaKey)&&(c="excluded"),r.state==c&&(c=""),c===""&&t("unselect"),c==="selected"&&t("select"),c==="excluded"&&t("exclude")};return(m,c)=>(e.openBlock(),e.createBlock(E._sfc_main$1,{class:e.normalizeClass({"top-tagSelector_tagListItem":!0,"top-tagSelector_tagListItem-inEdit":s.value,"top-tagSelector_tagListItem-disabled":m.disabled,"top-tagSelector_tagListItem-canExclude":m.canExclude,"top-tagSelector-active":!!m.state,"top-tagSelector-excluded":m.state==="excluded"}),onClick:e.withModifiers(i,["stop"])},{default:e.withCtx(()=>[e.createVNode(D,{id:m.id,name:d.value,colorId:m.colorId,state:m.state},null,8,["id","name","colorId","state"]),e.createElementVNode("span",e.mergeProps({ref_key:"elName",ref:o,class:"top-tagSelector_tagListItemName",contenteditable:s.value?"plaintext-only":!1},a.value,{onKeydown:[e.withKeys(e.withModifiers(h,["stop"]),["enter"]),e.withKeys(e.withModifiers(S,["stop"]),["esc"])]}),e.toDisplayString(d.value),17,Ie),m.editable?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[s.value?(e.openBlock(),e.createElementBlock("span",{key:1,"data-top-icon":"",class:"top-tagSelector_edit",onClick:e.withModifiers(h,["stop"])})):(e.openBlock(),e.createElementBlock("span",{key:0,"data-top-icon":"",class:"top-tagSelector_edit",onClick:v}))],64)):e.createCommentVNode("",!0)]),_:1},8,["class"]))}}),xe={key:1},ee=e.defineComponent({inheritAttrs:!1,__name:"popupOpener",props:e.mergeModels({modelValue:{},id:{},tags:{},mode:{},targetId:{},filters:{},useTopButton:{type:Boolean},payload:{},styling:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const l=n,r=e.useModel(n,"modelValue"),t=l.useTopButton?x._sfc_main:"div",d=l.useTopButton?"html":"default",o={model:r,mode:l.mode,targetId:l.targetId,filters:l.filters,payload:l.payload};return(a,s)=>{const v=e.resolveDirective("top-data");return e.openBlock(),e.createBlock(E._sfc_main$2,{id:a.id},{default:e.withCtx(()=>[e.withDirectives((e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(t)),e.mergeProps({class:{"top-tagSelector":!0,"top-tagSelector-filter":l.mode==="filter","top-tagSelector-setter_single":l.mode==="setter"&&!a.filters,"top-tagSelector-setter_several":l.mode==="setter"&&a.filters,"top-tagSelector-selectedOne":!r.value.length||r.value.length===1,"top-tagSelector-toTwoLine":r.value.length>5},color:"theme",styling:a.styling},a.$attrs),{[e.unref(d)]:e.withCtx(()=>[!r.value.length&&a.mode==="filter"?(e.openBlock(),e.createBlock(D,{key:0,id:"all",colorId:"",name:a.$i18n.Common.All_tags??"",state:""},null,8,["name"])):e.createCommentVNode("",!0),a.mode==="setter"&&a.filters?(e.openBlock(),e.createElementBlock("div",xe,[e.renderSlot(a.$slots,"default")])):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:2},e.renderList(r.value,h=>{var S,i;return e.openBlock(),e.createBlock(D,{id:e.unref(K)(h),colorId:((S=e.unref(O)(h,a.tags))==null?void 0:S.color_id)??"",name:((i=e.unref(O)(h,a.tags))==null?void 0:i.name)??"",state:e.unref(K)(h)===h?"selected":"excluded"},null,8,["id","colorId","name","state"])}),256))]),_:2},1040,["class","styling"])),[[v,o,"topTagSelectorTarget"]])]),_:3},8,["id"])}}}),Ce=e.defineComponent({__name:"tagSelector",props:e.mergeModels({modelValue:{},tags:{},tagsEditable:{type:Boolean},tagsMax:{default:10},id:{},singleMode:{type:Boolean},requiredForSetter:{type:Boolean,default:!0},maxTagsForSetter:{},emitDelay:{default:500},styling:{}},{modelValue:{required:!0},modelModifiers:{},tags:{default:e.reactive(Se)},tagsModifiers:{}}),emits:e.mergeModels(["selector","setter","tagsChanged"],["update:modelValue","update:tags"]),setup(n,{emit:l}){const r=x.useI18n(),t=n,d=e.useModel(n,"modelValue"),o=e.useModel(n,"tags"),a=l,s=x.debounce((u,g)=>{a(u,g)},t.emitDelay);t.singleMode&&!d.value.length&&(d.value=[o.value[0].id]);const v=t.id??"top-popup-id-"+Math.random(),h=e.ref("add"),S=()=>{var y;const u=" "+((y=r.Common.Tags)==null?void 0:y.toLowerCase()),g=new Map;return g.set("add",{value:"add",title:r.Common.Add+u}),g.set("replace",{value:"replace",title:r.Common.Replace+u}),g.set("delete",{value:"delete",title:r.Common.Delete+u}),g};let i=e.shallowRef({model:d,mode:"filter",targetId:void 0,filters:void 0,payload:void 0});e.watch(d,()=>{s("selector",d.value)});const m=e.computed(()=>{if(i.value.mode==="setter"&&t.maxTagsForSetter&&!i.value.filters)return i.value.model.value.length>=t.maxTagsForSetter}),c=u=>{if(u!=="all"){if(i.value.model.value.includes(u))return"selected";if(i.value.model.value.includes(X(u)))return"excluded"}return u==="all"&&!i.value.model.value.length?"selected":""},I=(u,g)=>{const y=X(u);let k=i.value.model.value.filter(M=>M!==u&&M!==y);g==="select"&&k.push(u),g==="exclude"&&k.push(y),i.value.mode==="setter"&&i.value.targetId!==void 0&&t.requiredForSetter&&(k.length||k.push("1"),k.length===2&&i.value.model.value.length===1&&i.value.model.value[0]==="1"&&(k=k.filter(M=>M!=="1"))),t.singleMode&&!i.value.filters&&(k.length||(k=i.value.model.value),k.length>1&&(k=[k[k.length-1]])),k.sort((M,N)=>{if(!t.tags)return 0;const q=t.tags.findIndex(b=>b.id===M),R=t.tags.findIndex(b=>b.id===N);return q-R}),i.value.model.value=k,i.value.mode==="setter"&&i.value.targetId!==void 0&&s("setter",{tagsIds:k,targetId:i.value.targetId,payload:i.value.payload})},B=e.computed(()=>{let u="top-tagSelector_popup";return i.value.mode==="filter"&&(u+=" top-tagSelector_popup-filter"),i.value.mode==="setter"&&(u+=" top-tagSelector_popup-setter"),u}),C=()=>{const u=prompt("","New tag");if(!u||u==="New tag")return;const g=o.value.length+1;o.value.push({id:String(g),name:u,color_id:String((g-1)%10+1)}),a("tagsChanged",o.value)},V=u=>{var g;if(i.value=_.storage(u.elPopupOpener,"topTagSelectorTarget"),!i.value)throw new Error("Open popup TopTagSelector required v-data:topTagSelectorTarget");if(i.value.filters&&(h.value="add",i.value.model.value=[]),!((g=x.Core.$)!=null&&g.ui.sortable)){console.info("Для работы сортировки требуется глобальная загрузка jQuery UI Sortable");return}!x.Core.state.isMobile&&!x.Core.state.isMobileUA&&o.value&&$(u.elPopup).sortable({items:'li:has([data-tag_id]:not([data-tag_id="all"]))',cancel:'[contenteditable="plaintext-only"], [contenteditable="true"]',distance:10,stop:function(y,k){if(!o.value)return;const M=$(k.item).parent().find("[data-tag_id]"),N=[];M.each((q,R)=>{if(!o.value)return;const b=$(R).attr("data-tag_id");N.push(b)}),o.value.sort((q,R)=>{const b=N.findIndex(j=>j===q.id),Ke=N.findIndex(j=>j===R.id);return b-Ke}),s("tagsChanged",o.value)}})},f=u=>{var g;(g=x.Core.$)!=null&&g.ui.sortable&&$(u.elPopup).data("ui-sortable")&&$(u.elPopup).sortable("destroy")};return(u,g)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(ee,{class:"top-select_arrow",modelValue:d.value,"onUpdate:modelValue":g[0]||(g[0]=y=>d.value=y),id:e.unref(v),tags:o.value,styling:u.styling,mode:"filter",useTopButton:""},null,8,["modelValue","id","tags","styling"]),e.createVNode(E._sfc_main,{id:e.unref(v),class:e.normalizeClass(B.value),onOpen:g[4]||(g[4]=y=>V(y)),onClose:g[5]||(g[5]=y=>f(y)),"transition-duration":50},e.createSlots({contentList:e.withCtx(()=>[e.unref(i).mode==="filter"&&!u.singleMode?(e.openBlock(),e.createBlock(Z,{key:0,id:"all",colorId:"",name:u.$i18n.Common.All_tags??"",state:e.unref(i).model.value.length?"":"selected",onSelect:g[3]||(g[3]=y=>e.unref(i).model.value=[])},null,8,["name","state"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,y=>(e.openBlock(),e.createBlock(Z,{key:y.id,id:y.id,colorId:y.color_id,name:y.name,state:c(y.id),canExclude:e.unref(i).mode==="filter"&&!u.singleMode,editable:u.tagsEditable,disabled:m.value&&c(y.id)==="",onUnselect:k=>I(y.id,"unselect"),onSelect:k=>I(y.id,"select"),onExclude:k=>I(y.id,"exclude"),"onUpdate:name":k=>{y.name=k,e.unref(s)("tagsChanged",o.value)}},null,8,["id","colorId","name","state","canExclude","editable","disabled","onUnselect","onSelect","onExclude","onUpdate:name"]))),128)),u.tagsEditable&&o.value.length<u.tagsMax&&o.value.length<20?(e.openBlock(),e.createBlock(E._sfc_main$1,{key:1,"data-top-icon":"",onClick:e.withModifiers(C,["stop"])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.$i18n.Common.Add),1)]),_:1})):e.createCommentVNode("",!0)]),_:2},[e.unref(i).mode==="setter"&&e.unref(i).filters?{name:"header",fn:e.withCtx(()=>[e.createVNode(x._sfc_main$4,{modelValue:h.value,"onUpdate:modelValue":g[1]||(g[1]=y=>h.value=y),options:S()},null,8,["modelValue","options"])]),key:"0"}:void 0,e.unref(i).mode==="setter"&&e.unref(i).filters?{name:"footer",fn:e.withCtx(()=>[e.createVNode(x._sfc_main,{color:"theme"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.$i18n.Common.Cancel),1)]),_:1}),e.createVNode(x._sfc_main,{onClick:g[2]||(g[2]=y=>e.unref(s)("setter",{tagsIds:e.unref(i).model.value,filters:e.unref(i).filters,filtersAction:h.value,payload:e.unref(i).payload}))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(h.value==="add"?u.$i18n.Common.Add:"")+" "+e.toDisplayString(h.value==="replace"?u.$i18n.Common.Replace:"")+" "+e.toDisplayString(h.value==="delete"?u.$i18n.Common.Remove:""),1)]),_:1})]),key:"1"}:void 0]),1032,["id","class"])],64))}}),Be=(n,l)=>e.computed(()=>e.toValue(n).filter(d=>d.on>=0||d.id===l).map(d=>({value:d.id,title:d.url+` [${d.id}]`,icon:d.id===e.toValue(l)?"":"",content:d.name}))),Te=(n,l,r)=>{l||(l={id:n.id}),l.id=n.id;const t=ae.TopPopupWorker.genElPopupOpener("div",l);return t.classList.add("top-tagSelector"),n.useTopButton&&t.classList.add("top-button","top-color_theme"),n.mode==="filter"&&t.classList.add("top-tagSelector-filter"),n.mode==="setter"&&!n.filters&&t.classList.add("top-tagSelector-setter_single"),n.mode==="setter"&&n.filters&&t.classList.add("top-tagSelector-setter_several"),t.onclick=d=>{d.preventDefault(),d.stopPropagation(),t.onclick=null;const o=e.ref(n.modelValue),a={model:o,mode:n.mode,targetId:n.targetId,filters:n.filters,payload:n.payload};_.storage(t,"topTagSelectorTarget",a),delete t.dataset.topPopupDisabled,e.isRef(n.modelValue)||e.watch(o,()=>{n.modelValue=o.value,F(t,n,r)}),t.click()},e.isRef(n.modelValue)?e.watch(n.modelValue,()=>F(t,n,r)):_.storage(t,"topTagSelectorRender",d=>{n.modelValue=d;const o=_.storage(t,"topTagSelectorTarget");o&&(o.model.value=d),F(t,n,r)}),F(t,n,r),t},Ve=(n,l)=>{var r;(r=_.storage(n,"topTagSelectorRender"))==null||r(l)},F=(n,l,r)=>{var d;const t=e.unref(l.modelValue);if(n.classList.toggle("top-tagSelector-selectedOne",!t.length||t.length===1),n.classList.toggle("top-tagSelector-toTwoLine",t.length>5),l.mode==="setter"&&l.filters){n.innerHTML=`<div>${r}</div>`;return}if(n.innerHTML="",!t.length&&l.mode==="filter"){const o=te({id:"all",colorId:"",name:((d=x.useI18n().Common)==null?void 0:d.All_tags)??"",state:""});n.append(o)}t.forEach(o=>{var s,v;const a=te({id:K(o),colorId:((s=O(o,l.tags))==null?void 0:s.color_id)??"",name:((v=O(o,l.tags))==null?void 0:v.name)??"",state:K(o)===o?"selected":"excluded"});n.append(a)})},te=n=>{const l=document.createElement("div");return l.classList.add("top-tagSelector_tagIcon"),l.classList.toggle("top-tagSelector-active",!!n.state),l.classList.toggle("top-tagSelector-excluded",n.state==="excluded"),l.dataset.tag_id=n.id,l.dataset.tag_color_id=n.colorId,l.title=n.name,l},we=de,Me=he,be=Ce,Ee=ee,_e=D;T.TopSelectorCompetitors=we,T.TopSelectorRegion=Me,T.TopTagSelector=be,T.TopTagSelectorPopupOpener=Ee,T.TopTagSelectorTagIcon=_e,T.dialogSelectorRegions=Q,T.findRegion=H,T.genElTopTagSelectorPopupOpener=Te,T.genSearcherByKey=z,T.renderElTopTagSelectorPopupOpener=Ve,T.useItemsFromCompetitors=Be,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
define(["require","exports","vue","../.chunks/forms-BduN5hFf.amd","../.chunks/listItem.vue_vue_type_script_setup_true_lang-C660hIcG.amd","../.chunks/menu.vue_vue_type_style_index_0_lang-C9cIXmj2.amd","../.chunks/utils-BgjhCn4H.amd","../utils/searchers.amd","../utils/dom.amd","../popup/worker.amd","../require/css.amd!../assets/project.css"],function(ne,T,e,x,E,oe,le,P,_,ae){"use strict";if(typeof e>"u")var e=window.Vue;const re={class:"top-selectorCompetitors"},ie={class:"top-ellipsis1"},de=e.defineComponent({__name:"selectorCompetitors",props:e.mergeModels({modelValue:{},items:{},showSelectAllItem:{type:Boolean,default:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const l=n,r=e.useModel(n,"modelValue"),t=e.computed(()=>{if(l.showSelectAllItem)return{icon:"",title:x.useI18n().Common.Select_all,value:"all",content:""}});return(d,o)=>(e.openBlock(),e.createElementBlock("div",re,[e.unref(x.Core).state.isMobile?(e.openBlock(),e.createBlock(E._sfc_main,{key:0},{opener:e.withCtx(()=>[e.createVNode(x._sfc_main,{class:"top-selectorCompetitors_opener",color:"theme",icon:"",icon2:""},{default:e.withCtx(()=>{var a;return[e.createTextVNode(e.toDisplayString((a=d.items.find(u=>{var v;return u.value===((v=r.value)==null?void 0:v[0])}))==null?void 0:a.content),1)]}),_:1})]),contentList:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.items,a=>{var u;return e.openBlock(),e.createBlock(E._sfc_main$1,{class:e.normalizeClass({"top-active":(u=r.value)==null?void 0:u.includes(a.value)}),"data-top-icon":a.icon,title:a.title,onClick:()=>r.value=[a.value]},{default:e.withCtx(()=>[e.createElementVNode("span",ie,e.toDisplayString(a.content),1)]),_:2},1032,["class","data-top-icon","title","onClick"])}),256))]),_:1})):(e.openBlock(),e.createBlock(oe._sfc_main,{key:1,modelValue:r.value,"onUpdate:modelValue":o[0]||(o[0]=a=>r.value=a),items:d.items,isMultiple:!0,styling:"bar",canBeEmptyMultiple:!1,selectAllItem:t.value},null,8,["modelValue","items","selectAllItem"]))]))}}),w=-1,p=-2,L=-1,se={0:"Yandex",1:"Google",4:"YouTube",5:"Bing",7:"Seznam",8:"AppStore",9:"GoogleStore",20:"Yandex.com",21:"Yandex.com.tr"},J={key:p,name:"--",index:p},G={key:p,name:"--",regions:[J],regionByIndex:new Map([[p,J]])},A={key:p,name:"Autoselect",index:p},U={key:p,name:"Autoselect",regions:[A],regionByIndex:new Map([[p,A]])},Y={countryCode:"00",depth:1,device:0,key:L,index:L,lang:"ru",name:"Without region"},ue=()=>(A.name=x.useI18n().Common.Autoselect,A),ce=()=>(ue(),U.name=x.useI18n().Common.Autoselect,console.log(U),U),ge=()=>(Y.name=x.useI18n().Keywords.Without_region,Y),z=(n=!1,l=!1,r=[])=>{let t;return n?t=me(r):t=W(r),l&&t.set(p,ce()),t.size||t.set(p,G),t},W=(n,l=!0,r=[],t=!1)=>{const d=new Map;return n.forEach(o=>{if(!o.enabled||t&&typeof o.key=="number"&&o.key>1)return;const a={...o};a.regionByIndex=new Map,o.regions&&o.regions.forEach(u=>{if(l&&!u.enabled)return;const v={...u};a.regionByIndex.set(v.index,v)}),!a.regionByIndex.size&&r.length,(!o.regions||a.regionByIndex.size||r.length)&&typeof a.key=="number"&&d.set(a.key,a)}),r.forEach(o=>{if(d.has(o))return;const a={key:o,name:se[o],regions:[],regionByIndex:new Map};d.set(a.key,a)}),d},me=n=>{const l=W(n,!1,[0,1],!0);if(l.has(2)){const r=l.get(2);r&&(r.regionByIndex=new Map)}return l.forEach(r=>{if(!r.regionByIndex)return;const t={...ge()};r.regionByIndex.set(t.index,t)}),l},H=(n,l,r=[])=>{const t=z(n,!1,r);let d;return t.forEach(o=>{if(!(l.searcher_key!==void 0&&l.searcher_key!=o.key)&&o.regions&&(o.regions.forEach(a=>{if(!d&&!(l.key!==void 0&&l.key!=a.key)&&!(l.index!==void 0&&l.index!=a.index)&&!(!n&&(l.lang!==void 0&&l.lang!=a.lang||l.device!==void 0&&l.device!=a.device)))return a.searcher_key=o.key,d=a,!1}),d))return!1}),d},Q=le.useAsyncTopDialog(()=>new Promise((n,l)=>ne(["../.chunks/dialog_selectorRegions-B7ylHRje.amd"],n,l))),fe=(n,l)=>{const r=x.useI18n(),t=e.ref(l.value.keys().next().value??p),d=e.computed(()=>{const o=new Map;if(l.value.forEach(a=>{let u={value:a.key,title:a.name};n.addSearcherIcon&&(u.icon=P.getSearcherGIcon(a.key)),o.set(a.key,u)}),n.addCompare&&!o.has(p)){const a={value:"",title:"--------------------",disabled:!0};o.set(a.value,a);const u={value:w,title:r.Common.Compare};o.set(u.value,u)}return o});return{searcherKey:t,optionBySearcherKey:d}},ve=(n,l)=>{var o,a,u;const r=x.useI18n(),t=e.ref(p);n.modelValue.length===1&&(t.value=n.modelValue[0]),t.value===p&&(n.forFrequency?t.value=((a=(o=l.value)==null?void 0:o.regionByIndex.values().next().value)==null?void 0:a.key)??p:t.value=((u=l.value)==null?void 0:u.regionByIndex.keys().next().value)??p);const d=e.computed(()=>{var h;const v=new Map;return(h=l.value.regionByIndex)==null||h.forEach(S=>{let i=S.name;if(n.forFrequency){const I={value:S.key,title:i};v.has(S.key)||v.set(S.key,I);return}S.device&&(i+=" ("+r.Common["Device_"+S.device]+")");const m=P.getLangLabel(l.value.key||0,S.lang??"");m&&(i+=" / "+m);const c={value:S.index,title:i,icon:S.device?P.getDeviceGIcon(S.device):void 0};v.set(S.index,c)}),v});return e.watch(d,(v,h)=>{var c;if(n.onlySearcher||t.value!==void 0&&v.get(t.value))return;let S=v.keys().next().value;if(t.value===p||S===p){t.value=S;return}let i=((c=h==null?void 0:h.get(t.value))==null?void 0:c.title)||"",m=-1;for(const[I,B]of v.entries()){const C=B.title;if(typeof C!="string"||typeof I=="string")break;if(C===i){S=I;break}const V=new RegExp(` \\((${r.Common.Device_1}|${r.Common.Device_2})\\)`);let f=i,s=3;C.indexOf(f)===-1&&(f=i.replace(/^[^a-zа-я]/i,"").replace(V,""),s--),C.indexOf(f)===-1&&(f=i.replace(/ \/.*/,""),s--),C.indexOf(f)===-1&&(f=i.replace(/ \/.*/,""),f=f.replace(/^[^a-zа-я]/i,"").replace(V,""),s--),C.indexOf(f)!==-1&&(s<=m||(m=s,S=I))}t.value=S}),{regionIndex:t,optionByRegionIndex:d}},ye=(n,l,r)=>{const t=e.ref([]),d=()=>{if(n.onlySearcher&&l.value){t.value=Array.from(l.value.keys());return}let a=[];if(n.modelValue.length>1)a=[...n.modelValue];else try{a=JSON.parse(localStorage.getItem("ui:project:regionSelector"+n.projectId+":regionsIndexes"))??[]}catch{}a.length&&(a=a.filter(u=>r.value.has(u))),a.length||(a=Array.from(r.value)),t.value=[...a]},o=()=>{t.value.length?localStorage.setItem("ui:project:regionSelector:"+n.projectId+":regionsIndexes",JSON.stringify(t.value)):localStorage.removeItem("ui:project:regionSelector:"+n.projectId+":regionsIndexes")};return e.watch(t,()=>{o()}),n.addCompare&&d(),{regionsIndexes:t}},pe=n=>{const l=e.computed(()=>z(n.forFrequency,n.autoRegion,n.searchers)),r=e.computed(()=>l.value.get(d.searcherKey.value)||G),t=e.computed(()=>{const i=new Set;return l.value.forEach(m=>{m.regionByIndex.forEach(c=>{c.index!==L&&c.index!==p&&i.add(c.index)})}),i}),d=fe(n,l),o=ve(n,r),a=ye(n,l,t);e.watch(l,()=>{var m,c,I,B;if(n.onlySearcher?a.regionsIndexes.value=Array.from(l.value.keys()):a.regionsIndexes.value=a.regionsIndexes.value.filter(C=>t.value.has(C)),d.searcherKey.value===w)return;let i=l.value.keys().next().value;l.value.forEach(C=>{var V,f,s;if(n.onlySearcher&&C.key===d.searcherKey.value){i=d.searcherKey.value;return}if(o.regionIndex.value&&((V=C.regionByIndex)!=null&&V.has(o.regionIndex.value))&&(i=C.key),!n.onlySearcher){let g;i!==void 0&&(g=(f=l.value.get(i))==null?void 0:f.regionByIndex);const y=(s=l.value.get(C.key))==null?void 0:s.regionByIndex;g!=null&&g.has(p)&&!(y!=null&&y.has(p))&&(i=C.key)}}),i!==void 0&&(d.searcherKey.value=i),o.regionIndex.value!==void 0&&!((c=(m=r.value)==null?void 0:m.regionByIndex)!=null&&c.has(o.regionIndex.value))&&(o.regionIndex.value=(B=(I=r.value)==null?void 0:I.regions)==null?void 0:B.keys().next().value)},{immediate:!0});const u=()=>{if(!(d.searcherKey.value===w||d.searcherKey.value===p))return d.searcherKey.value},v=()=>{if(n.onlySearcher||o.regionIndex.value===p)return;let i=o.regionIndex.value;if(n.forFrequency){const m=o.regionIndex.value,c=H(n.forFrequency,{searcher_key:u(),key:m},n.searchers);i=c==null?void 0:c.index}return i},h=()=>{const i=u();if(i!==void 0)return l.value.get(i)};return{selectSearcher:d,selectRegion:o,compare:a,searcherByKey:l,allRegionsIndexes:t,getSearcher:h,getRegion:()=>{var m,c;const i=v();if(i!==void 0)return(c=(m=h())==null?void 0:m.regionByIndex)==null?void 0:c.get(i)}}},he=e.defineComponent({__name:"selectorRegion",props:e.mergeModels({projectId:{},searchers:{default:()=>[]},modelValue:{},modelValueSingle:{},addCompare:{type:Boolean},forFrequency:{type:Boolean},autoRegion:{type:Boolean},onlySearcher:{type:Boolean},addChanger:{type:Boolean,default:!0},addSearcherIcon:{type:Boolean,default:!0},addRegionIcon:{type:Boolean,default:!0}},{modelValue:{required:!0},modelModifiers:{},modelValueSingle:{},modelValueSingleModifiers:{}}),emits:["update:modelValue","update:modelValueSingle"],setup(n,{expose:l}){const r=n,t=e.useModel(n,"modelValue"),d=e.useModel(n,"modelValueSingle"),{selectSearcher:o,selectRegion:a,compare:u,searcherByKey:v,allRegionsIndexes:h,getSearcher:S,getRegion:i}=pe(r),m=()=>{const c=[];v.value.forEach(I=>{I.enabled&&I.regions.forEach(B=>{B.enabled&&c.push(B)})}),Q.open("selectorRegions",{regions:c,regionsIndexes:u.regionsIndexes.value,"@update:regionsIndexes":I=>u.regionsIndexes.value=I})};return e.watch([a.regionIndex,o.searcherKey,u.regionsIndexes],()=>{if(o.searcherKey.value===w&&u.regionsIndexes.value.length){if(JSON.stringify(t.value)===JSON.stringify(u.regionsIndexes.value))return;t.value=[...u.regionsIndexes.value]}else r.onlySearcher?(t.value=[o.searcherKey.value],o.searcherKey.value===p&&!r.autoRegion&&(t.value.length=0)):(t.value=[a.regionIndex.value],a.regionIndex.value===p&&!r.autoRegion&&(t.value.length=0));!r.onlySearcher&&!h.value.size&&(o.searcherKey.value=p)}),d.value&&e.watch(d,()=>{d.value&&(t.value=[d.value])},{immediate:!0}),e.watch(t,()=>{var c,I,B,C,V;if(t.value[0]&&(d.value=t.value[0]),r.onlySearcher){if(!t.value.length||t.value.length===1&&!v.value.has(t.value[0])||t.value.length===1&&t.value[0]===p&&!r.autoRegion){let f=v.value.keys().next().value;f===p&&!r.autoRegion&&(f=void 0,d.value=p),f!==void 0?t.value=[f]:t.value.length=0;return}if(t.value.length>1&&JSON.stringify(t.value)!==JSON.stringify(u.regionsIndexes.value)){t.value=[...u.regionsIndexes.value];return}}else{let f=[...new Set(t.value)],s=(I=(c=v.value.values().next().value)==null?void 0:c.regionByIndex)==null?void 0:I.keys().next().value;if(r.forFrequency&&(s=(V=(C=(B=v.value.values().next().value)==null?void 0:B.regionByIndex)==null?void 0:C.values().next().value)==null?void 0:V.key),s===p&&!r.autoRegion&&(s=void 0,d.value=p),!f.length)s!==void 0&&f.push(s);else if(f.length===1){let g=h.value;r.forFrequency&&(g=new Set,v.value.forEach(y=>{y.regionByIndex.forEach(k=>{k.index!==L&&k.index!==p&&g.add(k.key)})})),g.has(f[0])||(f=[],s!==void 0&&f.push(s))}else f=f.filter(g=>h.value.has(g)),!f.length&&s!==void 0&&f.push(s);if(JSON.stringify(t.value)!==JSON.stringify(f)){t.value=f;return}}if(!(t.value.length===1&&t.value[0]===(r.onlySearcher?o.searcherKey.value:a.regionIndex.value)))if(r.onlySearcher){if(t.value.length===1){o.searcherKey.value=t.value[0];return}o.searcherKey.value=w;return}else{if(!t.value.length)return;if(t.value.length===1&&o.searcherKey.value!==w){a.regionIndex.value=t.value[0];let f;for(const s of v.value.values()){for(const g of s.regionByIndex.values())if((r.forFrequency?g.key:g.index)===a.regionIndex.value){f=s.key;break}if(f!==void 0)break}f!==void 0&&(o.searcherKey.value=f)}else o.searcherKey.value=w,u.regionsIndexes.value=[...t.value]}},{immediate:!0}),l({getSearcher:S,getRegion:i}),(c,I)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"top-selectorRegion":!0,"top-selectorRegion-onlySearcher":c.onlySearcher})},[e.createVNode(x._sfc_main$4,{options:e.unref(o).optionBySearcherKey.value,modelValue:e.unref(o).searcherKey.value,"onUpdate:modelValue":I[0]||(I[0]=B=>e.unref(o).searcherKey.value=B),name:"searcher_key",addChanger:c.addChanger},null,8,["options","modelValue","addChanger"]),!c.onlySearcher&&e.unref(o).searcherKey.value!==e.unref(w)?(e.openBlock(),e.createBlock(x._sfc_main$4,{key:0,class:"top-select-region",options:e.unref(a).optionByRegionIndex.value,modelValue:e.unref(a).regionIndex.value,"onUpdate:modelValue":I[1]||(I[1]=B=>e.unref(a).regionIndex.value=B),name:c.forFrequency?"region_key":"region_index",addChanger:c.addChanger,"data-top-icon":c.addRegionIcon?"":void 0},null,8,["options","modelValue","name","addChanger","data-top-icon"])):e.createCommentVNode("",!0),c.addCompare&&!c.onlySearcher&&e.unref(o).searcherKey.value===e.unref(w)?(e.openBlock(),e.createBlock(x._sfc_main,{key:1,name:"compare",onClick:m,"data-count-compare-regions-indexes":e.unref(u).regionsIndexes.value.length},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.$i18n.Common.Selected_regions),1)]),_:1},8,["data-count-compare-regions-indexes"])):e.createCommentVNode("",!0)],2))}}),Se=[{id:"1",name:"Without Tag",color_id:"1"},{id:"2",name:"Red",color_id:"2"},{id:"3",name:"Orange",color_id:"3"},{id:"4",name:"Yellow",color_id:"4"},{id:"5",name:"Blue",color_id:"5"},{id:"6",name:"Purple",color_id:"6"},{id:"7",name:"Green",color_id:"7"},{id:"8",name:"Magenta",color_id:"8"},{id:"9",name:"Dark blue",color_id:"9"},{id:"10",name:"Turquoise",color_id:"10"}],X=n=>"-"+n,K=n=>n[0]==="-"?n.substring(1):n,O=(n,l)=>{n=K(n);const r=l.find(t=>t.id===n);if(r)return r},ke=["data-tag_id","data-tag_color_id","title"],D=e.defineComponent({__name:"tagIcon",props:{id:{},colorId:{},name:{},state:{}},setup(n){return(l,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"top-tagSelector_tagIcon":!0,"top-tagSelector-active":!!l.state,"top-tagSelector-excluded":l.state==="excluded"}),"data-tag_id":l.id,"data-tag_color_id":l.colorId,title:l.name},null,10,ke))}}),Ie=["contenteditable","onKeydown"],Z=e.defineComponent({__name:"tagPopupListItem",props:e.mergeModels({editable:{type:Boolean},disabled:{type:Boolean},canExclude:{type:Boolean},id:{},colorId:{},name:{},state:{}},{name:{required:!0},nameModifiers:{}}),emits:e.mergeModels(["update:name","unselect","exclude","select"],["update:name"]),setup(n,{emit:l}){const r=n,t=l,d=e.useModel(n,"name"),o=e.ref(null),a=e.computed(()=>navigator.userAgent.indexOf("Firefox")!=-1?{contenteditable:u.value,onpaste:m=>m.preventDefault()}:{}),u=e.ref(!1),v=async()=>{var m;u.value=!0,await e.nextTick(),(m=o.value)==null||m.focus()},h=()=>{var c;const m=(c=o.value)==null?void 0:c.innerText;if(!m)return S();o.value&&(o.value.innerText=m),u.value=!1,t("update:name",m)},S=async()=>{o.value&&(o.value.innerText=r.name),u.value=!1},i=m=>{if(u.value||r.disabled)return;let c="selected";r.canExclude&&(m.ctrlKey||m.metaKey)&&(c="excluded"),r.state==c&&(c=""),c===""&&t("unselect"),c==="selected"&&t("select"),c==="excluded"&&t("exclude")};return(m,c)=>(e.openBlock(),e.createBlock(E._sfc_main$1,{class:e.normalizeClass({"top-tagSelector_tagListItem":!0,"top-tagSelector_tagListItem-inEdit":u.value,"top-tagSelector_tagListItem-disabled":m.disabled,"top-tagSelector_tagListItem-canExclude":m.canExclude,"top-tagSelector-active":!!m.state,"top-tagSelector-excluded":m.state==="excluded"}),onClick:e.withModifiers(i,["stop"])},{default:e.withCtx(()=>[e.createVNode(D,{id:m.id,name:d.value,colorId:m.colorId,state:m.state},null,8,["id","name","colorId","state"]),e.createElementVNode("span",e.mergeProps({ref_key:"elName",ref:o,class:"top-tagSelector_tagListItemName",contenteditable:u.value?"plaintext-only":!1},a.value,{onKeydown:[e.withKeys(e.withModifiers(h,["stop"]),["enter"]),e.withKeys(e.withModifiers(S,["stop"]),["esc"])]}),e.toDisplayString(d.value),17,Ie),m.editable?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[u.value?(e.openBlock(),e.createElementBlock("span",{key:1,"data-top-icon":"",class:"top-tagSelector_edit",onClick:e.withModifiers(h,["stop"])})):(e.openBlock(),e.createElementBlock("span",{key:0,"data-top-icon":"",class:"top-tagSelector_edit",onClick:v}))],64)):e.createCommentVNode("",!0)]),_:1},8,["class"]))}}),xe={key:1},ee=e.defineComponent({inheritAttrs:!1,__name:"popupOpener",props:e.mergeModels({modelValue:{},id:{},tags:{},mode:{},targetId:{},filters:{},useTopButton:{type:Boolean},payload:{},styling:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const l=n,r=e.useModel(n,"modelValue"),t=l.useTopButton?x._sfc_main:"div",d=l.useTopButton?"html":"default",o={model:r,mode:l.mode,targetId:l.targetId,filters:l.filters,payload:l.payload};return(a,u)=>{const v=e.resolveDirective("top-data");return e.openBlock(),e.createBlock(E._sfc_main$2,{id:a.id},{default:e.withCtx(()=>[e.withDirectives((e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(t)),e.mergeProps({class:{"top-tagSelector":!0,"top-tagSelector-filter":l.mode==="filter","top-tagSelector-setter_single":l.mode==="setter"&&!a.filters,"top-tagSelector-setter_several":l.mode==="setter"&&a.filters,"top-tagSelector-selectedOne":!r.value.length||r.value.length===1,"top-tagSelector-toTwoLine":r.value.length>5},color:"theme",styling:a.styling},a.$attrs),{[e.unref(d)]:e.withCtx(()=>[!r.value.length&&a.mode==="filter"?(e.openBlock(),e.createBlock(D,{key:0,id:"all",colorId:"",name:a.$i18n.Common.All_tags??"",state:""},null,8,["name"])):e.createCommentVNode("",!0),a.mode==="setter"&&a.filters?(e.openBlock(),e.createElementBlock("div",xe,[e.renderSlot(a.$slots,"default")])):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:2},e.renderList(r.value,h=>{var S,i;return e.openBlock(),e.createBlock(D,{id:e.unref(K)(h),colorId:((S=e.unref(O)(h,a.tags))==null?void 0:S.color_id)??"",name:((i=e.unref(O)(h,a.tags))==null?void 0:i.name)??"",state:e.unref(K)(h)===h?"selected":"excluded"},null,8,["id","colorId","name","state"])}),256))]),_:2},1040,["class","styling"])),[[v,o,"topTagSelectorTarget"]])]),_:3},8,["id"])}}}),Ce=e.defineComponent({__name:"tagSelector",props:e.mergeModels({modelValue:{},tags:{},tagsEditable:{type:Boolean},tagsMax:{default:10},id:{},singleMode:{type:Boolean},requiredForSetter:{type:Boolean,default:!0},maxTagsForSetter:{},emitDelay:{default:500},styling:{}},{modelValue:{required:!0},modelModifiers:{},tags:{default:e.reactive(Se)},tagsModifiers:{}}),emits:e.mergeModels(["selector","setter","tagsChanged"],["update:modelValue","update:tags"]),setup(n,{emit:l}){const r=x.useI18n(),t=n,d=e.useModel(n,"modelValue"),o=e.useModel(n,"tags"),a=l,u=x.debounce((s,g)=>{a(s,g)},t.emitDelay);t.singleMode&&!d.value.length&&(d.value=[o.value[0].id]);const v=t.id??"top-popup-id-"+Math.random(),h=e.ref("add"),S=()=>{var y;const s=" "+((y=r.Common.Tags)==null?void 0:y.toLowerCase()),g=new Map;return g.set("add",{value:"add",title:r.Common.Add+s}),g.set("replace",{value:"replace",title:r.Common.Replace+s}),g.set("delete",{value:"delete",title:r.Common.Delete+s}),g};let i=e.shallowRef({model:d,mode:"filter",targetId:void 0,filters:void 0,payload:void 0});e.watch(d,()=>{u("selector",d.value)});const m=e.computed(()=>{if(i.value.mode==="setter"&&t.maxTagsForSetter&&!i.value.filters)return i.value.model.value.length>=t.maxTagsForSetter}),c=s=>{if(s!=="all"){if(i.value.model.value.includes(s))return"selected";if(i.value.model.value.includes(X(s)))return"excluded"}return s==="all"&&!i.value.model.value.length?"selected":""},I=(s,g)=>{const y=X(s);let k=i.value.model.value.filter(M=>M!==s&&M!==y);g==="select"&&k.push(s),g==="exclude"&&k.push(y),i.value.mode==="setter"&&i.value.targetId!==void 0&&t.requiredForSetter&&(k.length||k.push("1"),k.length===2&&i.value.model.value.length===1&&i.value.model.value[0]==="1"&&(k=k.filter(M=>M!=="1"))),t.singleMode&&!i.value.filters&&(k.length||(k=i.value.model.value),k.length>1&&(k=[k[k.length-1]])),k.sort((M,N)=>{if(!t.tags)return 0;const q=t.tags.findIndex(b=>b.id===M),R=t.tags.findIndex(b=>b.id===N);return q-R}),i.value.model.value=k,i.value.mode==="setter"&&i.value.targetId!==void 0&&u("setter",{tagsIds:k,targetId:i.value.targetId,payload:i.value.payload})},B=e.computed(()=>{let s="top-tagSelector_popup";return i.value.mode==="filter"&&(s+=" top-tagSelector_popup-filter"),i.value.mode==="setter"&&(s+=" top-tagSelector_popup-setter"),s}),C=()=>{const s=prompt("","New tag");if(!s||s==="New tag")return;const g=o.value.length+1;o.value.push({id:String(g),name:s,color_id:String((g-1)%10+1)}),a("tagsChanged",o.value)},V=s=>{var g;if(i.value=_.storage(s.elPopupOpener,"topTagSelectorTarget"),!i.value)throw new Error("Open popup TopTagSelector required v-data:topTagSelectorTarget");if(i.value.filters&&(h.value="add",i.value.model.value=[]),!((g=x.Core.$)!=null&&g.ui.sortable)){console.info("Для работы сортировки требуется глобальная загрузка jQuery UI Sortable");return}!x.Core.state.isMobile&&!x.Core.state.isMobileUA&&o.value&&$(s.elPopup).sortable({items:'li:has([data-tag_id]:not([data-tag_id="all"]))',cancel:'[contenteditable="plaintext-only"], [contenteditable="true"]',distance:10,stop:function(y,k){if(!o.value)return;const M=$(k.item).parent().find("[data-tag_id]"),N=[];M.each((q,R)=>{if(!o.value)return;const b=$(R).attr("data-tag_id");N.push(b)}),o.value.sort((q,R)=>{const b=N.findIndex(j=>j===q.id),Ke=N.findIndex(j=>j===R.id);return b-Ke}),u("tagsChanged",o.value)}})},f=s=>{var g;(g=x.Core.$)!=null&&g.ui.sortable&&$(s.elPopup).data("ui-sortable")&&$(s.elPopup).sortable("destroy")};return(s,g)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(ee,{class:"top-as-selector",modelValue:d.value,"onUpdate:modelValue":g[0]||(g[0]=y=>d.value=y),id:e.unref(v),tags:o.value,styling:s.styling,mode:"filter",useTopButton:""},null,8,["modelValue","id","tags","styling"]),e.createVNode(E._sfc_main,{id:e.unref(v),class:e.normalizeClass(B.value),onOpen:g[4]||(g[4]=y=>V(y)),onClose:g[5]||(g[5]=y=>f(y)),"transition-duration":50},e.createSlots({contentList:e.withCtx(()=>[e.unref(i).mode==="filter"&&!s.singleMode?(e.openBlock(),e.createBlock(Z,{key:0,id:"all",colorId:"",name:s.$i18n.Common.All_tags??"",state:e.unref(i).model.value.length?"":"selected",onSelect:g[3]||(g[3]=y=>e.unref(i).model.value=[])},null,8,["name","state"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,y=>(e.openBlock(),e.createBlock(Z,{key:y.id,id:y.id,colorId:y.color_id,name:y.name,state:c(y.id),canExclude:e.unref(i).mode==="filter"&&!s.singleMode,editable:s.tagsEditable,disabled:m.value&&c(y.id)==="",onUnselect:k=>I(y.id,"unselect"),onSelect:k=>I(y.id,"select"),onExclude:k=>I(y.id,"exclude"),"onUpdate:name":k=>{y.name=k,e.unref(u)("tagsChanged",o.value)}},null,8,["id","colorId","name","state","canExclude","editable","disabled","onUnselect","onSelect","onExclude","onUpdate:name"]))),128)),s.tagsEditable&&o.value.length<s.tagsMax&&o.value.length<20?(e.openBlock(),e.createBlock(E._sfc_main$1,{key:1,"data-top-icon":"",onClick:e.withModifiers(C,["stop"])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(s.$i18n.Common.Add),1)]),_:1})):e.createCommentVNode("",!0)]),_:2},[e.unref(i).mode==="setter"&&e.unref(i).filters?{name:"header",fn:e.withCtx(()=>[e.createVNode(x._sfc_main$4,{modelValue:h.value,"onUpdate:modelValue":g[1]||(g[1]=y=>h.value=y),options:S()},null,8,["modelValue","options"])]),key:"0"}:void 0,e.unref(i).mode==="setter"&&e.unref(i).filters?{name:"footer",fn:e.withCtx(()=>[e.createVNode(x._sfc_main,{color:"theme"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(s.$i18n.Common.Cancel),1)]),_:1}),e.createVNode(x._sfc_main,{onClick:g[2]||(g[2]=y=>e.unref(u)("setter",{tagsIds:e.unref(i).model.value,filters:e.unref(i).filters,filtersAction:h.value,payload:e.unref(i).payload}))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(h.value==="add"?s.$i18n.Common.Add:"")+" "+e.toDisplayString(h.value==="replace"?s.$i18n.Common.Replace:"")+" "+e.toDisplayString(h.value==="delete"?s.$i18n.Common.Remove:""),1)]),_:1})]),key:"1"}:void 0]),1032,["id","class"])],64))}}),Be=(n,l)=>e.computed(()=>e.toValue(n).filter(d=>d.on>=0||d.id===l).map(d=>({value:d.id,title:d.url+` [${d.id}]`,icon:d.id===e.toValue(l)?"":"",content:d.name}))),Te=(n,l,r)=>{l||(l={id:n.id}),l.id=n.id;const t=ae.TopPopupWorker.genElPopupOpener("div",l);return t.classList.add("top-tagSelector"),n.useTopButton&&t.classList.add("top-button","top-color_theme"),n.mode==="filter"&&t.classList.add("top-tagSelector-filter"),n.mode==="setter"&&!n.filters&&t.classList.add("top-tagSelector-setter_single"),n.mode==="setter"&&n.filters&&t.classList.add("top-tagSelector-setter_several"),t.onclick=d=>{d.preventDefault(),d.stopPropagation(),t.onclick=null;const o=e.ref(n.modelValue),a={model:o,mode:n.mode,targetId:n.targetId,filters:n.filters,payload:n.payload};_.storage(t,"topTagSelectorTarget",a),delete t.dataset.topPopupDisabled,e.isRef(n.modelValue)||e.watch(o,()=>{n.modelValue=o.value,F(t,n,r)}),t.click()},e.isRef(n.modelValue)?e.watch(n.modelValue,()=>F(t,n,r)):_.storage(t,"topTagSelectorRender",d=>{n.modelValue=d;const o=_.storage(t,"topTagSelectorTarget");o&&(o.model.value=d),F(t,n,r)}),F(t,n,r),t},Ve=(n,l)=>{var r;(r=_.storage(n,"topTagSelectorRender"))==null||r(l)},F=(n,l,r)=>{var d;const t=e.unref(l.modelValue);if(n.classList.toggle("top-tagSelector-selectedOne",!t.length||t.length===1),n.classList.toggle("top-tagSelector-toTwoLine",t.length>5),l.mode==="setter"&&l.filters){n.innerHTML=`<div>${r}</div>`;return}if(n.innerHTML="",!t.length&&l.mode==="filter"){const o=te({id:"all",colorId:"",name:((d=x.useI18n().Common)==null?void 0:d.All_tags)??"",state:""});n.append(o)}t.forEach(o=>{var u,v;const a=te({id:K(o),colorId:((u=O(o,l.tags))==null?void 0:u.color_id)??"",name:((v=O(o,l.tags))==null?void 0:v.name)??"",state:K(o)===o?"selected":"excluded"});n.append(a)})},te=n=>{const l=document.createElement("div");return l.classList.add("top-tagSelector_tagIcon"),l.classList.toggle("top-tagSelector-active",!!n.state),l.classList.toggle("top-tagSelector-excluded",n.state==="excluded"),l.dataset.tag_id=n.id,l.dataset.tag_color_id=n.colorId,l.title=n.name,l},we=de,Me=he,be=Ce,Ee=ee,_e=D;T.TopSelectorCompetitors=we,T.TopSelectorRegion=Me,T.TopTagSelector=be,T.TopTagSelectorPopupOpener=Ee,T.TopTagSelectorTagIcon=_e,T.dialogSelectorRegions=Q,T.findRegion=H,T.genElTopTagSelectorPopupOpener=Te,T.genSearcherByKey=z,T.renderElTopTagSelectorPopupOpener=Ve,T.useItemsFromCompetitors=Be,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})});
|
|
2
2
|
//# sourceMappingURL=project.amd.js.map
|