@topvisor/ui 1.0.26-9 → 1.0.27-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.chunks/{core-B9imztzR.amd.js → core-BmIJ2adg.amd.js} +2 -2
- package/.chunks/{core-B9imztzR.amd.js.map → core-BmIJ2adg.amd.js.map} +1 -1
- package/.chunks/{core-Bcq6idRz.es.js → core-C0QEqD1d.es.js} +4 -4
- package/.chunks/{core-Bcq6idRz.es.js.map → core-C0QEqD1d.es.js.map} +1 -1
- package/.chunks/{datepicker-DPc8qQ_Y.es.js → datepicker-CXhUvPw5.es.js} +2 -2
- package/.chunks/{datepicker-DPc8qQ_Y.es.js.map → datepicker-CXhUvPw5.es.js.map} +1 -1
- package/.chunks/{datepicker-NsthdPQ1.amd.js → datepicker-bNYuHqTY.amd.js} +2 -2
- package/.chunks/{datepicker-NsthdPQ1.amd.js.map → datepicker-bNYuHqTY.amd.js.map} +1 -1
- package/.chunks/{dialog_selectorRegions-D_HXNjOX.amd.js → dialog_selectorRegions-B09GIvNe.amd.js} +2 -2
- package/.chunks/{dialog_selectorRegions-D_HXNjOX.amd.js.map → dialog_selectorRegions-B09GIvNe.amd.js.map} +1 -1
- package/.chunks/{dialog_selectorRegions-DZR64Wm8.es.js → dialog_selectorRegions-BgrX75Zl.es.js} +4 -4
- package/.chunks/{dialog_selectorRegions-DZR64Wm8.es.js.map → dialog_selectorRegions-BgrX75Zl.es.js.map} +1 -1
- package/.chunks/{dialogs.vue_vue_type_script_setup_true_lang-vT5jI1Ll.amd.js → dialogs.vue_vue_type_script_setup_true_lang-ChHXFPiF.amd.js} +2 -2
- package/.chunks/{dialogs.vue_vue_type_script_setup_true_lang-vT5jI1Ll.amd.js.map → dialogs.vue_vue_type_script_setup_true_lang-ChHXFPiF.amd.js.map} +1 -1
- package/.chunks/{dialogs.vue_vue_type_script_setup_true_lang-BLGKFF8Y.es.js → dialogs.vue_vue_type_script_setup_true_lang-IEhQGR1d.es.js} +2 -2
- package/.chunks/{dialogs.vue_vue_type_script_setup_true_lang-BLGKFF8Y.es.js.map → dialogs.vue_vue_type_script_setup_true_lang-IEhQGR1d.es.js.map} +1 -1
- package/.chunks/{forms-B3bJpLOo.amd.js → forms-CJ5N_pAq.amd.js} +3 -3
- package/.chunks/{forms-B3bJpLOo.amd.js.map → forms-CJ5N_pAq.amd.js.map} +1 -1
- package/.chunks/{forms-BEMrEl5V.es.js → forms-Dg0Huskq.es.js} +427 -421
- package/.chunks/{forms-BEMrEl5V.es.js.map → forms-Dg0Huskq.es.js.map} +1 -1
- package/.chunks/{listItem.vue_vue_type_script_setup_true_lang-DMQVN3dP.es.js → listItem.vue_vue_type_script_setup_true_lang-CN0_pb-f.es.js} +2 -2
- package/.chunks/listItem.vue_vue_type_script_setup_true_lang-CN0_pb-f.es.js.map +1 -0
- package/.chunks/{listItem.vue_vue_type_script_setup_true_lang-DLF_Qnj6.amd.js → listItem.vue_vue_type_script_setup_true_lang-Ccx-3_PR.amd.js} +2 -2
- package/.chunks/listItem.vue_vue_type_script_setup_true_lang-Ccx-3_PR.amd.js.map +1 -0
- package/.chunks/{menu.vue_vue_type_style_index_0_lang-DzNVeeZl.es.js → menu.vue_vue_type_style_index_0_lang-B9HkLtVf.es.js} +7 -7
- package/.chunks/menu.vue_vue_type_style_index_0_lang-B9HkLtVf.es.js.map +1 -0
- package/.chunks/{menu.vue_vue_type_style_index_0_lang-VpwRSIdl.amd.js → menu.vue_vue_type_style_index_0_lang-Bn4GA1gj.amd.js} +2 -2
- package/.chunks/menu.vue_vue_type_style_index_0_lang-Bn4GA1gj.amd.js.map +1 -0
- package/.chunks/{notice-DMnioYtH.amd.js → notice-COAtZx4K.amd.js} +2 -2
- package/.chunks/{notice-DMnioYtH.amd.js.map → notice-COAtZx4K.amd.js.map} +1 -1
- package/.chunks/{notice-CTntRScY.es.js → notice-DfI-Ga6e.es.js} +2 -2
- package/.chunks/{notice-CTntRScY.es.js.map → notice-DfI-Ga6e.es.js.map} +1 -1
- package/.chunks/{page.vue_vue_type_script_setup_true_lang-BI9HWAyQ.amd.js → page.vue_vue_type_script_setup_true_lang-CQbcjBRq.amd.js} +2 -2
- package/.chunks/{page.vue_vue_type_script_setup_true_lang-BI9HWAyQ.amd.js.map → page.vue_vue_type_script_setup_true_lang-CQbcjBRq.amd.js.map} +1 -1
- package/.chunks/{page.vue_vue_type_script_setup_true_lang-CCE8pKg7.es.js → page.vue_vue_type_script_setup_true_lang-DqkGsz8-.es.js} +4 -4
- package/.chunks/{page.vue_vue_type_script_setup_true_lang-CCE8pKg7.es.js.map → page.vue_vue_type_script_setup_true_lang-DqkGsz8-.es.js.map} +1 -1
- package/.chunks/{popup-BnyVyxQA.amd.js → popup-Cvlw738y.amd.js} +2 -2
- package/.chunks/{popup-BnyVyxQA.amd.js.map → popup-Cvlw738y.amd.js.map} +1 -1
- package/.chunks/{popup-INaxGjMc.es.js → popup-ScwGndLi.es.js} +2 -2
- package/.chunks/{popup-INaxGjMc.es.js.map → popup-ScwGndLi.es.js.map} +1 -1
- package/.chunks/{utils-DIly8mml.es.js → utils-6pAQX17-.es.js} +2 -2
- package/.chunks/{utils-DIly8mml.es.js.map → utils-6pAQX17-.es.js.map} +1 -1
- package/.chunks/{utils-D4KXBloN.es.js → utils-B8OQ-bo6.es.js} +3 -3
- package/.chunks/{utils-D4KXBloN.es.js.map → utils-B8OQ-bo6.es.js.map} +1 -1
- package/.chunks/{utils-CTjq0RlC.amd.js → utils-Kng8viAk.amd.js} +2 -2
- package/.chunks/{utils-CTjq0RlC.amd.js.map → utils-Kng8viAk.amd.js.map} +1 -1
- package/.chunks/{utils-Bi5onrSF.amd.js → utils-dA01j_vJ.amd.js} +2 -2
- package/.chunks/{utils-Bi5onrSF.amd.js.map → utils-dA01j_vJ.amd.js.map} +1 -1
- package/assets/forms.css +1 -1
- package/charts/charts.amd.js +1 -1
- package/charts/charts.js +1 -1
- package/components/dialog/dialog/page/types.d.ts +2 -2
- package/components/formsExt/info/types.d.ts +1 -1
- package/components/formsExt/selector2/selector2.d.ts +1 -1
- package/components/formsExt/selector2/selector2.vue.d.ts +5 -5
- package/components/layout/islandRows/types.d.ts +1 -1
- package/components/popup/popup/popup.vue.d.ts +2 -2
- package/core/app.amd.js +1 -1
- package/core/app.js +5 -5
- package/core/plugins/core.d.ts +1 -1
- package/core/plugins/i18n.d.ts +4 -4
- package/dialog/dialog.amd.js +1 -1
- package/dialog/dialog.amd.js.map +1 -1
- package/dialog/dialog.js +2 -2
- package/dialog/dialog.js.map +1 -1
- 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 +2 -2
- package/formsExt/formsExt.js.map +1 -1
- 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.js +2 -2
- package/project/project.amd.js +1 -1
- package/project/project.js +5 -5
- package/tabsView/tabsView.amd.js +1 -1
- package/tabsView/tabsView.amd.js.map +1 -1
- package/tabsView/tabsView.js +2 -2
- package/tabsView/tabsView.js.map +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 +1 -1
- package/utils/device.amd.js +1 -1
- package/utils/device.js +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.js +1 -1
- package/.chunks/listItem.vue_vue_type_script_setup_true_lang-DLF_Qnj6.amd.js.map +0 -1
- package/.chunks/listItem.vue_vue_type_script_setup_true_lang-DMQVN3dP.es.js.map +0 -1
- package/.chunks/menu.vue_vue_type_style_index_0_lang-DzNVeeZl.es.js.map +0 -1
- package/.chunks/menu.vue_vue_type_style_index_0_lang-VpwRSIdl.amd.js.map +0 -1
package/popup/worker.amd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
define(["require","exports","../.chunks/forms-
|
|
1
|
+
define(["require","exports","../.chunks/forms-CJ5N_pAq.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 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-Cvlw738y.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){const o=Worker.getPopup(t);o&&o.close()}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 s=t.querySelector("ul.top-popup_content"),a=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 p=100;for(const e of a){if(e.querySelector(":scope > .top-active"))break;e instanceof HTMLElement&&(p+=e.offsetHeight)}if(s instanceof HTMLElement){const e=s.offsetHeight;p>e?s.scrollTop=p-e:s.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,...s){const a=utils_dom.default.genEl(t,{},...s);a.dataset.topPopup="#"+o.id;for(let p in o){const e="topPopup"+p.charAt(0).toUpperCase()+p.slice(1);a.dataset[e]=o[p]}return a}}exports.TopPopupWorker=Worker,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|
|
2
2
|
//# sourceMappingURL=worker.amd.js.map
|
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-Dg0Huskq.es.js";
|
|
2
2
|
import DOM from "../utils/dom.js";
|
|
3
3
|
class Worker {
|
|
4
4
|
/**
|
|
@@ -44,7 +44,7 @@ class Worker {
|
|
|
44
44
|
*/
|
|
45
45
|
static async open(elOpener, options) {
|
|
46
46
|
elOpener instanceof HTMLElement && (elOpener.dataset.topPopupOpened = "opened");
|
|
47
|
-
const { TopLibPopup } = await import("../.chunks/popup-
|
|
47
|
+
const { TopLibPopup } = await import("../.chunks/popup-ScwGndLi.es.js");
|
|
48
48
|
if (Core.$) {
|
|
49
49
|
const $elOpener = Core.$(elOpener);
|
|
50
50
|
if ($elOpener.data("aftershow")) {
|
package/project/project.amd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
define(["require","exports","vue","../.chunks/forms-B3bJpLOo.amd","../.chunks/listItem.vue_vue_type_script_setup_true_lang-DLF_Qnj6.amd","../.chunks/menu.vue_vue_type_style_index_0_lang-VpwRSIdl.amd","../.chunks/utils-CTjq0RlC.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 f;return s.value===((f=r.value)==null?void 0:f[0])}))==null?void 0:a.content),1)]}),_:1})]),contentList:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.items,(a,s)=>{var f;return e.openBlock(),e.createBlock(E._sfc_main$1,{class:e.normalizeClass({"top-active":(f=r.value)==null?void 0:f.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,y=-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:y,name:"--",index:y},G={key:y,name:"--",regions:[J],regionByIndex:new Map([[y,J]])},A={key:y,name:"Autoselect",index:y},U={key:y,name:"Autoselect",regions:[A],regionByIndex:new Map([[y,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(y,ce()),t.size||t.set(y,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 f={...s};a.regionByIndex.set(f.index,f)}),!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-D_HXNjOX.amd"],n,l))),fe=(n,l)=>{const r=x.useI18n(),t=e.ref(l.value.keys().next().value??y),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(y)){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(y);n.modelValue.length===1&&(t.value=n.modelValue[0]),t.value===y&&(n.forFrequency?t.value=((a=(o=l.value)==null?void 0:o.regionByIndex.values().next().value)==null?void 0:a.key)??y:t.value=((s=l.value)==null?void 0:s.regionByIndex.keys().next().value)??y);const d=e.computed(()=>{var h;const f=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};f.has(S.key)||f.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};f.set(S.index,c)}),f});return e.watch(d,(f,h)=>{var c;if(n.onlySearcher||t.value!==void 0&&f.get(t.value))return;let S=f.keys().next().value;if(t.value===y||S===y){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 f.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 v=i,u=3;C.indexOf(v)===-1&&(v=i.replace(/^[^a-zа-я]/i,"").replace(V,""),u--),C.indexOf(v)===-1&&(v=i.replace(/ \/.*/,""),u--),C.indexOf(v)===-1&&(v=i.replace(/ \/.*/,""),v=v.replace(/^[^a-zа-я]/i,"").replace(V,""),u--),C.indexOf(v)!==-1&&(u<=m||(m=u,S=I))}t.value=S}),{regionIndex:t,optionByRegionIndex:d}},pe=(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}},ye=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!==y&&i.add(c.index)})}),i}),d=fe(n,l),o=ve(n,r),a=pe(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,v,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=(v=l.value.get(i))==null?void 0:v.regionByIndex);const p=(u=l.value.get(C.key))==null?void 0:u.regionByIndex;g!=null&&g.has(y)&&!(p!=null&&p.has(y))&&(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===y))return d.searcherKey.value},f=()=>{if(n.onlySearcher||o.regionIndex.value===y)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=f();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:f,allRegionsIndexes:h,getSearcher:S,getRegion:i}=ye(r),m=()=>{const c=[];f.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===y&&!r.autoRegion&&(t.value.length=0)):(t.value=[a.regionIndex.value],a.regionIndex.value===y&&!r.autoRegion&&(t.value.length=0));!r.onlySearcher&&!h.value.size&&(o.searcherKey.value=y)}),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&&!f.value.has(t.value[0])||t.value.length===1&&t.value[0]===y&&!r.autoRegion){let v=f.value.keys().next().value;v===y&&!r.autoRegion&&(v=void 0,d.value=y),v!==void 0?t.value=[v]: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 v=[...new Set(t.value)],u=(I=(c=f.value.values().next().value)==null?void 0:c.regionByIndex)==null?void 0:I.keys().next().value;if(r.forFrequency&&(u=(V=(C=(B=f.value.values().next().value)==null?void 0:B.regionByIndex)==null?void 0:C.values().next().value)==null?void 0:V.key),u===y&&!r.autoRegion&&(u=void 0,d.value=y),!v.length)u!==void 0&&v.push(u);else if(v.length===1){let g=h.value;r.forFrequency&&(g=new Set,f.value.forEach(p=>{p.regionByIndex.forEach(k=>{k.index!==L&&k.index!==y&&g.add(k.key)})})),g.has(v[0])||(v=[],u!==void 0&&v.push(u))}else v=v.filter(g=>h.value.has(g)),!v.length&&u!==void 0&&v.push(u);if(JSON.stringify(t.value)!==JSON.stringify(v)){t.value=v;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 v;for(const u of f.value.values()){for(const g of u.regionByIndex.values())if((r.forFrequency?g.key:g.index)===a.regionIndex.value){v=u.key;break}if(v!==void 0)break}v!==void 0&&(o.searcherKey.value=v)}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),f=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:f}))],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:{}},{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 f=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.$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"])),[[f,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}},{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 f=t.id??"top-popup-id-"+Math.random(),h=e.ref("add"),S=()=>{var p;const u=" "+((p=r.Common.Tags)==null?void 0:p.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 p=X(u);let k=i.value.model.value.filter(M=>M!==u&&M!==p);g==="select"&&k.push(u),g==="exclude"&&k.push(p),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(p,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)}})},v=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]=p=>d.value=p),id:e.unref(f),tags:o.value,mode:"filter",useTopButton:""},null,8,["modelValue","id","tags"]),e.createVNode(E._sfc_main,{id:e.unref(f),class:e.normalizeClass(B.value),onOpen:g[4]||(g[4]=p=>V(p)),onClose:g[5]||(g[5]=p=>v(p)),"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]=p=>e.unref(i).model.value=[])},null,8,["name","state"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,p=>(e.openBlock(),e.createBlock(Z,{key:p.id,id:p.id,colorId:p.color_id,name:p.name,state:c(p.id),canExclude:e.unref(i).mode==="filter"&&!u.singleMode,editable:u.tagsEditable,disabled:m.value&&c(p.id)==="",onUnselect:k=>I(p.id,"unselect"),onSelect:k=>I(p.id,"select"),onExclude:k=>I(p.id,"exclude"),"onUpdate:name":k=>{p.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]=p=>h.value=p),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]=p=>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,f;const a=te({id:K(o),colorId:((s=O(o,l.tags))==null?void 0:s.color_id)??"",name:((f=O(o,l.tags))==null?void 0:f.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-CJ5N_pAq.amd","../.chunks/listItem.vue_vue_type_script_setup_true_lang-Ccx-3_PR.amd","../.chunks/menu.vue_vue_type_style_index_0_lang-Bn4GA1gj.amd","../.chunks/utils-Kng8viAk.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 f;return s.value===((f=r.value)==null?void 0:f[0])}))==null?void 0:a.content),1)]}),_:1})]),contentList:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.items,(a,s)=>{var f;return e.openBlock(),e.createBlock(E._sfc_main$1,{class:e.normalizeClass({"top-active":(f=r.value)==null?void 0:f.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,y=-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:y,name:"--",index:y},G={key:y,name:"--",regions:[J],regionByIndex:new Map([[y,J]])},A={key:y,name:"Autoselect",index:y},U={key:y,name:"Autoselect",regions:[A],regionByIndex:new Map([[y,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(y,ce()),t.size||t.set(y,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 f={...s};a.regionByIndex.set(f.index,f)}),!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-B09GIvNe.amd"],n,l))),fe=(n,l)=>{const r=x.useI18n(),t=e.ref(l.value.keys().next().value??y),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(y)){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(y);n.modelValue.length===1&&(t.value=n.modelValue[0]),t.value===y&&(n.forFrequency?t.value=((a=(o=l.value)==null?void 0:o.regionByIndex.values().next().value)==null?void 0:a.key)??y:t.value=((s=l.value)==null?void 0:s.regionByIndex.keys().next().value)??y);const d=e.computed(()=>{var h;const f=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};f.has(S.key)||f.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};f.set(S.index,c)}),f});return e.watch(d,(f,h)=>{var c;if(n.onlySearcher||t.value!==void 0&&f.get(t.value))return;let S=f.keys().next().value;if(t.value===y||S===y){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 f.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 v=i,u=3;C.indexOf(v)===-1&&(v=i.replace(/^[^a-zа-я]/i,"").replace(V,""),u--),C.indexOf(v)===-1&&(v=i.replace(/ \/.*/,""),u--),C.indexOf(v)===-1&&(v=i.replace(/ \/.*/,""),v=v.replace(/^[^a-zа-я]/i,"").replace(V,""),u--),C.indexOf(v)!==-1&&(u<=m||(m=u,S=I))}t.value=S}),{regionIndex:t,optionByRegionIndex:d}},pe=(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}},ye=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!==y&&i.add(c.index)})}),i}),d=fe(n,l),o=ve(n,r),a=pe(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,v,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=(v=l.value.get(i))==null?void 0:v.regionByIndex);const p=(u=l.value.get(C.key))==null?void 0:u.regionByIndex;g!=null&&g.has(y)&&!(p!=null&&p.has(y))&&(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===y))return d.searcherKey.value},f=()=>{if(n.onlySearcher||o.regionIndex.value===y)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=f();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:f,allRegionsIndexes:h,getSearcher:S,getRegion:i}=ye(r),m=()=>{const c=[];f.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===y&&!r.autoRegion&&(t.value.length=0)):(t.value=[a.regionIndex.value],a.regionIndex.value===y&&!r.autoRegion&&(t.value.length=0));!r.onlySearcher&&!h.value.size&&(o.searcherKey.value=y)}),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&&!f.value.has(t.value[0])||t.value.length===1&&t.value[0]===y&&!r.autoRegion){let v=f.value.keys().next().value;v===y&&!r.autoRegion&&(v=void 0,d.value=y),v!==void 0?t.value=[v]: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 v=[...new Set(t.value)],u=(I=(c=f.value.values().next().value)==null?void 0:c.regionByIndex)==null?void 0:I.keys().next().value;if(r.forFrequency&&(u=(V=(C=(B=f.value.values().next().value)==null?void 0:B.regionByIndex)==null?void 0:C.values().next().value)==null?void 0:V.key),u===y&&!r.autoRegion&&(u=void 0,d.value=y),!v.length)u!==void 0&&v.push(u);else if(v.length===1){let g=h.value;r.forFrequency&&(g=new Set,f.value.forEach(p=>{p.regionByIndex.forEach(k=>{k.index!==L&&k.index!==y&&g.add(k.key)})})),g.has(v[0])||(v=[],u!==void 0&&v.push(u))}else v=v.filter(g=>h.value.has(g)),!v.length&&u!==void 0&&v.push(u);if(JSON.stringify(t.value)!==JSON.stringify(v)){t.value=v;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 v;for(const u of f.value.values()){for(const g of u.regionByIndex.values())if((r.forFrequency?g.key:g.index)===a.regionIndex.value){v=u.key;break}if(v!==void 0)break}v!==void 0&&(o.searcherKey.value=v)}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),f=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:f}))],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:{}},{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 f=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.$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"])),[[f,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}},{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 f=t.id??"top-popup-id-"+Math.random(),h=e.ref("add"),S=()=>{var p;const u=" "+((p=r.Common.Tags)==null?void 0:p.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 p=X(u);let k=i.value.model.value.filter(M=>M!==u&&M!==p);g==="select"&&k.push(u),g==="exclude"&&k.push(p),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(p,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)}})},v=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]=p=>d.value=p),id:e.unref(f),tags:o.value,mode:"filter",useTopButton:""},null,8,["modelValue","id","tags"]),e.createVNode(E._sfc_main,{id:e.unref(f),class:e.normalizeClass(B.value),onOpen:g[4]||(g[4]=p=>V(p)),onClose:g[5]||(g[5]=p=>v(p)),"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]=p=>e.unref(i).model.value=[])},null,8,["name","state"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,p=>(e.openBlock(),e.createBlock(Z,{key:p.id,id:p.id,colorId:p.color_id,name:p.name,state:c(p.id),canExclude:e.unref(i).mode==="filter"&&!u.singleMode,editable:u.tagsEditable,disabled:m.value&&c(p.id)==="",onUnselect:k=>I(p.id,"unselect"),onSelect:k=>I(p.id,"select"),onExclude:k=>I(p.id,"exclude"),"onUpdate:name":k=>{p.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]=p=>h.value=p),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]=p=>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,f;const a=te({id:K(o),colorId:((s=O(o,l.tags))==null?void 0:s.color_id)??"",name:((f=O(o,l.tags))==null?void 0:f.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
|
package/project/project.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Core as be } from "../core/app.js";
|
|
2
2
|
import { defineComponent as P, mergeModels as N, useModel as D, computed as E, createElementBlock as B, openBlock as k, createBlock as b, unref as y, withCtx as _, Fragment as Y, renderList as se, normalizeClass as X, createElementVNode as he, toDisplayString as K, createVNode as A, createTextVNode as G, ref as F, watch as w, createCommentVNode as q, withModifiers as z, mergeProps as Se, withKeys as de, nextTick as Ve, resolveDirective as Ee, withDirectives as Me, resolveDynamicComponent as Ke, renderSlot as $e, shallowRef as we, createSlots as Le, reactive as Ae, toValue as ce, isRef as ge } from "vue";
|
|
3
|
-
import { u as R, C as J, _ as H, x as ie, d as Re } from "../.chunks/forms-
|
|
4
|
-
import { _ as Ie, a as ue, b as Oe } from "../.chunks/listItem.vue_vue_type_script_setup_true_lang-
|
|
5
|
-
import { _ as Ne } from "../.chunks/menu.vue_vue_type_style_index_0_lang-
|
|
6
|
-
import { u as De } from "../.chunks/utils-
|
|
3
|
+
import { u as R, C as J, _ as H, x as ie, d as Re } from "../.chunks/forms-Dg0Huskq.es.js";
|
|
4
|
+
import { _ as Ie, a as ue, b as Oe } from "../.chunks/listItem.vue_vue_type_script_setup_true_lang-CN0_pb-f.es.js";
|
|
5
|
+
import { _ as Ne } from "../.chunks/menu.vue_vue_type_style_index_0_lang-B9HkLtVf.es.js";
|
|
6
|
+
import { u as De } from "../.chunks/utils-6pAQX17-.es.js";
|
|
7
7
|
import { getSearcherGIcon as Fe, getLangLabel as qe, getDeviceGIcon as Pe } from "../utils/searchers.js";
|
|
8
8
|
import { storage as W } from "../utils/dom.js";
|
|
9
9
|
import { TopPopupWorker as Ue } from "../popup/worker.js";
|
|
@@ -165,7 +165,7 @@ const je = { class: "top-selectorCompetitors" }, ze = { class: "top-ellipsis1" }
|
|
|
165
165
|
}), i))
|
|
166
166
|
return !1;
|
|
167
167
|
}), i;
|
|
168
|
-
}, Ze = De(() => import("../.chunks/dialog_selectorRegions-
|
|
168
|
+
}, Ze = De(() => import("../.chunks/dialog_selectorRegions-BgrX75Zl.es.js")), et = (t, l) => {
|
|
169
169
|
const o = R(), e = F(l.value.keys().next().value ?? p), i = E(() => {
|
|
170
170
|
const a = /* @__PURE__ */ new Map();
|
|
171
171
|
if (l.value.forEach((n) => {
|
package/tabsView/tabsView.amd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
define(["require","exports","vue","../.chunks/forms-
|
|
1
|
+
define(["require","exports","vue","../.chunks/forms-CJ5N_pAq.amd","../utils/route.amd","../.chunks/store-esTid5oI.amd","../popup/popup.amd","../utils/system.amd","../require/css.amd!../assets/tabsView.css"],function(X,h,e,m,f,_,S,L){"use strict";if(typeof e>"u")var e=window.Vue;const g=(o,n)=>`top:${String(o)}:${n}`,y={loadLocalStorge:(o,n)=>{if(!n.$id)return;const t=g(o,n.$id);try{const a=JSON.parse(localStorage.getItem(t));typeof a==typeof n[o]&&(n[o]=a)}catch{console.warn(new Error(`В localStorage[${t}] не корректный json`))}},addSaverLocalStorge:(o,n)=>{if(!n.$id)return;const t=g(o,n.$id);e.watch(()=>n[o],()=>{localStorage.setItem(t,JSON.stringify(n[o]))},{immediate:!0})}},k=new Set;addEventListener("popstate",o=>{k.forEach(n=>n(o))});const V=Symbol(),C=(o,n)=>{const t=_.defineStore(V,()=>{const a=e.computed(()=>o.showMenuInPopup??m.Core.state.isMobile),i=e.computed(()=>o.pageMod),u=e.ref(!1),r=e.ref(void 0),l=e.ref(!0);return{showMenuInPopup:a,pageMod:i,isShort:u,activeItemName:n,component:r,scrollable:l}},o.idState);if(o.isShortable){const a="isShort";y.loadLocalStorge(a,t),y.addSaverLocalStorge(a,t)}if(t.$id){const a=i=>{n.value=f.getHash(t.$id)};k.add(a)}return t},w=()=>_.useStore(V),P={key:1,class:"top-ellipsis"},v=e.defineComponent({__name:"menuItem",props:{name:{},href:{},icon:{},disabled:{type:Boolean},component:{default:void 0},scrollable:{type:Boolean,default:!0}},setup(o){const n=o,t=w(),a=e.computed(()=>n.name&&t.$id?f.genHash(t.$id,n.name):n.href),i=e.computed(()=>t.showMenuInPopup?S.TopPopupListItem:a?"a":"button"),u=r=>{!n.href&&a.value&&r.preventDefault(),n.name&&(t.activeItemName=n.name)};return(r,l)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(i.value),{target:"_self",class:e.normalizeClass({"top-tabsView_menuItem":!e.unref(t).showMenuInPopup,"top-active":r.name&&e.unref(t).activeItemName===r.name,"top-disabled":r.disabled,"top-spa-disabled":!0}),href:a.value,"data-top-icon":r.icon||void 0,disabled:r.disabled||void 0,onClick:u},{default:e.withCtx(()=>[e.unref(t).showMenuInPopup?e.renderSlot(r.$slots,"default",{key:0}):r.$slots.default&&!e.unref(t).isShort?(e.openBlock(),e.createElementBlock("span",P,[e.renderSlot(r.$slots,"default")])):e.createCommentVNode("",!0)]),_:3},8,["class","href","data-top-icon","disabled"]))}}),B=o=>(o==null?void 0:o.name)==="AsyncComponentWrapper"&&!(o!=null&&o.__asyncResolved),E=async(o,n)=>{(o==null?void 0:o.name)==="AsyncComponentWrapper"&&(o!=null&&o.__asyncResolved||(o.__asyncLoader(),await L.sleepWhile(()=>n()&&B(o),200)))},z={class:"top-tabsView_menuOpener"},R=["data-top-icon"],O={class:"top-ellipsis"},D={class:"top-tabsView_menuList"},H={key:0,class:"top-tabsView_menuFooter"},K=e.defineComponent({__name:"menu",props:e.mergeModels({isShortable:{type:Boolean},isLoading:{type:Boolean}},{isLoading:{},isLoadingModifiers:{}}),emits:["update:isLoading"],setup(o){const n=e.useModel(o,"isLoading"),t=w(),a=e.useSlots(),i=new Map,u=()=>{if(!a.default)return;const c=a.default({}).find(s=>s.key==="_menu");c&&r(c.children)},r=c=>{c.forEach(s=>{var M,$,N,T;if(s.type.__name&&s.type.__name!==v.__name)return;if(!s.type.__name&&typeof s.children=="object"){r(s.children);return}if(!((M=s.props)!=null&&M.name)||($=s.props)!=null&&$.disabled)return;const I={title:((T=(N=s.children).default)==null?void 0:T.call(N)[0].children).trim(),icon:s.props.icon,component:s.props.component?e.markRaw(s.props.component):v.props.component.default,scrollable:s.props.scrollable??v.props.scrollable.default};i.set(s.props.name,I)})},l=e.ref(null);let d=0;e.watch(()=>t.activeItemName,async()=>{const c=++d;if(i.size===0&&u(),i.size===0){t.activeItemName="";return}if(l.value=i.get(t.activeItemName)??null,!l.value&&t.$id){const s=f.getHash(t.$id);if(l.value=i.get(s)??null,l.value){t.activeItemName=s;return}}if(!l.value){t.activeItemName=i.keys().next().value;return}if(l.value.component===t.component){n.value=!1;return}t.$id&&f.setHash(t.$id,t.activeItemName,!1),n.value=!0,await E(l.value.component,()=>c===d),c===d&&(t.scrollable=l.value.scrollable,t.component=l.value.component,l.value&&!t.component&&console.warn(`Компонент вкладки ${t.activeItemName} не найден. Добавьте props.component для пункта меню ${t.activeItemName}.`))},{immediate:!0});const p=e.ref();let b;return e.onMounted(()=>{b=new ResizeObserver(()=>{p.value.parentElement.style.setProperty("--top-tabsView-contents-offset-top",p.value.offsetHeight+"px")}),b.observe(p.value)}),e.onUnmounted(()=>{b.disconnect()}),(c,s)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"elRef",ref:p,class:e.normalizeClass({"top-tabsView_menu":!0,"top-tabsView_menu-inPopup_0":!e.unref(t).showMenuInPopup,"top-tabsView_menu-inPopup_1":e.unref(t).showMenuInPopup,"top-tabsView_menu-short":e.unref(t).isShort&&!e.unref(t).showMenuInPopup})},[e.unref(t).showMenuInPopup?(e.openBlock(),e.createBlock(e.unref(S.TopPopup),{key:0},{opener:e.withCtx(()=>[e.createElementVNode("div",z,[l.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"top-tabsView_menuOpenerActiveItem","data-top-icon":l.value.icon},[e.createElementVNode("span",O,e.toDisplayString(l.value.title),1)],8,R)):e.createCommentVNode("",!0),s[1]||(s[1]=e.createElementVNode("div",{class:"top-tabsView_menuOpenerIcon","data-top-icon":""},null,-1))])]),contentList:e.withCtx(()=>[e.renderSlot(c.$slots,"default")]),_:3})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",D,[e.renderSlot(c.$slots,"default")]),c.isShortable?(e.openBlock(),e.createElementBlock("div",H,[c.isShortable?(e.openBlock(),e.createBlock(v,{key:0,icon:e.unref(t).isShort?"":"",onClick:s[0]||(s[0]=I=>e.unref(t).isShort=!e.unref(t).isShort)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t).isShort?"":"Свернуть"),1)]),_:1},8,["icon"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],64))],2))}}),j=e.defineComponent({__name:"tabsView",props:e.mergeModels({modelValue:{},pageMod:{type:Boolean},showMenuInPopup:{type:Boolean,default:void 0},isShortable:{type:Boolean,default:!1},idState:{}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const n=o,t=e.useModel(o,"modelValue"),a=C(n,t),i=Math.random();n.pageMod&&m.Core.state.documentClassModificators.set(i,"top-hasTabsViewPageMod"),e.onUnmounted(()=>{n.pageMod&&m.Core.state.documentClassModificators.delete(i),a.$id&&f.delHash(a.$id,a.activeItemName,!0)});const u=e.ref(),r=e.ref(!1);return e.watch([u,()=>a.component],()=>{r.value=B(a.component)},{immediate:!0}),(l,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"top-tabsView":!0,"top-tabsView-pageMod":n.pageMod,"top-tabsView-inPopup":e.unref(a).showMenuInPopup})},[e.createVNode(K,{isShortable:l.isShortable,isLoading:r.value,"onUpdate:isLoading":d[0]||(d[0]=p=>r.value=p)},{default:e.withCtx(()=>[e.renderSlot(l.$slots,"menu")]),_:3},8,["isShortable","isLoading"]),e.createElementVNode("div",{class:e.normalizeClass({"top-tabsView_contents":!0,"top-tabsView_contents-isLoading":r.value,"top-tabsView_contents-noScrollable":!e.unref(a).scrollable})},[r.value?(e.openBlock(),e.createBlock(m.TopLoadbar$1,{key:0})):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.KeepAlive,null,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(a).component),{ref_key:"componentRef",ref:u},null,512))],1024))],2)],2))}}),A={},q={class:"top-tabsView_menuDelimeter"};function F(o,n){return e.openBlock(),e.createElementBlock("div",q)}const U=m._export_sfc(A,[["render",F]]),W=e.defineComponent({__name:"menuTitle",props:{isSubtitle:{type:Boolean}},setup(o){const n=w();return(t,a)=>e.unref(n).showMenuInPopup?(e.openBlock(),e.createBlock(e.unref(S.TopPopupListItem),{key:0,type:"title"},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default")]),_:3})):e.unref(n).isShort?(e.openBlock(),e.createBlock(U,{key:1})):(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass({"top-tabsView_menuTitle":!0,"top-tabsView_menuTitle-subtitle":t.isSubtitle})},[e.renderSlot(t.$slots,"default")],2))}}),J=j,G=v,Q=W;h.TopTabsView=J,h.TopTabsViewMenuItem=G,h.TopTabsViewMenuTitle=Q,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
|
|
2
2
|
//# sourceMappingURL=tabsView.amd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabsView.amd.js","sources":["../../src/core/utils/store/localStorage.ts","../../src/components/tabsView/tabsView/store.ts","../../src/components/tabsView/tabsView/menuItem.vue","../../src/components/tabsView/tabsView/utils.ts","../../src/components/tabsView/tabsView/menu.vue","../../src/components/tabsView/tabsView/tabsView.vue","../../src/components/tabsView/tabsView/menuDelimeter.vue","../../src/components/tabsView/tabsView/menuTitle.vue","../../src/components/tabsView/tabsView.ts"],"sourcesContent":["import { watch } from 'vue';\nimport type { Store } from './store';\n\n/**\n * Сгенерировать имя для сохранения данных в localStorage\n * @param stateName - имя свойства состояния\n * @param stateKey - ключ состояния, разные компоненты могут использовать одинаковый ключ\n */\nconst genStorageKey = <T extends Store>(stateName: keyof T, stateKey: string): string => {\n\tconst stateNameString = String(stateName);\n\n\treturn `top:${stateNameString}:${stateKey}`;\n};\n\n/**\n * Загрузить состояние\n * @param stateName - имя свойства состояния\n * @param store\n */\nconst loadLocalStorge = <T extends Store>(stateName: keyof T, store: T) => {\n\t// если Store.key не знадан, значит сохранение состояния в компоненте отключено\n\tif (!store.$id) return;\n\n\tconst localStorageKey = genStorageKey(stateName, store.$id);\n\n\ttry {\n\t\tconst localStorageValue: typeof store[keyof typeof store] = JSON.parse(localStorage.getItem(localStorageKey) as string);\n\n\t\tif (typeof localStorageValue === typeof store[stateName]) {\n\t\t\tstore[stateName] = localStorageValue;\n\t\t}\n\t} catch (e) {\n\t\tconsole.warn(new Error(`В localStorage[${localStorageKey}] не корректный json`));\n\t}\n};\n\n/**\n * Добавить автосохранение состояние при его изменении\n * @param stateName - имя свойства состояния\n * @param store\n */\nconst addSaverLocalStorge = <T extends Store>(stateName: keyof T, store: T) => {\n\t// если store.$id не знадан, значит сохранение состояния в компоненте отключено\n\tif (!store.$id) return;\n\n\tconst localStorageKey = genStorageKey(stateName, store.$id);\n\n\twatch(() => store[stateName], () => {\n\t\tlocalStorage.setItem(localStorageKey, JSON.stringify(store[stateName]));\n\t}, { immediate: true });\n};\n\nexport default {\n\tloadLocalStorge,\n\taddSaverLocalStorge,\n};","import type { InjectionKey, ModelRef } from 'vue';\nimport { computed, ref } from 'vue';\nimport Core from '@/core/core/core';\nimport { defineStore, useStore } from '@/core/utils/store';\nimport StoreLocalStorage from '@/core/utils/store/localStorage';\nimport type { Props, Store } from './tabsView';\nimport { getHash } from '@/core/utils/route';\n\nconst popstateCallbacks = new Set<(e: PopStateEvent) => void>();\n\naddEventListener('popstate', (e) => {\n\tpopstateCallbacks.forEach(popstateCallback => popstateCallback(e));\n});\n\nexport const injectionKey = Symbol() as InjectionKey<Store>;\n\n/**\n * Инициировать Store компонента\n */\nexport const defineTabsStore = (props: Props, model: ModelRef<string | undefined>) => {\n\tconst store = defineStore(injectionKey, () => {\n\t\tconst showMenuInPopup = computed(() => props.showMenuInPopup ?? Core.state.isMobile);\n\t\tconst pageMod = computed(() => props.pageMod);\n\t\tconst isShort = ref(false);\n\n\t\tconst component = ref(undefined);\n\t\tconst scrollable = ref(true);\n\n\t\treturn {\n\t\t\tshowMenuInPopup,\n\t\t\tpageMod,\n\t\t\tisShort,\n\t\t\tactiveItemName: model,\n\t\t\tcomponent,\n\t\t\tscrollable,\n\t\t};\n\t}, props.idState);\n\n\tif (props.isShortable) {\n\t\tconst stateName = 'isShort';\n\n\t\tStoreLocalStorage.loadLocalStorge(stateName, store);\n\t\tStoreLocalStorage.addSaverLocalStorge(stateName, store);\n\t}\n\n\tif (store.$id) {\n\t\tconst popstateCallback = (e: PopStateEvent) => {\n\t\t\tmodel.value = getHash(store.$id!);\n\t\t};\n\n\t\tpopstateCallbacks.add(popstateCallback);\n\t}\n\n\treturn store;\n};\n\n/**\n * Получить Store компонента\n */\nexport const useTabsStore = () => useStore(injectionKey);\n","<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport { genHash } from '@/core/utils/route';\nimport { TopPopupListItem } from '@/components/popup/popup';\nimport { useTabsStore } from './store';\nimport type { PropsMenuItem } from './tabsView';\n\nconst props = withDefaults(defineProps<PropsMenuItem>(), {\n\tscrollable: true,\n\tcomponent: undefined,\n});\n\nconst store = useTabsStore();\n\nconst href = computed(() => {\n\t// это внутренняя хеш навигация, ссылка на вкладку\n\tif (props.name && store.$id) {\n\t\treturn genHash(store.$id, props.name);\n\t}\n\n\treturn props.href;\n});\n\nconst tagName = computed(() => {\n\tif (store.showMenuInPopup) {\n\t\treturn TopPopupListItem;\n\t}\n\n\treturn href ? 'a' : 'button';\n});\n\n/**\n * Клик по элементу меню\n */\nconst onClick = (e: MouseEvent) => {\n\t// это внутренняя хеш навигация, ссылка на вкладку\n\tif (!props.href && href.value) {\n\t\te.preventDefault();\n\t}\n\n\tif (props.name) {\n\t\tstore.activeItemName = props.name;\n\t}\n};\n</script>\n\n<template>\n\t<component\n\t\t:is=\"tagName\"\n\t\ttarget=\"_self\"\n\t\t:class=\"{\n\t\t\t['top-tabsView_menuItem']: !store.showMenuInPopup,\n\t\t\t['top-active']: name && store.activeItemName === name,\n\t\t\t['top-disabled']: disabled,\n\t\t\t['top-spa-disabled']: true,\n\t\t}\"\n\t\t:href=\"href\"\n\t\t:data-top-icon=\"icon || undefined\"\n\t\t:disabled=\"disabled || undefined\"\n\t\t@click=\"onClick\"\n\t>\n\t\t<slot v-if=\"store.showMenuInPopup\"></slot>\n\n\t\t<span\n\t\t\tv-else-if=\"$slots.default && !store.isShort\"\n\t\t\tclass=\"top-ellipsis\"\n\t\t>\n\t\t\t<slot></slot>\n\t\t</span>\n\t</component>\n</template>\n\n<style>\n.top-tabsView_menuItem {\n\t--top-icon-color: var(--color-text-2);\n\t--top-icon-width: calc(var(--top-icon-size));\n\n\tcursor: pointer;\n\tbox-sizing: border-box;\n\n\tborder: none;\n\tborder-radius: var(--top-radius-2);\n\tpadding: var(--top-padding-2);\n\tbackground: transparent;\n\theight: 40px;\n\n\tcolor: var(--color-text-1);\n\ttext-decoration: none;\n\twhite-space: nowrap;\n\n\tdisplay: flex;\n\tgap: var(--top-gap-2);\n\talign-items: center;\n\tjustify-content: flex-start;\n\ttransition: background var(--transition);\n}\n\n.top-tabsView_menuItem:hover {\n\t--top-icon-color: var(--color-text-1);\n\n\tbackground: var(--color-bg-shading-1);\n\ttext-decoration: none;\n}\n\n.top-tabsView_menuItem.top-active {\n\t--top-icon-color: inherit;\n\n\tbackground: var(--color-layout-front-1);\n\tcolor: inherit;\n}\n\n.top-tabsView_menuItem:disabled:not(option):not(optgroup):not(.top-forms-option),\n.top-tabsView_menuItem:disabled ~ .top-formsCaption,\n.top-tabsView_menuItem.top-disabled[data-top-icon]:before,\n.top-tabsView_menuItem.top-disabled[data-top-icon2]:after {\n\topacity: unset;\n\tfilter: unset;\n}\n\n.top-tabsView_menuItem.top-disabled {\n\t--top-icon-color: var(--color-text-4);\n\n\tcolor: var(--color-text-4);\n}\n</style>\n","// TODO: Эту функцию можно вынести в глобальный utils\n\nimport { sleepWhile } from '@/core/utils/system';\n\n/**\n * Проверка нахождения компонента в состояние загрузки\n * @param component\n */\nexport const checkComponentIsLoading = (component: any) => {\n\treturn component?.name === 'AsyncComponentWrapper' && !component?.__asyncResolved;\n};\n\n/**\n * Презагрузить компонент\n *\n * Некоторое время ожидает загрузку компонента, прежде чем завершит работу\n */\nexport const preResolveComponent = async (component: any, condition: Function) => {\n\tif (component?.name !== 'AsyncComponentWrapper') return;\n\tif (component?.__asyncResolved) return;\n\n\tcomponent.__asyncLoader();\n\n\tawait sleepWhile(() => {\n\t\treturn condition() && checkComponentIsLoading(component);\n\t}, 200);\n};\n","<script setup lang=\"ts\">\nimport type { Ref, VNode } from 'vue';\nimport { markRaw, onMounted, onUnmounted, ref, useSlots, watch } from 'vue';\nimport { TopPopup } from '../../popup/popup';\nimport { getHash, setHash } from '@/core/utils/route';\n\nimport type { MenuItem, PropsMenu, PropsMenuItem } from './tabsView';\nimport { useTabsStore } from './store';\nimport TabsViewMenuItem from './menuItem.vue';\nimport { preResolveComponent } from './utils';\n\ndefineProps<PropsMenu>();\n\nconst isLoading = defineModel('isLoading');\n\nconst store = useTabsStore();\n\nconst slots = useSlots();\n\n// словарь используется для оптимизации получения нужного menuItem\nconst menuItemByName: Map<PropsMenuItem['name'], MenuItem> = new Map();\n\n// заполнить словарь с menuItem, по элементам в slot default\nconst setMenuItemByName = () => {\n\tif (!slots.default) return;\n\n\tconst component: any = slots.default().find(item => item.key === '_menu');\n\tif (!component) return;\n\n\tsetMenuItemByNameFromItems(component.children);\n};\n\n// заполнить словарь с menuItem, по элементам\nconst setMenuItemByNameFromItems = (menuItems: VNode[]) => {\n\tmenuItems.forEach((subComponent: any) => {\n\t\t// это не компонент элемента меню\n\t\tif (subComponent.type.__name && subComponent.type.__name !== TabsViewMenuItem.__name) return;\n\n\t\t// это не компонент, например template\n\t\tif (!subComponent.type.__name && typeof subComponent.children === 'object') {\n\t\t\tsetMenuItemByNameFromItems(subComponent.children);\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (!subComponent.props?.name || subComponent.props?.disabled) return;\n\n\t\tconst menuItem: MenuItem = {\n\t\t\ttitle: (subComponent.children.default?.()[0].children as string).trim(),\n\t\t\ticon: subComponent.props.icon,\n\t\t\tcomponent: subComponent.props.component ? markRaw(subComponent.props.component) : TabsViewMenuItem.props.component.default,\n\t\t\tscrollable: subComponent.props.scrollable ?? TabsViewMenuItem.props.scrollable.default,\n\t\t};\n\n\t\tmenuItemByName.set(subComponent.props.name, menuItem);\n\t});\n};\n\n/**\n * activeMenuItem нужен:\n * - для вывода текста активной вкладки в меню с popup\n * - для вывода компонента активной вкладки (store.component)\n * - для установки store.scrollable\n */\nconst activeMenuItem: Ref<MenuItem | null> = ref(null);\n\n/**\n * Кол-во изменений активной вкладки\n */\nlet countChanged = 0;\n\n/**\n * Смена активной вкладки\n *\n * TODO: смена slot, например смена языка, требует повторного выполнения setMenuItemByName()\n */\nwatch(\n\t() => store.activeItemName,\n\tasync () => {\n\t\tconst numberChanged = ++countChanged; // порядковый номер текущего изменения\n\n\t\tif (menuItemByName.size === 0) {\n\t\t\tsetMenuItemByName();\n\t\t}\n\n\t\tif (menuItemByName.size === 0) {\n\t\t\tstore.activeItemName = '';\n\n\t\t\treturn;\n\t\t}\n\n\t\tactiveMenuItem.value = menuItemByName.get(store.activeItemName) ?? null;\n\n\t\t// элемент не найден, установить из хеша страницы\n\t\tif (!activeMenuItem.value && store.$id) {\n\t\t\tconst activeItemName = getHash(store.$id);\n\n\t\t\tactiveMenuItem.value = menuItemByName.get(activeItemName) ?? null;\n\n\t\t\tif (activeMenuItem.value) {\n\t\t\t\tstore.activeItemName = activeItemName;\n\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// элемент не найден, установить первый доступный\n\t\tif (!activeMenuItem.value) {\n\t\t\tstore.activeItemName = menuItemByName.keys().next().value!;\n\n\t\t\treturn;\n\t\t}\n\n\t\t// запрошена смена на уже активный элемент\n\t\tif (activeMenuItem.value.component === store.component) {\n\t\t\tisLoading.value = false;\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (store.$id) setHash(store.$id, store.activeItemName, false);\n\n\t\t// флаг загрузки будет сброшен при инициализации компонента\n\t\tisLoading.value = true;\n\n\t\t/**\n\t\t * Презагрузить компонент\n\t\t *\n\t\t * Нужно для того, чтобы минимизировать скачки интерфейса при ожидании загрузки асинхронного компонента\n\t\t */\n\t\tawait preResolveComponent(activeMenuItem.value.component, () => numberChanged === countChanged);\n\n\t\t// влкадка была сменена еще раз во время sleepWhile\n\t\tif (numberChanged !== countChanged) {\n\t\t\treturn;\n\t\t}\n\n\t\tstore.scrollable = activeMenuItem.value.scrollable;\n\t\tstore.component = activeMenuItem.value.component;\n\n\t\tif (activeMenuItem.value && !store.component) {\n\t\t\tconsole.warn(`Компонент вкладки ${store.activeItemName} не найден. Добавьте props.component для пункта меню ${store.activeItemName}.`);\n\t\t}\n\t},\n\t{ immediate: true },\n);\n\nconst elRef = ref();\nlet resizeObserver: ResizeObserver;\n\nonMounted(() => {\n\tresizeObserver = new ResizeObserver(() => {\n\t\telRef.value.parentElement.style.setProperty('--top-tabsView-contents-offset-top', elRef.value.offsetHeight + 'px');\n\t});\n\n\tresizeObserver.observe(elRef.value);\n});\n\nonUnmounted(() => {\n\tresizeObserver.disconnect();\n});\n</script>\n\n<template>\n\t<div\n\t\tref=\"elRef\"\n\t\t:class=\"{\n\t\t\t'top-tabsView_menu': true,\n\t\t\t'top-tabsView_menu-inPopup_0': !store.showMenuInPopup,\n\t\t\t'top-tabsView_menu-inPopup_1': store.showMenuInPopup,\n\t\t\t'top-tabsView_menu-short': store.isShort && !store.showMenuInPopup,\n\t\t}\"\n\t>\n\t\t<!-- Спрятать меню под кнопку в popup -->\n\t\t<TopPopup v-if=\"store.showMenuInPopup\">\n\t\t\t<template #opener>\n\t\t\t\t<div class=\"top-tabsView_menuOpener\">\n\t\t\t\t\t<div\n\t\t\t\t\t\tv-if=\"activeMenuItem\"\n\t\t\t\t\t\tclass=\"top-tabsView_menuOpenerActiveItem\"\n\t\t\t\t\t\t:data-top-icon=\"activeMenuItem.icon\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<span class=\"top-ellipsis\">\n\t\t\t\t\t\t\t{{ activeMenuItem.title }}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div class=\"top-tabsView_menuOpenerIcon\" data-top-icon=\"\"></div>\n\t\t\t\t</div>\n\t\t\t</template>\n\n\t\t\t<template #contentList>\n\t\t\t\t<slot></slot>\n\t\t\t</template>\n\t\t</TopPopup>\n\n\t\t<!-- Отобразить меню на странице -->\n\t\t<template v-else>\n\t\t\t<div class=\"top-tabsView_menuList\">\n\t\t\t\t<slot></slot>\n\t\t\t</div>\n\n\t\t\t<div\n\t\t\t\tv-if=\"isShortable\"\n\t\t\t\tclass=\"top-tabsView_menuFooter\"\n\t\t\t>\n\t\t\t\t<TabsViewMenuItem\n\t\t\t\t\tv-if=\"isShortable\"\n\t\t\t\t\t:icon=\"store.isShort ? '' : ''\"\n\t\t\t\t\t@click=\"store.isShort = !store.isShort\"\n\t\t\t\t>\n\t\t\t\t\t{{ store.isShort ? '' : 'Свернуть' }} <!--TODO: translate-->\n\t\t\t\t</TabsViewMenuItem>\n\t\t\t</div>\n\t\t</template>\n\t</div>\n</template>\n\n<style>\n/* режим отображение табов в основной области документа */\n.top-tabsView-pageMod .top-tabsView_menu {\n\tbox-sizing: border-box;\n\tposition: sticky;\n\ttop: var(--top-tabsView-top);\n\tz-index: 10;\n}\n\n/* режим отображение табов в основной области документа без popup */\n.top-tabsView-pageMod .top-tabsView_menu-inPopup_0 {\n\theight: calc(var(--100vh) - var(--top-tabsView-top));\n}\n\n/* стантартный режим */\n.top-tabsView_menu-inPopup_0 {\n\tbox-sizing: border-box;\n\twidth: var(--top-tabsView-menu-width);\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\tflex-shrink: 0;\n}\n\n/* режим вывода в popup */\n.top-tabsView_menu-inPopup_1 {\n\tborder-bottom: 1px solid var(--color-line-2-opacity);\n}\n\n.top-tabsView_menu-short {\n\twidth: auto;\n}\n\n.top-tabsView_menu > .top-tabsView_menuOpener {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n}\n\n.top-tabsView_menu > .top-tabsView_menuOpener:hover {\n\tbackground: var(--color-layer-1);\n}\n\n.top-tabsView_menuOpenerIcon { display: flex; }\n\n.top-tabsView_menuOpenerActiveItem {\n\t--top-forms-padding: 0px;\n\n\tbox-sizing: border-box;\n\tpadding: var(--top-padding-2);\n\tmax-width: calc(100% - var(--top-forms-base-height));\n\twhite-space: nowrap;\n\tflex-grow: 1;\n\tdisplay: flex;\n\talign-items: center;\n\tgap: var(--top-padding-2);\n}\n\n.top-tabsView_menuList,\n.top-tabsView_menuFooter {\n\tpadding: var(--top-padding-2);\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: var(--top-gap-2);\n}\n\n.top-tabsView_menuList {\n\toverflow-y: auto;\n}\n\n.top-tabsView_menu-short .top-tabsView_menuFooter > .top-tabsView_menuItem {\n\t--top-icon-width: 100%;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { defineModel, onMounted, onUnmounted, ref, watch } from 'vue';\nimport Core from '@/core/core/core';\nimport { delHash } from '@/core/utils/route';\nimport type { Props } from './tabsView';\nimport { defineTabsStore } from './store';\nimport TabsViewMenu from './menu.vue';\nimport TopLoadbar from '@/components/forms/loadbar/loadbar.vue';\nimport { checkComponentIsLoading } from './utils';\n\nconst props = withDefaults(defineProps<Props>(), {\n\tshowMenuInPopup: undefined,\n\tisShortable: false,\n});\n\nconst model = defineModel<string>();\n\nconst store = defineTabsStore(props, model);\n\nconst uid = Math.random();\n\nif (props.pageMod) Core.state.documentClassModificators.set(uid, 'top-hasTabsViewPageMod');\n\nonUnmounted(() => {\n\tif (props.pageMod) Core.state.documentClassModificators.delete(uid);\n\n\tif (store.$id) delHash(store.$id, store.activeItemName, true);\n});\n\nconst componentRef = ref();\nconst isLoading = ref(false);\n\nwatch([componentRef, () => store.component], () => {\n\tisLoading.value = checkComponentIsLoading(store.component);\n}, { immediate: true });\n</script>\n\n<template>\n\t<div\n\t\t:class=\"{\n\t\t\t'top-tabsView': true,\n\t\t\t'top-tabsView-pageMod': props.pageMod,\n\t\t\t'top-tabsView-inPopup': store.showMenuInPopup,\n\t\t}\"\n\t>\n\t\t<TabsViewMenu\n\t\t\t:isShortable=\"isShortable\"\n\t\t\tv-model:isLoading=\"isLoading\"\n\t\t>\n\t\t\t<!-- @slot Меню, ожидает передачу компонентов TabsViewMenuItem и TabsViewMenuTitle -->\n\t\t\t<slot name=\"menu\"></slot>\n\t\t</TabsViewMenu>\n\n\t\t<div\n\t\t\t:class=\"{\n\t\t\t\t'top-tabsView_contents': true,\n\t\t\t\t'top-tabsView_contents-isLoading': isLoading,\n\t\t\t\t'top-tabsView_contents-noScrollable': !store.scrollable,\n\t\t\t}\"\n\t\t>\n\t\t\t<TopLoadbar v-if=\"isLoading\"/>\n\n\t\t\t<keep-alive>\n\t\t\t\t<component\n\t\t\t\t\tref=\"componentRef\"\n\t\t\t\t\t:is=\"store.component\"\n\t\t\t\t/>\n\t\t\t</keep-alive>\n\t\t</div>\n\t</div>\n</template>\n\n<style>\n:root {\n\t--top-tabsView-top: 0px;\n\t--top-tabsView-menu-width: 220px;\n\t--top-tabsView-contents-offset-top: 0px;\n}\n\n.top-tabsView {\n\tbackground: var(--color-layout-middle);\n\twidth: 100%;\n\theight: 100%;\n\tdisplay: flex;\n\tflex-direction: row;\n}\n\n.top-tabsView_contents {\n\tborder-radius: var(--top-radius-4);\n\tbackground: var(--color-layout-front-1);\n\tpadding: var(--top-padding-4);\n\tflex-grow: 1;\n\toverflow: auto;\n\tposition: relative;\n}\n\n.top-tabsView_contents-isLoading {\n\tpointer-events: none;\n}\n\n.top-tabsView_contents-noScrollable {\n\twidth: calc(100% - var(--top-tabsView-menu-width));\n\tpadding: 0;\n\toverflow: visible;\n}\n\n/* top-tabsView-inPopup */\n.top-tabsView-inPopup {\n\tbackground: var(--color-layout-front-1);\n\tflex-direction: column;\n}\n\n.top-tabsView-inPopup > .top-tabsView_contents {\n\tborder-radius: 0;\n}\n\n.top-tabsView-inPopup > .top-tabsView_contents-noScrollable {\n\twidth: auto;\n}\n</style>\n","<script setup lang=\"ts\">\n\n</script>\n\n<template>\n\t<div class=\"top-tabsView_menuDelimeter\"></div>\n</template>\n\n<style>\n.top-tabsView_menuDelimeter {\n\tpadding: var(--top-padding-1) 0;\n\tdisplay: flex;\n}\n\n.top-tabsView_menuDelimeter:before {\n\tcontent: \"\";\n\theight: 2px;\n\tbackground: var(--color-line-2);\n\tflex-grow: 1;\n}\n\n.top-tabsView_menuDelimeter:first-child,\n.top-tabsView_menuDelimeter + .top-tabsView_menuDelimeter {\n\tdisplay: none;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { useTabsStore } from './store';\nimport type { PropsMenuTitle } from './tabsView';\nimport TabsViewMenuDelimeter from './menuDelimeter.vue';\nimport { TopPopupListItem } from '../../popup/popup';\n\ndefineProps<PropsMenuTitle>();\n\nconst store = useTabsStore();\n</script>\n\n<template>\n\t<TopPopupListItem\n\t\tv-if=\"store.showMenuInPopup\"\n\t\ttype=\"title\"\n\t>\n\t\t<slot></slot>\n\t</TopPopupListItem>\n\n\t<TabsViewMenuDelimeter v-else-if=\"store.isShort\"/>\n\n\t<div\n\t\tv-else\n\t\t:class=\"{\n\t\t\t'top-tabsView_menuTitle': true,\n\t\t\t'top-tabsView_menuTitle-subtitle': isSubtitle,\n\t\t}\"\n\t>\n\t\t<slot></slot>\n\t</div>\n</template>\n\n<style>\n.top-tabsView_menuTitle {\n\tpadding: var(--top-padding-4) var(--top-padding-2) var(--top-padding-1);\n\tfont-weight: 600;\n\tcolor: var(--color-text-1);\n}\n\n.top-tabsView_menuTitle-subtitle {\n\tpadding-top: var(--top-padding-1);\n\tfont-size: 12px;\n\tfont-weight: 400;\n\tcolor: var(--color-text-2);\n}\n</style>\n","import type { ComponentCustomProps } from 'vue';\n\nimport TabsView from './tabsView/tabsView.vue';\nimport TabsViewMenuItem from './tabsView/menuItem.vue';\nimport TabsViewMenuTitle from './tabsView/menuTitle.vue';\n\nexport const TopTabsView = TabsView as typeof TabsView & ComponentCustomProps;\nexport const TopTabsViewMenuItem = TabsViewMenuItem as typeof TabsViewMenuItem & ComponentCustomProps;\nexport const TopTabsViewMenuTitle = TabsViewMenuTitle as typeof TabsViewMenuTitle & ComponentCustomProps;\n"],"names":["genStorageKey","stateName","stateKey","StoreLocalStorage","store","localStorageValue","localStorageKey","popstateCallbacks","e","defineTabsStore","props","model","store$1","injectionKey","showMenuInPopup","vue","forms","isShort","component","scrollable","pageMod","popstateCallback","useTabsStore","href","tagName","popup_popup","onClick","checkComponentIsLoading","preResolveComponent","condition","slots","menuItemByName","item","setMenuItemByNameFromItems","menuItems","subComponent","_sfc_main$4","_a","_b","_d","_c","activeMenuItem","numberChanged","countChanged","setMenuItemByName","activeItemName","isLoading","utils_route","elRef","resizeObserver","uid","componentRef","_sfc_render","_ctx","_cache","TopTabsView","_sfc_main$2","TopTabsViewMenuItem","TopTabsViewMenuTitle","_sfc_main"],"mappings":"uRAQA,MAAAA,EAAA,CAAAC,EAAAC,WACC,OAAAD,CAAA,SA2CDE,EAAA,CAAe,gBAjCf,CAAAF,EAAAG,IAAA,CAEC,GAAA,CAAAA,EAAA,IAAA,0BAIA,GAAA,CACC,MAAAC,EAAA,KAAA,MAAA,aAAA,QAAAC,CAAA,CAAA,0BAGCF,EAAAH,CAAA,EAAAI,SAGD,QAAA,KAAA,IAAA,MAAA,kBAAAC,CAAA,sBAAA,CAAA,CAA+E,uBASjF,CAAAL,EAAAG,IAAA,CAEC,GAAA,CAAAA,EAAA,IAAA,gDAKC,aAAA,QAAAE,EAAA,KAAA,UAAAF,EAAAH,CAAA,CAAA,CAAA,CAAsE,EAAA,CAAA,UAAA,EAAA,CAAA,ICxCxEM,EAAA,IAAA,IAEA,iBAAA,WAAAC,GAAA,mBAEA,CAAA,mBAOaC,EAAA,CAAAC,EAAAC,IAAA,CACZ,MAAAC,EAAAR,EAAA,YAAAS,EAAA,IAAA,CACC,MAAAC,EAAAC,EAAA,SAAA,IAAAL,EAAA,iBAAAM,EAAA,KAAA,MAAA,QAAA,8BAEAC,EAAAF,EAAA,IAAA,EAAA,EAEAG,EAAAH,EAAA,IAAA,MAAA,EACAI,EAAAJ,EAAA,IAAA,EAAA,EAEA,MAAA,CAAO,gBAAAD,EACN,QAAAM,EACA,QAAAH,mBAEgB,UAAAC,eAGjB,EAAAR,EAAA,OAAA,EAGD,GAAAA,EAAA,YAAA,mBAGCP,EAAA,gBAAAF,EAAAW,CAAA,EACAT,EAAA,oBAAAF,EAAAW,CAAA,CAAsD,CAGvD,GAAAA,EAAA,IAAA,CACC,MAAAS,EAAAb,GAAA,2BAIAD,EAAA,IAAAc,CAAA,CAAsC,CAGvC,OAAAT,GAMYU,EAAA,IAAAlB,EAAA,SAAAS,CAAA,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EAAA,IAAA3B,EAAA,cAAA,GAAA,+CAQC,0BAAAqC,EAAA,MAAA,CACCrC,EAAA,eAAAyC,QAEA,CACD,CAID,GAAA,CAAAJ,EAAA,MAAA,CACCrC,EAAA,eAAA2B,EAAA,KAAA,EAAA,KAAA,EAAA,YAEA,qCAKAe,EAAA,MAAA,SAEA,CAGD1C,EAAA,KAAA2C,EAAA,QAAA3C,EAAA,IAAAA,EAAA,eAAA,EAAA,EAGA0C,EAAA,MAAA,GAOA,MAAAlB,EAAAa,EAAA,MAAA,UAAA,IAAAC,IAAAC,CAAA,EAGAD,IAAAC,yFAQC,QAAA,KAAA,qBAAAvC,EAAA,cAAA,wDAAAA,EAAA,cAAA,GAAA,oBAMH,MAAA4C,EAAAjC,EAAA,IAAA,EACA,IAAAkC,0BAGCA,EAAA,IAAA,eAAA,IAAA,CACCD,EAAA,MAAA,cAAA,MAAA,YAAA,qCAAAA,EAAA,MAAA,aAAA,IAAA,CAAiH,CAAA,EAGlHC,EAAA,QAAAD,EAAA,KAAA,CAAkC,CAAA,mCAIR,CAAA,6pDC5I3BE,EAAA,KAAA,OAAA,EAEAxC,EAAA,SAAAM,EAAA,KAAA,MAAA,0BAAA,IAAAkC,EAAA,wBAAA,qBAGCxC,EAAA,SAAAM,EAAA,KAAA,MAAA,0BAAA,OAAAkC,CAAA,EAEA9C,EAAA,KAAA2C,EAAA,QAAA3C,EAAA,IAAAA,EAAA,eAAA,EAAA,CAA4D,CAAA,EAG7D,MAAA+C,EAAApC,EAAA,IAAA,EACA+B,EAAA/B,EAAA,IAAA,EAAA,gEAG0D,EAAA,CAAA,UAAA,EAAA,CAAA,u3BC5BzD,SAAAqC,EAAAC,EAAAC,EAAA,+KCGD,MAAAlD,EAAAkB,EAAA,ubCFOiC,EAAAC,EACAC,EAAArB,EACAsB,EAAAC"}
|
|
1
|
+
{"version":3,"file":"tabsView.amd.js","sources":["../../src/core/utils/store/localStorage.ts","../../src/components/tabsView/tabsView/store.ts","../../src/components/tabsView/tabsView/menuItem.vue","../../src/components/tabsView/tabsView/utils.ts","../../src/components/tabsView/tabsView/menu.vue","../../src/components/tabsView/tabsView/tabsView.vue","../../src/components/tabsView/tabsView/menuDelimeter.vue","../../src/components/tabsView/tabsView/menuTitle.vue","../../src/components/tabsView/tabsView.ts"],"sourcesContent":["import { watch } from 'vue';\nimport type { Store } from './store';\n\n/**\n * Сгенерировать имя для сохранения данных в localStorage\n * @param stateName - имя свойства состояния\n * @param stateKey - ключ состояния, разные компоненты могут использовать одинаковый ключ\n */\nconst genStorageKey = <T extends Store>(stateName: keyof T, stateKey: string): string => {\n\tconst stateNameString = String(stateName);\n\n\treturn `top:${stateNameString}:${stateKey}`;\n};\n\n/**\n * Загрузить состояние\n * @param stateName - имя свойства состояния\n * @param store\n */\nconst loadLocalStorge = <T extends Store>(stateName: keyof T, store: T) => {\n\t// если Store.key не знадан, значит сохранение состояния в компоненте отключено\n\tif (!store.$id) return;\n\n\tconst localStorageKey = genStorageKey(stateName, store.$id);\n\n\ttry {\n\t\tconst localStorageValue: typeof store[keyof typeof store] = JSON.parse(localStorage.getItem(localStorageKey) as string);\n\n\t\tif (typeof localStorageValue === typeof store[stateName]) {\n\t\t\tstore[stateName] = localStorageValue;\n\t\t}\n\t} catch (e) {\n\t\tconsole.warn(new Error(`В localStorage[${localStorageKey}] не корректный json`));\n\t}\n};\n\n/**\n * Добавить автосохранение состояние при его изменении\n * @param stateName - имя свойства состояния\n * @param store\n */\nconst addSaverLocalStorge = <T extends Store>(stateName: keyof T, store: T) => {\n\t// если store.$id не знадан, значит сохранение состояния в компоненте отключено\n\tif (!store.$id) return;\n\n\tconst localStorageKey = genStorageKey(stateName, store.$id);\n\n\twatch(() => store[stateName], () => {\n\t\tlocalStorage.setItem(localStorageKey, JSON.stringify(store[stateName]));\n\t}, { immediate: true });\n};\n\nexport default {\n\tloadLocalStorge,\n\taddSaverLocalStorge,\n};","import type { InjectionKey, ModelRef } from 'vue';\nimport { computed, ref } from 'vue';\nimport Core from '@/core/core/core';\nimport { defineStore, useStore } from '@/core/utils/store';\nimport StoreLocalStorage from '@/core/utils/store/localStorage';\nimport type { Props, Store } from './tabsView';\nimport { getHash } from '@/core/utils/route';\n\nconst popstateCallbacks = new Set<(e: PopStateEvent) => void>();\n\naddEventListener('popstate', (e) => {\n\tpopstateCallbacks.forEach(popstateCallback => popstateCallback(e));\n});\n\nexport const injectionKey = Symbol() as InjectionKey<Store>;\n\n/**\n * Инициировать Store компонента\n */\nexport const defineTabsStore = (props: Props, model: ModelRef<string | undefined>) => {\n\tconst store = defineStore(injectionKey, () => {\n\t\tconst showMenuInPopup = computed(() => props.showMenuInPopup ?? Core.state.isMobile);\n\t\tconst pageMod = computed(() => props.pageMod);\n\t\tconst isShort = ref(false);\n\n\t\tconst component = ref(undefined);\n\t\tconst scrollable = ref(true);\n\n\t\treturn {\n\t\t\tshowMenuInPopup,\n\t\t\tpageMod,\n\t\t\tisShort,\n\t\t\tactiveItemName: model,\n\t\t\tcomponent,\n\t\t\tscrollable,\n\t\t};\n\t}, props.idState);\n\n\tif (props.isShortable) {\n\t\tconst stateName = 'isShort';\n\n\t\tStoreLocalStorage.loadLocalStorge(stateName, store);\n\t\tStoreLocalStorage.addSaverLocalStorge(stateName, store);\n\t}\n\n\tif (store.$id) {\n\t\tconst popstateCallback = (e: PopStateEvent) => {\n\t\t\tmodel.value = getHash(store.$id!);\n\t\t};\n\n\t\tpopstateCallbacks.add(popstateCallback);\n\t}\n\n\treturn store;\n};\n\n/**\n * Получить Store компонента\n */\nexport const useTabsStore = () => useStore(injectionKey);\n","<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport { genHash } from '@/core/utils/route';\nimport { TopPopupListItem } from '@/components/popup/popup';\nimport { useTabsStore } from './store';\nimport type { PropsMenuItem } from './tabsView';\n\nconst props = withDefaults(defineProps<PropsMenuItem>(), {\n\tscrollable: true,\n\tcomponent: undefined,\n});\n\nconst store = useTabsStore();\n\nconst href = computed(() => {\n\t// это внутренняя хеш навигация, ссылка на вкладку\n\tif (props.name && store.$id) {\n\t\treturn genHash(store.$id, props.name);\n\t}\n\n\treturn props.href;\n});\n\nconst tagName = computed(() => {\n\tif (store.showMenuInPopup) {\n\t\treturn TopPopupListItem;\n\t}\n\n\treturn href ? 'a' : 'button';\n});\n\n/**\n * Клик по элементу меню\n */\nconst onClick = (e: MouseEvent) => {\n\t// это внутренняя хеш навигация, ссылка на вкладку\n\tif (!props.href && href.value) {\n\t\te.preventDefault();\n\t}\n\n\tif (props.name) {\n\t\tstore.activeItemName = props.name;\n\t}\n};\n</script>\n\n<template>\n\t<component\n\t\t:is=\"tagName\"\n\t\ttarget=\"_self\"\n\t\t:class=\"{\n\t\t\t['top-tabsView_menuItem']: !store.showMenuInPopup,\n\t\t\t['top-active']: name && store.activeItemName === name,\n\t\t\t['top-disabled']: disabled,\n\t\t\t['top-spa-disabled']: true,\n\t\t}\"\n\t\t:href=\"href\"\n\t\t:data-top-icon=\"icon || undefined\"\n\t\t:disabled=\"disabled || undefined\"\n\t\t@click=\"onClick\"\n\t>\n\t\t<slot name=\"default\" v-if=\"store.showMenuInPopup\"></slot>\n\n\t\t<span\n\t\t\tv-else-if=\"$slots.default && !store.isShort\"\n\t\t\tclass=\"top-ellipsis\"\n\t\t>\n\t\t\t<slot name=\"default\"></slot>\n\t\t</span>\n\t</component>\n</template>\n\n<style>\n.top-tabsView_menuItem {\n\t--top-icon-color: var(--color-text-2);\n\t--top-icon-width: calc(var(--top-icon-size));\n\n\tcursor: pointer;\n\tbox-sizing: border-box;\n\n\tborder: none;\n\tborder-radius: var(--top-radius-2);\n\tpadding: var(--top-padding-2);\n\tbackground: transparent;\n\theight: 40px;\n\n\tcolor: var(--color-text-1);\n\ttext-decoration: none;\n\twhite-space: nowrap;\n\n\tdisplay: flex;\n\tgap: var(--top-gap-2);\n\talign-items: center;\n\tjustify-content: flex-start;\n\ttransition: background var(--transition);\n}\n\n.top-tabsView_menuItem:hover {\n\t--top-icon-color: var(--color-text-1);\n\n\tbackground: var(--color-bg-shading-1);\n\ttext-decoration: none;\n}\n\n.top-tabsView_menuItem.top-active {\n\t--top-icon-color: inherit;\n\n\tbackground: var(--color-layout-front-1);\n\tcolor: inherit;\n}\n\n.top-tabsView_menuItem:disabled:not(option):not(optgroup):not(.top-forms-option),\n.top-tabsView_menuItem:disabled ~ .top-formsCaption,\n.top-tabsView_menuItem.top-disabled[data-top-icon]:before,\n.top-tabsView_menuItem.top-disabled[data-top-icon2]:after {\n\topacity: unset;\n\tfilter: unset;\n}\n\n.top-tabsView_menuItem.top-disabled {\n\t--top-icon-color: var(--color-text-4);\n\n\tcolor: var(--color-text-4);\n}\n</style>\n","// TODO: Эту функцию можно вынести в глобальный utils\n\nimport { sleepWhile } from '@/core/utils/system';\n\n/**\n * Проверка нахождения компонента в состояние загрузки\n * @param component\n */\nexport const checkComponentIsLoading = (component: any) => {\n\treturn component?.name === 'AsyncComponentWrapper' && !component?.__asyncResolved;\n};\n\n/**\n * Презагрузить компонент\n *\n * Некоторое время ожидает загрузку компонента, прежде чем завершит работу\n */\nexport const preResolveComponent = async (component: any, condition: Function) => {\n\tif (component?.name !== 'AsyncComponentWrapper') return;\n\tif (component?.__asyncResolved) return;\n\n\tcomponent.__asyncLoader();\n\n\tawait sleepWhile(() => {\n\t\treturn condition() && checkComponentIsLoading(component);\n\t}, 200);\n};\n","<script setup lang=\"ts\">\nimport type { Ref, VNode } from 'vue';\nimport { markRaw, onMounted, onUnmounted, ref, useSlots, watch } from 'vue';\nimport { TopPopup } from '../../popup/popup';\nimport { getHash, setHash } from '@/core/utils/route';\n\nimport type { MenuItem, PropsMenu, PropsMenuItem } from './tabsView';\nimport { useTabsStore } from './store';\nimport TabsViewMenuItem from './menuItem.vue';\nimport { preResolveComponent } from './utils';\n\ndefineProps<PropsMenu>();\n\nconst isLoading = defineModel('isLoading');\n\nconst store = useTabsStore();\n\nconst slots = useSlots();\n\n// словарь используется для оптимизации получения нужного menuItem\nconst menuItemByName: Map<PropsMenuItem['name'], MenuItem> = new Map();\n\n// заполнить словарь с menuItem, по элементам в slot default\nconst setMenuItemByName = () => {\n\tif (!slots.default) return;\n\n\tconst component: any = slots.default({}).find(item => item.key === '_menu');\n\tif (!component) return;\n\n\tsetMenuItemByNameFromItems(component.children);\n};\n\n// заполнить словарь с menuItem, по элементам\nconst setMenuItemByNameFromItems = (menuItems: VNode[]) => {\n\tmenuItems.forEach((subComponent: any) => {\n\t\t// это не компонент элемента меню\n\t\tif (subComponent.type.__name && subComponent.type.__name !== TabsViewMenuItem.__name) return;\n\n\t\t// это не компонент, например template\n\t\tif (!subComponent.type.__name && typeof subComponent.children === 'object') {\n\t\t\tsetMenuItemByNameFromItems(subComponent.children);\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (!subComponent.props?.name || subComponent.props?.disabled) return;\n\n\t\tconst menuItem: MenuItem = {\n\t\t\ttitle: (subComponent.children.default?.()[0].children as string).trim(),\n\t\t\ticon: subComponent.props.icon,\n\t\t\tcomponent: subComponent.props.component ? markRaw(subComponent.props.component) : TabsViewMenuItem.props.component.default,\n\t\t\tscrollable: subComponent.props.scrollable ?? TabsViewMenuItem.props.scrollable.default,\n\t\t};\n\n\t\tmenuItemByName.set(subComponent.props.name, menuItem);\n\t});\n};\n\n/**\n * activeMenuItem нужен:\n * - для вывода текста активной вкладки в меню с popup\n * - для вывода компонента активной вкладки (store.component)\n * - для установки store.scrollable\n */\nconst activeMenuItem: Ref<MenuItem | null> = ref(null);\n\n/**\n * Кол-во изменений активной вкладки\n */\nlet countChanged = 0;\n\n/**\n * Смена активной вкладки\n *\n * TODO: смена slot, например смена языка, требует повторного выполнения setMenuItemByName()\n */\nwatch(\n\t() => store.activeItemName,\n\tasync () => {\n\t\tconst numberChanged = ++countChanged; // порядковый номер текущего изменения\n\n\t\tif (menuItemByName.size === 0) {\n\t\t\tsetMenuItemByName();\n\t\t}\n\n\t\tif (menuItemByName.size === 0) {\n\t\t\tstore.activeItemName = '';\n\n\t\t\treturn;\n\t\t}\n\n\t\tactiveMenuItem.value = menuItemByName.get(store.activeItemName) ?? null;\n\n\t\t// элемент не найден, установить из хеша страницы\n\t\tif (!activeMenuItem.value && store.$id) {\n\t\t\tconst activeItemName = getHash(store.$id);\n\n\t\t\tactiveMenuItem.value = menuItemByName.get(activeItemName) ?? null;\n\n\t\t\tif (activeMenuItem.value) {\n\t\t\t\tstore.activeItemName = activeItemName;\n\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// элемент не найден, установить первый доступный\n\t\tif (!activeMenuItem.value) {\n\t\t\tstore.activeItemName = menuItemByName.keys().next().value!;\n\n\t\t\treturn;\n\t\t}\n\n\t\t// запрошена смена на уже активный элемент\n\t\tif (activeMenuItem.value.component === store.component) {\n\t\t\tisLoading.value = false;\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (store.$id) setHash(store.$id, store.activeItemName, false);\n\n\t\t// флаг загрузки будет сброшен при инициализации компонента\n\t\tisLoading.value = true;\n\n\t\t/**\n\t\t * Презагрузить компонент\n\t\t *\n\t\t * Нужно для того, чтобы минимизировать скачки интерфейса при ожидании загрузки асинхронного компонента\n\t\t */\n\t\tawait preResolveComponent(activeMenuItem.value.component, () => numberChanged === countChanged);\n\n\t\t// влкадка была сменена еще раз во время sleepWhile\n\t\tif (numberChanged !== countChanged) {\n\t\t\treturn;\n\t\t}\n\n\t\tstore.scrollable = activeMenuItem.value.scrollable;\n\t\tstore.component = activeMenuItem.value.component;\n\n\t\tif (activeMenuItem.value && !store.component) {\n\t\t\tconsole.warn(`Компонент вкладки ${store.activeItemName} не найден. Добавьте props.component для пункта меню ${store.activeItemName}.`);\n\t\t}\n\t},\n\t{ immediate: true },\n);\n\nconst elRef = ref();\nlet resizeObserver: ResizeObserver;\n\nonMounted(() => {\n\tresizeObserver = new ResizeObserver(() => {\n\t\telRef.value.parentElement.style.setProperty('--top-tabsView-contents-offset-top', elRef.value.offsetHeight + 'px');\n\t});\n\n\tresizeObserver.observe(elRef.value);\n});\n\nonUnmounted(() => {\n\tresizeObserver.disconnect();\n});\n</script>\n\n<template>\n\t<div\n\t\tref=\"elRef\"\n\t\t:class=\"{\n\t\t\t'top-tabsView_menu': true,\n\t\t\t'top-tabsView_menu-inPopup_0': !store.showMenuInPopup,\n\t\t\t'top-tabsView_menu-inPopup_1': store.showMenuInPopup,\n\t\t\t'top-tabsView_menu-short': store.isShort && !store.showMenuInPopup,\n\t\t}\"\n\t>\n\t\t<!-- Спрятать меню под кнопку в popup -->\n\t\t<TopPopup v-if=\"store.showMenuInPopup\">\n\t\t\t<template #opener>\n\t\t\t\t<div class=\"top-tabsView_menuOpener\">\n\t\t\t\t\t<div\n\t\t\t\t\t\tv-if=\"activeMenuItem\"\n\t\t\t\t\t\tclass=\"top-tabsView_menuOpenerActiveItem\"\n\t\t\t\t\t\t:data-top-icon=\"activeMenuItem.icon\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<span class=\"top-ellipsis\">\n\t\t\t\t\t\t\t{{ activeMenuItem.title }}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div class=\"top-tabsView_menuOpenerIcon\" data-top-icon=\"\"></div>\n\t\t\t\t</div>\n\t\t\t</template>\n\n\t\t\t<template #contentList>\n\t\t\t\t<slot></slot>\n\t\t\t</template>\n\t\t</TopPopup>\n\n\t\t<!-- Отобразить меню на странице -->\n\t\t<template v-else>\n\t\t\t<div class=\"top-tabsView_menuList\">\n\t\t\t\t<slot></slot>\n\t\t\t</div>\n\n\t\t\t<div\n\t\t\t\tv-if=\"isShortable\"\n\t\t\t\tclass=\"top-tabsView_menuFooter\"\n\t\t\t>\n\t\t\t\t<TabsViewMenuItem\n\t\t\t\t\tv-if=\"isShortable\"\n\t\t\t\t\t:icon=\"store.isShort ? '' : ''\"\n\t\t\t\t\t@click=\"store.isShort = !store.isShort\"\n\t\t\t\t>\n\t\t\t\t\t{{ store.isShort ? '' : 'Свернуть' }} <!--TODO: translate-->\n\t\t\t\t</TabsViewMenuItem>\n\t\t\t</div>\n\t\t</template>\n\t</div>\n</template>\n\n<style>\n/* режим отображение табов в основной области документа */\n.top-tabsView-pageMod .top-tabsView_menu {\n\tbox-sizing: border-box;\n\tposition: sticky;\n\ttop: var(--top-tabsView-top);\n\tz-index: 10;\n}\n\n/* режим отображение табов в основной области документа без popup */\n.top-tabsView-pageMod .top-tabsView_menu-inPopup_0 {\n\theight: calc(var(--100vh) - var(--top-tabsView-top));\n}\n\n/* стантартный режим */\n.top-tabsView_menu-inPopup_0 {\n\tbox-sizing: border-box;\n\twidth: var(--top-tabsView-menu-width);\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\tflex-shrink: 0;\n}\n\n/* режим вывода в popup */\n.top-tabsView_menu-inPopup_1 {\n\tborder-bottom: 1px solid var(--color-line-2-opacity);\n}\n\n.top-tabsView_menu-short {\n\twidth: auto;\n}\n\n.top-tabsView_menu > .top-tabsView_menuOpener {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n}\n\n.top-tabsView_menu > .top-tabsView_menuOpener:hover {\n\tbackground: var(--color-layer-1);\n}\n\n.top-tabsView_menuOpenerIcon { display: flex; }\n\n.top-tabsView_menuOpenerActiveItem {\n\t--top-forms-padding: 0px;\n\n\tbox-sizing: border-box;\n\tpadding: var(--top-padding-2);\n\tmax-width: calc(100% - var(--top-forms-base-height));\n\twhite-space: nowrap;\n\tflex-grow: 1;\n\tdisplay: flex;\n\talign-items: center;\n\tgap: var(--top-padding-2);\n}\n\n.top-tabsView_menuList,\n.top-tabsView_menuFooter {\n\tpadding: var(--top-padding-2);\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: var(--top-gap-2);\n}\n\n.top-tabsView_menuList {\n\toverflow-y: auto;\n}\n\n.top-tabsView_menu-short .top-tabsView_menuFooter > .top-tabsView_menuItem {\n\t--top-icon-width: 100%;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { defineModel, onMounted, onUnmounted, ref, watch } from 'vue';\nimport Core from '@/core/core/core';\nimport { delHash } from '@/core/utils/route';\nimport type { Props } from './tabsView';\nimport { defineTabsStore } from './store';\nimport TabsViewMenu from './menu.vue';\nimport TopLoadbar from '@/components/forms/loadbar/loadbar.vue';\nimport { checkComponentIsLoading } from './utils';\n\nconst props = withDefaults(defineProps<Props>(), {\n\tshowMenuInPopup: undefined,\n\tisShortable: false,\n});\n\nconst model = defineModel<string>();\n\nconst store = defineTabsStore(props, model);\n\nconst uid = Math.random();\n\nif (props.pageMod) Core.state.documentClassModificators.set(uid, 'top-hasTabsViewPageMod');\n\nonUnmounted(() => {\n\tif (props.pageMod) Core.state.documentClassModificators.delete(uid);\n\n\tif (store.$id) delHash(store.$id, store.activeItemName, true);\n});\n\nconst componentRef = ref();\nconst isLoading = ref(false);\n\nwatch([componentRef, () => store.component], () => {\n\tisLoading.value = checkComponentIsLoading(store.component);\n}, { immediate: true });\n</script>\n\n<template>\n\t<div\n\t\t:class=\"{\n\t\t\t'top-tabsView': true,\n\t\t\t'top-tabsView-pageMod': props.pageMod,\n\t\t\t'top-tabsView-inPopup': store.showMenuInPopup,\n\t\t}\"\n\t>\n\t\t<TabsViewMenu\n\t\t\t:isShortable=\"isShortable\"\n\t\t\tv-model:isLoading=\"isLoading\"\n\t\t>\n\t\t\t<!-- @slot Меню, ожидает передачу компонентов TabsViewMenuItem и TabsViewMenuTitle -->\n\t\t\t<slot name=\"menu\"></slot>\n\t\t</TabsViewMenu>\n\n\t\t<div\n\t\t\t:class=\"{\n\t\t\t\t'top-tabsView_contents': true,\n\t\t\t\t'top-tabsView_contents-isLoading': isLoading,\n\t\t\t\t'top-tabsView_contents-noScrollable': !store.scrollable,\n\t\t\t}\"\n\t\t>\n\t\t\t<TopLoadbar v-if=\"isLoading\"/>\n\n\t\t\t<keep-alive>\n\t\t\t\t<component\n\t\t\t\t\tref=\"componentRef\"\n\t\t\t\t\t:is=\"store.component\"\n\t\t\t\t/>\n\t\t\t</keep-alive>\n\t\t</div>\n\t</div>\n</template>\n\n<style>\n:root {\n\t--top-tabsView-top: 0px;\n\t--top-tabsView-menu-width: 220px;\n\t--top-tabsView-contents-offset-top: 0px;\n}\n\n.top-tabsView {\n\tbackground: var(--color-layout-middle);\n\twidth: 100%;\n\theight: 100%;\n\tdisplay: flex;\n\tflex-direction: row;\n}\n\n.top-tabsView_contents {\n\tborder-radius: var(--top-radius-4);\n\tbackground: var(--color-layout-front-1);\n\tpadding: var(--top-padding-4);\n\tflex-grow: 1;\n\toverflow: auto;\n\tposition: relative;\n}\n\n.top-tabsView_contents-isLoading {\n\tpointer-events: none;\n}\n\n.top-tabsView_contents-noScrollable {\n\twidth: calc(100% - var(--top-tabsView-menu-width));\n\tpadding: 0;\n\toverflow: visible;\n}\n\n/* top-tabsView-inPopup */\n.top-tabsView-inPopup {\n\tbackground: var(--color-layout-front-1);\n\tflex-direction: column;\n}\n\n.top-tabsView-inPopup > .top-tabsView_contents {\n\tborder-radius: 0;\n}\n\n.top-tabsView-inPopup > .top-tabsView_contents-noScrollable {\n\twidth: auto;\n}\n</style>\n","<script setup lang=\"ts\">\n\n</script>\n\n<template>\n\t<div class=\"top-tabsView_menuDelimeter\"></div>\n</template>\n\n<style>\n.top-tabsView_menuDelimeter {\n\tpadding: var(--top-padding-1) 0;\n\tdisplay: flex;\n}\n\n.top-tabsView_menuDelimeter:before {\n\tcontent: \"\";\n\theight: 2px;\n\tbackground: var(--color-line-2);\n\tflex-grow: 1;\n}\n\n.top-tabsView_menuDelimeter:first-child,\n.top-tabsView_menuDelimeter + .top-tabsView_menuDelimeter {\n\tdisplay: none;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { useTabsStore } from './store';\nimport type { PropsMenuTitle } from './tabsView';\nimport TabsViewMenuDelimeter from './menuDelimeter.vue';\nimport { TopPopupListItem } from '../../popup/popup';\n\ndefineProps<PropsMenuTitle>();\n\nconst store = useTabsStore();\n</script>\n\n<template>\n\t<TopPopupListItem\n\t\tv-if=\"store.showMenuInPopup\"\n\t\ttype=\"title\"\n\t>\n\t\t<slot></slot>\n\t</TopPopupListItem>\n\n\t<TabsViewMenuDelimeter v-else-if=\"store.isShort\"/>\n\n\t<div\n\t\tv-else\n\t\t:class=\"{\n\t\t\t'top-tabsView_menuTitle': true,\n\t\t\t'top-tabsView_menuTitle-subtitle': isSubtitle,\n\t\t}\"\n\t>\n\t\t<slot></slot>\n\t</div>\n</template>\n\n<style>\n.top-tabsView_menuTitle {\n\tpadding: var(--top-padding-4) var(--top-padding-2) var(--top-padding-1);\n\tfont-weight: 600;\n\tcolor: var(--color-text-1);\n}\n\n.top-tabsView_menuTitle-subtitle {\n\tpadding-top: var(--top-padding-1);\n\tfont-size: 12px;\n\tfont-weight: 400;\n\tcolor: var(--color-text-2);\n}\n</style>\n","import type { ComponentCustomProps } from 'vue';\n\nimport TabsView from './tabsView/tabsView.vue';\nimport TabsViewMenuItem from './tabsView/menuItem.vue';\nimport TabsViewMenuTitle from './tabsView/menuTitle.vue';\n\nexport const TopTabsView = TabsView as typeof TabsView & ComponentCustomProps;\nexport const TopTabsViewMenuItem = TabsViewMenuItem as typeof TabsViewMenuItem & ComponentCustomProps;\nexport const TopTabsViewMenuTitle = TabsViewMenuTitle as typeof TabsViewMenuTitle & ComponentCustomProps;\n"],"names":["genStorageKey","stateName","stateKey","StoreLocalStorage","store","localStorageValue","localStorageKey","popstateCallbacks","e","defineTabsStore","props","model","store$1","injectionKey","showMenuInPopup","vue","forms","isShort","component","scrollable","pageMod","popstateCallback","useTabsStore","href","tagName","popup_popup","onClick","checkComponentIsLoading","preResolveComponent","condition","slots","menuItemByName","setMenuItemByNameFromItems","menuItems","subComponent","_sfc_main$4","_a","_b","_d","_c","activeMenuItem","numberChanged","countChanged","setMenuItemByName","activeItemName","isLoading","utils_route","elRef","resizeObserver","uid","componentRef","_sfc_render","_ctx","_cache","TopTabsView","_sfc_main$2","TopTabsViewMenuItem","TopTabsViewMenuTitle","_sfc_main"],"mappings":"uRAQA,MAAAA,EAAA,CAAAC,EAAAC,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AA0C,EAAA,QAAA1C,EAAA,IAAAA,EAAA,eAAA,EAAA,EAGAyC,EAAA,MAAA,GAOA,MAAAjB,EAAAY,EAAA,MAAA,UAAA,IAAAC,IAAAC,CAAA,EAGAD,IAAAC,yFAQC,QAAA,KAAA,qBAAAtC,EAAA,cAAA,wDAAAA,EAAA,cAAA,GAAA,oBAMH,MAAA2C,EAAAhC,EAAA,IAAA,EACA,IAAAiC,0BAGCA,EAAA,IAAA,eAAA,IAAA,CACCD,EAAA,MAAA,cAAA,MAAA,YAAA,qCAAAA,EAAA,MAAA,aAAA,IAAA,CAAiH,CAAA,EAGlHC,EAAA,QAAAD,EAAA,KAAA,CAAkC,CAAA,mCAIR,CAAA,6pDC5I3BE,EAAA,KAAA,OAAA,EAEAvC,EAAA,SAAAM,EAAA,KAAA,MAAA,0BAAA,IAAAiC,EAAA,wBAAA,qBAGCvC,EAAA,SAAAM,EAAA,KAAA,MAAA,0BAAA,OAAAiC,CAAA,EAEA7C,EAAA,KAAA0C,EAAA,QAAA1C,EAAA,IAAAA,EAAA,eAAA,EAAA,CAA4D,CAAA,EAG7D,MAAA8C,EAAAnC,EAAA,IAAA,EACA8B,EAAA9B,EAAA,IAAA,EAAA,gEAG0D,EAAA,CAAA,UAAA,EAAA,CAAA,u3BC5BzD,SAAAoC,EAAAC,EAAAC,EAAA,+KCGD,MAAAjD,EAAAkB,EAAA,ubCFOgC,EAAAC,EACAC,EAAArB,EACAsB,EAAAC"}
|
package/tabsView/tabsView.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Core as U } from "../core/app.js";
|
|
2
2
|
import { watch as k, computed as I, ref as f, defineComponent as M, createBlock as m, openBlock as l, resolveDynamicComponent as O, normalizeClass as w, unref as i, withCtx as b, renderSlot as v, createElementBlock as d, createCommentVNode as y, mergeModels as z, useModel as D, useSlots as G, onMounted as Q, onUnmounted as H, createElementVNode as S, toDisplayString as R, Fragment as X, createTextVNode as Y, markRaw as Z, createVNode as x, KeepAlive as ee } from "vue";
|
|
3
|
-
import { C as $, v as te, t as oe } from "../.chunks/forms-
|
|
3
|
+
import { C as $, v as te, t as oe } from "../.chunks/forms-Dg0Huskq.es.js";
|
|
4
4
|
import { getHash as K, genHash as ae, setHash as se, delHash as ne } from "../utils/route.js";
|
|
5
5
|
import { u as ie, d as re } from "../.chunks/store-CX_6ZXhO.es.js";
|
|
6
6
|
import { TopPopupListItem as A, TopPopup as le } from "../popup/popup.js";
|
|
@@ -108,7 +108,7 @@ const W = Symbol(), de = (t, o) => {
|
|
|
108
108
|
setup(t) {
|
|
109
109
|
const o = D(t, "isLoading"), e = L(), a = G(), u = /* @__PURE__ */ new Map(), p = () => {
|
|
110
110
|
if (!a.default) return;
|
|
111
|
-
const c = a.default().find((s) => s.key === "_menu");
|
|
111
|
+
const c = a.default({}).find((s) => s.key === "_menu");
|
|
112
112
|
c && n(c.children);
|
|
113
113
|
}, n = (c) => {
|
|
114
114
|
c.forEach((s) => {
|
package/tabsView/tabsView.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabsView.js","sources":["../../src/core/utils/store/localStorage.ts","../../src/components/tabsView/tabsView/store.ts","../../src/components/tabsView/tabsView/menuItem.vue","../../src/components/tabsView/tabsView/utils.ts","../../src/components/tabsView/tabsView/menu.vue","../../src/components/tabsView/tabsView/tabsView.vue","../../src/components/tabsView/tabsView/menuDelimeter.vue","../../src/components/tabsView/tabsView/menuTitle.vue","../../src/components/tabsView/tabsView.ts"],"sourcesContent":["import { watch } from 'vue';\nimport type { Store } from './store';\n\n/**\n * Сгенерировать имя для сохранения данных в localStorage\n * @param stateName - имя свойства состояния\n * @param stateKey - ключ состояния, разные компоненты могут использовать одинаковый ключ\n */\nconst genStorageKey = <T extends Store>(stateName: keyof T, stateKey: string): string => {\n\tconst stateNameString = String(stateName);\n\n\treturn `top:${stateNameString}:${stateKey}`;\n};\n\n/**\n * Загрузить состояние\n * @param stateName - имя свойства состояния\n * @param store\n */\nconst loadLocalStorge = <T extends Store>(stateName: keyof T, store: T) => {\n\t// если Store.key не знадан, значит сохранение состояния в компоненте отключено\n\tif (!store.$id) return;\n\n\tconst localStorageKey = genStorageKey(stateName, store.$id);\n\n\ttry {\n\t\tconst localStorageValue: typeof store[keyof typeof store] = JSON.parse(localStorage.getItem(localStorageKey) as string);\n\n\t\tif (typeof localStorageValue === typeof store[stateName]) {\n\t\t\tstore[stateName] = localStorageValue;\n\t\t}\n\t} catch (e) {\n\t\tconsole.warn(new Error(`В localStorage[${localStorageKey}] не корректный json`));\n\t}\n};\n\n/**\n * Добавить автосохранение состояние при его изменении\n * @param stateName - имя свойства состояния\n * @param store\n */\nconst addSaverLocalStorge = <T extends Store>(stateName: keyof T, store: T) => {\n\t// если store.$id не знадан, значит сохранение состояния в компоненте отключено\n\tif (!store.$id) return;\n\n\tconst localStorageKey = genStorageKey(stateName, store.$id);\n\n\twatch(() => store[stateName], () => {\n\t\tlocalStorage.setItem(localStorageKey, JSON.stringify(store[stateName]));\n\t}, { immediate: true });\n};\n\nexport default {\n\tloadLocalStorge,\n\taddSaverLocalStorge,\n};","import type { InjectionKey, ModelRef } from 'vue';\nimport { computed, ref } from 'vue';\nimport Core from '@/core/core/core';\nimport { defineStore, useStore } from '@/core/utils/store';\nimport StoreLocalStorage from '@/core/utils/store/localStorage';\nimport type { Props, Store } from './tabsView';\nimport { getHash } from '@/core/utils/route';\n\nconst popstateCallbacks = new Set<(e: PopStateEvent) => void>();\n\naddEventListener('popstate', (e) => {\n\tpopstateCallbacks.forEach(popstateCallback => popstateCallback(e));\n});\n\nexport const injectionKey = Symbol() as InjectionKey<Store>;\n\n/**\n * Инициировать Store компонента\n */\nexport const defineTabsStore = (props: Props, model: ModelRef<string | undefined>) => {\n\tconst store = defineStore(injectionKey, () => {\n\t\tconst showMenuInPopup = computed(() => props.showMenuInPopup ?? Core.state.isMobile);\n\t\tconst pageMod = computed(() => props.pageMod);\n\t\tconst isShort = ref(false);\n\n\t\tconst component = ref(undefined);\n\t\tconst scrollable = ref(true);\n\n\t\treturn {\n\t\t\tshowMenuInPopup,\n\t\t\tpageMod,\n\t\t\tisShort,\n\t\t\tactiveItemName: model,\n\t\t\tcomponent,\n\t\t\tscrollable,\n\t\t};\n\t}, props.idState);\n\n\tif (props.isShortable) {\n\t\tconst stateName = 'isShort';\n\n\t\tStoreLocalStorage.loadLocalStorge(stateName, store);\n\t\tStoreLocalStorage.addSaverLocalStorge(stateName, store);\n\t}\n\n\tif (store.$id) {\n\t\tconst popstateCallback = (e: PopStateEvent) => {\n\t\t\tmodel.value = getHash(store.$id!);\n\t\t};\n\n\t\tpopstateCallbacks.add(popstateCallback);\n\t}\n\n\treturn store;\n};\n\n/**\n * Получить Store компонента\n */\nexport const useTabsStore = () => useStore(injectionKey);\n","<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport { genHash } from '@/core/utils/route';\nimport { TopPopupListItem } from '@/components/popup/popup';\nimport { useTabsStore } from './store';\nimport type { PropsMenuItem } from './tabsView';\n\nconst props = withDefaults(defineProps<PropsMenuItem>(), {\n\tscrollable: true,\n\tcomponent: undefined,\n});\n\nconst store = useTabsStore();\n\nconst href = computed(() => {\n\t// это внутренняя хеш навигация, ссылка на вкладку\n\tif (props.name && store.$id) {\n\t\treturn genHash(store.$id, props.name);\n\t}\n\n\treturn props.href;\n});\n\nconst tagName = computed(() => {\n\tif (store.showMenuInPopup) {\n\t\treturn TopPopupListItem;\n\t}\n\n\treturn href ? 'a' : 'button';\n});\n\n/**\n * Клик по элементу меню\n */\nconst onClick = (e: MouseEvent) => {\n\t// это внутренняя хеш навигация, ссылка на вкладку\n\tif (!props.href && href.value) {\n\t\te.preventDefault();\n\t}\n\n\tif (props.name) {\n\t\tstore.activeItemName = props.name;\n\t}\n};\n</script>\n\n<template>\n\t<component\n\t\t:is=\"tagName\"\n\t\ttarget=\"_self\"\n\t\t:class=\"{\n\t\t\t['top-tabsView_menuItem']: !store.showMenuInPopup,\n\t\t\t['top-active']: name && store.activeItemName === name,\n\t\t\t['top-disabled']: disabled,\n\t\t\t['top-spa-disabled']: true,\n\t\t}\"\n\t\t:href=\"href\"\n\t\t:data-top-icon=\"icon || undefined\"\n\t\t:disabled=\"disabled || undefined\"\n\t\t@click=\"onClick\"\n\t>\n\t\t<slot v-if=\"store.showMenuInPopup\"></slot>\n\n\t\t<span\n\t\t\tv-else-if=\"$slots.default && !store.isShort\"\n\t\t\tclass=\"top-ellipsis\"\n\t\t>\n\t\t\t<slot></slot>\n\t\t</span>\n\t</component>\n</template>\n\n<style>\n.top-tabsView_menuItem {\n\t--top-icon-color: var(--color-text-2);\n\t--top-icon-width: calc(var(--top-icon-size));\n\n\tcursor: pointer;\n\tbox-sizing: border-box;\n\n\tborder: none;\n\tborder-radius: var(--top-radius-2);\n\tpadding: var(--top-padding-2);\n\tbackground: transparent;\n\theight: 40px;\n\n\tcolor: var(--color-text-1);\n\ttext-decoration: none;\n\twhite-space: nowrap;\n\n\tdisplay: flex;\n\tgap: var(--top-gap-2);\n\talign-items: center;\n\tjustify-content: flex-start;\n\ttransition: background var(--transition);\n}\n\n.top-tabsView_menuItem:hover {\n\t--top-icon-color: var(--color-text-1);\n\n\tbackground: var(--color-bg-shading-1);\n\ttext-decoration: none;\n}\n\n.top-tabsView_menuItem.top-active {\n\t--top-icon-color: inherit;\n\n\tbackground: var(--color-layout-front-1);\n\tcolor: inherit;\n}\n\n.top-tabsView_menuItem:disabled:not(option):not(optgroup):not(.top-forms-option),\n.top-tabsView_menuItem:disabled ~ .top-formsCaption,\n.top-tabsView_menuItem.top-disabled[data-top-icon]:before,\n.top-tabsView_menuItem.top-disabled[data-top-icon2]:after {\n\topacity: unset;\n\tfilter: unset;\n}\n\n.top-tabsView_menuItem.top-disabled {\n\t--top-icon-color: var(--color-text-4);\n\n\tcolor: var(--color-text-4);\n}\n</style>\n","// TODO: Эту функцию можно вынести в глобальный utils\n\nimport { sleepWhile } from '@/core/utils/system';\n\n/**\n * Проверка нахождения компонента в состояние загрузки\n * @param component\n */\nexport const checkComponentIsLoading = (component: any) => {\n\treturn component?.name === 'AsyncComponentWrapper' && !component?.__asyncResolved;\n};\n\n/**\n * Презагрузить компонент\n *\n * Некоторое время ожидает загрузку компонента, прежде чем завершит работу\n */\nexport const preResolveComponent = async (component: any, condition: Function) => {\n\tif (component?.name !== 'AsyncComponentWrapper') return;\n\tif (component?.__asyncResolved) return;\n\n\tcomponent.__asyncLoader();\n\n\tawait sleepWhile(() => {\n\t\treturn condition() && checkComponentIsLoading(component);\n\t}, 200);\n};\n","<script setup lang=\"ts\">\nimport type { Ref, VNode } from 'vue';\nimport { markRaw, onMounted, onUnmounted, ref, useSlots, watch } from 'vue';\nimport { TopPopup } from '../../popup/popup';\nimport { getHash, setHash } from '@/core/utils/route';\n\nimport type { MenuItem, PropsMenu, PropsMenuItem } from './tabsView';\nimport { useTabsStore } from './store';\nimport TabsViewMenuItem from './menuItem.vue';\nimport { preResolveComponent } from './utils';\n\ndefineProps<PropsMenu>();\n\nconst isLoading = defineModel('isLoading');\n\nconst store = useTabsStore();\n\nconst slots = useSlots();\n\n// словарь используется для оптимизации получения нужного menuItem\nconst menuItemByName: Map<PropsMenuItem['name'], MenuItem> = new Map();\n\n// заполнить словарь с menuItem, по элементам в slot default\nconst setMenuItemByName = () => {\n\tif (!slots.default) return;\n\n\tconst component: any = slots.default().find(item => item.key === '_menu');\n\tif (!component) return;\n\n\tsetMenuItemByNameFromItems(component.children);\n};\n\n// заполнить словарь с menuItem, по элементам\nconst setMenuItemByNameFromItems = (menuItems: VNode[]) => {\n\tmenuItems.forEach((subComponent: any) => {\n\t\t// это не компонент элемента меню\n\t\tif (subComponent.type.__name && subComponent.type.__name !== TabsViewMenuItem.__name) return;\n\n\t\t// это не компонент, например template\n\t\tif (!subComponent.type.__name && typeof subComponent.children === 'object') {\n\t\t\tsetMenuItemByNameFromItems(subComponent.children);\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (!subComponent.props?.name || subComponent.props?.disabled) return;\n\n\t\tconst menuItem: MenuItem = {\n\t\t\ttitle: (subComponent.children.default?.()[0].children as string).trim(),\n\t\t\ticon: subComponent.props.icon,\n\t\t\tcomponent: subComponent.props.component ? markRaw(subComponent.props.component) : TabsViewMenuItem.props.component.default,\n\t\t\tscrollable: subComponent.props.scrollable ?? TabsViewMenuItem.props.scrollable.default,\n\t\t};\n\n\t\tmenuItemByName.set(subComponent.props.name, menuItem);\n\t});\n};\n\n/**\n * activeMenuItem нужен:\n * - для вывода текста активной вкладки в меню с popup\n * - для вывода компонента активной вкладки (store.component)\n * - для установки store.scrollable\n */\nconst activeMenuItem: Ref<MenuItem | null> = ref(null);\n\n/**\n * Кол-во изменений активной вкладки\n */\nlet countChanged = 0;\n\n/**\n * Смена активной вкладки\n *\n * TODO: смена slot, например смена языка, требует повторного выполнения setMenuItemByName()\n */\nwatch(\n\t() => store.activeItemName,\n\tasync () => {\n\t\tconst numberChanged = ++countChanged; // порядковый номер текущего изменения\n\n\t\tif (menuItemByName.size === 0) {\n\t\t\tsetMenuItemByName();\n\t\t}\n\n\t\tif (menuItemByName.size === 0) {\n\t\t\tstore.activeItemName = '';\n\n\t\t\treturn;\n\t\t}\n\n\t\tactiveMenuItem.value = menuItemByName.get(store.activeItemName) ?? null;\n\n\t\t// элемент не найден, установить из хеша страницы\n\t\tif (!activeMenuItem.value && store.$id) {\n\t\t\tconst activeItemName = getHash(store.$id);\n\n\t\t\tactiveMenuItem.value = menuItemByName.get(activeItemName) ?? null;\n\n\t\t\tif (activeMenuItem.value) {\n\t\t\t\tstore.activeItemName = activeItemName;\n\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// элемент не найден, установить первый доступный\n\t\tif (!activeMenuItem.value) {\n\t\t\tstore.activeItemName = menuItemByName.keys().next().value!;\n\n\t\t\treturn;\n\t\t}\n\n\t\t// запрошена смена на уже активный элемент\n\t\tif (activeMenuItem.value.component === store.component) {\n\t\t\tisLoading.value = false;\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (store.$id) setHash(store.$id, store.activeItemName, false);\n\n\t\t// флаг загрузки будет сброшен при инициализации компонента\n\t\tisLoading.value = true;\n\n\t\t/**\n\t\t * Презагрузить компонент\n\t\t *\n\t\t * Нужно для того, чтобы минимизировать скачки интерфейса при ожидании загрузки асинхронного компонента\n\t\t */\n\t\tawait preResolveComponent(activeMenuItem.value.component, () => numberChanged === countChanged);\n\n\t\t// влкадка была сменена еще раз во время sleepWhile\n\t\tif (numberChanged !== countChanged) {\n\t\t\treturn;\n\t\t}\n\n\t\tstore.scrollable = activeMenuItem.value.scrollable;\n\t\tstore.component = activeMenuItem.value.component;\n\n\t\tif (activeMenuItem.value && !store.component) {\n\t\t\tconsole.warn(`Компонент вкладки ${store.activeItemName} не найден. Добавьте props.component для пункта меню ${store.activeItemName}.`);\n\t\t}\n\t},\n\t{ immediate: true },\n);\n\nconst elRef = ref();\nlet resizeObserver: ResizeObserver;\n\nonMounted(() => {\n\tresizeObserver = new ResizeObserver(() => {\n\t\telRef.value.parentElement.style.setProperty('--top-tabsView-contents-offset-top', elRef.value.offsetHeight + 'px');\n\t});\n\n\tresizeObserver.observe(elRef.value);\n});\n\nonUnmounted(() => {\n\tresizeObserver.disconnect();\n});\n</script>\n\n<template>\n\t<div\n\t\tref=\"elRef\"\n\t\t:class=\"{\n\t\t\t'top-tabsView_menu': true,\n\t\t\t'top-tabsView_menu-inPopup_0': !store.showMenuInPopup,\n\t\t\t'top-tabsView_menu-inPopup_1': store.showMenuInPopup,\n\t\t\t'top-tabsView_menu-short': store.isShort && !store.showMenuInPopup,\n\t\t}\"\n\t>\n\t\t<!-- Спрятать меню под кнопку в popup -->\n\t\t<TopPopup v-if=\"store.showMenuInPopup\">\n\t\t\t<template #opener>\n\t\t\t\t<div class=\"top-tabsView_menuOpener\">\n\t\t\t\t\t<div\n\t\t\t\t\t\tv-if=\"activeMenuItem\"\n\t\t\t\t\t\tclass=\"top-tabsView_menuOpenerActiveItem\"\n\t\t\t\t\t\t:data-top-icon=\"activeMenuItem.icon\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<span class=\"top-ellipsis\">\n\t\t\t\t\t\t\t{{ activeMenuItem.title }}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div class=\"top-tabsView_menuOpenerIcon\" data-top-icon=\"\"></div>\n\t\t\t\t</div>\n\t\t\t</template>\n\n\t\t\t<template #contentList>\n\t\t\t\t<slot></slot>\n\t\t\t</template>\n\t\t</TopPopup>\n\n\t\t<!-- Отобразить меню на странице -->\n\t\t<template v-else>\n\t\t\t<div class=\"top-tabsView_menuList\">\n\t\t\t\t<slot></slot>\n\t\t\t</div>\n\n\t\t\t<div\n\t\t\t\tv-if=\"isShortable\"\n\t\t\t\tclass=\"top-tabsView_menuFooter\"\n\t\t\t>\n\t\t\t\t<TabsViewMenuItem\n\t\t\t\t\tv-if=\"isShortable\"\n\t\t\t\t\t:icon=\"store.isShort ? '' : ''\"\n\t\t\t\t\t@click=\"store.isShort = !store.isShort\"\n\t\t\t\t>\n\t\t\t\t\t{{ store.isShort ? '' : 'Свернуть' }} <!--TODO: translate-->\n\t\t\t\t</TabsViewMenuItem>\n\t\t\t</div>\n\t\t</template>\n\t</div>\n</template>\n\n<style>\n/* режим отображение табов в основной области документа */\n.top-tabsView-pageMod .top-tabsView_menu {\n\tbox-sizing: border-box;\n\tposition: sticky;\n\ttop: var(--top-tabsView-top);\n\tz-index: 10;\n}\n\n/* режим отображение табов в основной области документа без popup */\n.top-tabsView-pageMod .top-tabsView_menu-inPopup_0 {\n\theight: calc(var(--100vh) - var(--top-tabsView-top));\n}\n\n/* стантартный режим */\n.top-tabsView_menu-inPopup_0 {\n\tbox-sizing: border-box;\n\twidth: var(--top-tabsView-menu-width);\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\tflex-shrink: 0;\n}\n\n/* режим вывода в popup */\n.top-tabsView_menu-inPopup_1 {\n\tborder-bottom: 1px solid var(--color-line-2-opacity);\n}\n\n.top-tabsView_menu-short {\n\twidth: auto;\n}\n\n.top-tabsView_menu > .top-tabsView_menuOpener {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n}\n\n.top-tabsView_menu > .top-tabsView_menuOpener:hover {\n\tbackground: var(--color-layer-1);\n}\n\n.top-tabsView_menuOpenerIcon { display: flex; }\n\n.top-tabsView_menuOpenerActiveItem {\n\t--top-forms-padding: 0px;\n\n\tbox-sizing: border-box;\n\tpadding: var(--top-padding-2);\n\tmax-width: calc(100% - var(--top-forms-base-height));\n\twhite-space: nowrap;\n\tflex-grow: 1;\n\tdisplay: flex;\n\talign-items: center;\n\tgap: var(--top-padding-2);\n}\n\n.top-tabsView_menuList,\n.top-tabsView_menuFooter {\n\tpadding: var(--top-padding-2);\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: var(--top-gap-2);\n}\n\n.top-tabsView_menuList {\n\toverflow-y: auto;\n}\n\n.top-tabsView_menu-short .top-tabsView_menuFooter > .top-tabsView_menuItem {\n\t--top-icon-width: 100%;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { defineModel, onMounted, onUnmounted, ref, watch } from 'vue';\nimport Core from '@/core/core/core';\nimport { delHash } from '@/core/utils/route';\nimport type { Props } from './tabsView';\nimport { defineTabsStore } from './store';\nimport TabsViewMenu from './menu.vue';\nimport TopLoadbar from '@/components/forms/loadbar/loadbar.vue';\nimport { checkComponentIsLoading } from './utils';\n\nconst props = withDefaults(defineProps<Props>(), {\n\tshowMenuInPopup: undefined,\n\tisShortable: false,\n});\n\nconst model = defineModel<string>();\n\nconst store = defineTabsStore(props, model);\n\nconst uid = Math.random();\n\nif (props.pageMod) Core.state.documentClassModificators.set(uid, 'top-hasTabsViewPageMod');\n\nonUnmounted(() => {\n\tif (props.pageMod) Core.state.documentClassModificators.delete(uid);\n\n\tif (store.$id) delHash(store.$id, store.activeItemName, true);\n});\n\nconst componentRef = ref();\nconst isLoading = ref(false);\n\nwatch([componentRef, () => store.component], () => {\n\tisLoading.value = checkComponentIsLoading(store.component);\n}, { immediate: true });\n</script>\n\n<template>\n\t<div\n\t\t:class=\"{\n\t\t\t'top-tabsView': true,\n\t\t\t'top-tabsView-pageMod': props.pageMod,\n\t\t\t'top-tabsView-inPopup': store.showMenuInPopup,\n\t\t}\"\n\t>\n\t\t<TabsViewMenu\n\t\t\t:isShortable=\"isShortable\"\n\t\t\tv-model:isLoading=\"isLoading\"\n\t\t>\n\t\t\t<!-- @slot Меню, ожидает передачу компонентов TabsViewMenuItem и TabsViewMenuTitle -->\n\t\t\t<slot name=\"menu\"></slot>\n\t\t</TabsViewMenu>\n\n\t\t<div\n\t\t\t:class=\"{\n\t\t\t\t'top-tabsView_contents': true,\n\t\t\t\t'top-tabsView_contents-isLoading': isLoading,\n\t\t\t\t'top-tabsView_contents-noScrollable': !store.scrollable,\n\t\t\t}\"\n\t\t>\n\t\t\t<TopLoadbar v-if=\"isLoading\"/>\n\n\t\t\t<keep-alive>\n\t\t\t\t<component\n\t\t\t\t\tref=\"componentRef\"\n\t\t\t\t\t:is=\"store.component\"\n\t\t\t\t/>\n\t\t\t</keep-alive>\n\t\t</div>\n\t</div>\n</template>\n\n<style>\n:root {\n\t--top-tabsView-top: 0px;\n\t--top-tabsView-menu-width: 220px;\n\t--top-tabsView-contents-offset-top: 0px;\n}\n\n.top-tabsView {\n\tbackground: var(--color-layout-middle);\n\twidth: 100%;\n\theight: 100%;\n\tdisplay: flex;\n\tflex-direction: row;\n}\n\n.top-tabsView_contents {\n\tborder-radius: var(--top-radius-4);\n\tbackground: var(--color-layout-front-1);\n\tpadding: var(--top-padding-4);\n\tflex-grow: 1;\n\toverflow: auto;\n\tposition: relative;\n}\n\n.top-tabsView_contents-isLoading {\n\tpointer-events: none;\n}\n\n.top-tabsView_contents-noScrollable {\n\twidth: calc(100% - var(--top-tabsView-menu-width));\n\tpadding: 0;\n\toverflow: visible;\n}\n\n/* top-tabsView-inPopup */\n.top-tabsView-inPopup {\n\tbackground: var(--color-layout-front-1);\n\tflex-direction: column;\n}\n\n.top-tabsView-inPopup > .top-tabsView_contents {\n\tborder-radius: 0;\n}\n\n.top-tabsView-inPopup > .top-tabsView_contents-noScrollable {\n\twidth: auto;\n}\n</style>\n","<script setup lang=\"ts\">\n\n</script>\n\n<template>\n\t<div class=\"top-tabsView_menuDelimeter\"></div>\n</template>\n\n<style>\n.top-tabsView_menuDelimeter {\n\tpadding: var(--top-padding-1) 0;\n\tdisplay: flex;\n}\n\n.top-tabsView_menuDelimeter:before {\n\tcontent: \"\";\n\theight: 2px;\n\tbackground: var(--color-line-2);\n\tflex-grow: 1;\n}\n\n.top-tabsView_menuDelimeter:first-child,\n.top-tabsView_menuDelimeter + .top-tabsView_menuDelimeter {\n\tdisplay: none;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { useTabsStore } from './store';\nimport type { PropsMenuTitle } from './tabsView';\nimport TabsViewMenuDelimeter from './menuDelimeter.vue';\nimport { TopPopupListItem } from '../../popup/popup';\n\ndefineProps<PropsMenuTitle>();\n\nconst store = useTabsStore();\n</script>\n\n<template>\n\t<TopPopupListItem\n\t\tv-if=\"store.showMenuInPopup\"\n\t\ttype=\"title\"\n\t>\n\t\t<slot></slot>\n\t</TopPopupListItem>\n\n\t<TabsViewMenuDelimeter v-else-if=\"store.isShort\"/>\n\n\t<div\n\t\tv-else\n\t\t:class=\"{\n\t\t\t'top-tabsView_menuTitle': true,\n\t\t\t'top-tabsView_menuTitle-subtitle': isSubtitle,\n\t\t}\"\n\t>\n\t\t<slot></slot>\n\t</div>\n</template>\n\n<style>\n.top-tabsView_menuTitle {\n\tpadding: var(--top-padding-4) var(--top-padding-2) var(--top-padding-1);\n\tfont-weight: 600;\n\tcolor: var(--color-text-1);\n}\n\n.top-tabsView_menuTitle-subtitle {\n\tpadding-top: var(--top-padding-1);\n\tfont-size: 12px;\n\tfont-weight: 400;\n\tcolor: var(--color-text-2);\n}\n</style>\n","import type { ComponentCustomProps } from 'vue';\n\nimport TabsView from './tabsView/tabsView.vue';\nimport TabsViewMenuItem from './tabsView/menuItem.vue';\nimport TabsViewMenuTitle from './tabsView/menuTitle.vue';\n\nexport const TopTabsView = TabsView as typeof TabsView & ComponentCustomProps;\nexport const TopTabsViewMenuItem = TabsViewMenuItem as typeof TabsViewMenuItem & ComponentCustomProps;\nexport const TopTabsViewMenuTitle = TabsViewMenuTitle as typeof TabsViewMenuTitle & ComponentCustomProps;\n"],"names":["genStorageKey","stateName","stateKey","loadLocalStorge","store","localStorageKey","localStorageValue","addSaverLocalStorge","watch","StoreLocalStorage","popstateCallbacks","e","popstateCallback","injectionKey","defineTabsStore","props","model","defineStore","showMenuInPopup","computed","Core","pageMod","isShort","ref","component","scrollable","getHash","useTabsStore","useStore","__props","href","genHash","tagName","TopPopupListItem","onClick","checkComponentIsLoading","preResolveComponent","condition","sleepWhile","isLoading","useModel","slots","useSlots","menuItemByName","setMenuItemByName","item","setMenuItemByNameFromItems","menuItems","subComponent","_sfc_main$4","_a","_b","menuItem","_d","_c","markRaw","activeMenuItem","countChanged","numberChanged","activeItemName","setHash","elRef","resizeObserver","onMounted","onUnmounted","uid","delHash","componentRef","_sfc_render","_ctx","_cache","TopTabsView","_sfc_main$2","TopTabsViewMenuItem","TopTabsViewMenuTitle","_sfc_main"],"mappings":";;;;;;;;;AAQA,MAAAA,IAAA,CAAAC,GAAAC,MAGC,OAFA,OAAAD,CAAA,CAEA,IAAAC,CAAA,IAQDC,KAAA,CAAAF,GAAAG,MAAA;AAEC,MAAA,CAAAA,EAAA,IAAA;AAEA,QAAAC,IAAAL,EAAAC,GAAAG,EAAA,GAAA;AAEA,MAAA;AACC,UAAAE,IAAA,KAAA,MAAA,aAAA,QAAAD,CAAA,CAAA;AAEA,IAAA,OAAAC,KAAA,OAAAF,EAAAH,CAAA,MACCG,EAAAH,CAAA,IAAAK;AAAA,EACD,QAAA;AAEA,YAAA,KAAA,IAAA,MAAA,kBAAAD,CAAA,sBAAA,CAAA;AAAA,EAA+E;AAEjF,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AAA,GAAA,MAAA;AACC,MAAAmC,EAAA,QAAAJ,EAAA/B,EAAA,SAAA;AAAA,IAAyD,GAAA,EAAA,WAAA,GAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC5BzD,SAAAgE,GAAAC,GAAAC,GAAA;;;;;;;;;ACGD,UAAAlE,IAAAuB,EAAA;;;;;;;;;;;;;;;;;;;ICFO4C,KAAAC,IACAC,KAAAxB,GACAyB,KAAAC;"}
|
|
1
|
+
{"version":3,"file":"tabsView.js","sources":["../../src/core/utils/store/localStorage.ts","../../src/components/tabsView/tabsView/store.ts","../../src/components/tabsView/tabsView/menuItem.vue","../../src/components/tabsView/tabsView/utils.ts","../../src/components/tabsView/tabsView/menu.vue","../../src/components/tabsView/tabsView/tabsView.vue","../../src/components/tabsView/tabsView/menuDelimeter.vue","../../src/components/tabsView/tabsView/menuTitle.vue","../../src/components/tabsView/tabsView.ts"],"sourcesContent":["import { watch } from 'vue';\nimport type { Store } from './store';\n\n/**\n * Сгенерировать имя для сохранения данных в localStorage\n * @param stateName - имя свойства состояния\n * @param stateKey - ключ состояния, разные компоненты могут использовать одинаковый ключ\n */\nconst genStorageKey = <T extends Store>(stateName: keyof T, stateKey: string): string => {\n\tconst stateNameString = String(stateName);\n\n\treturn `top:${stateNameString}:${stateKey}`;\n};\n\n/**\n * Загрузить состояние\n * @param stateName - имя свойства состояния\n * @param store\n */\nconst loadLocalStorge = <T extends Store>(stateName: keyof T, store: T) => {\n\t// если Store.key не знадан, значит сохранение состояния в компоненте отключено\n\tif (!store.$id) return;\n\n\tconst localStorageKey = genStorageKey(stateName, store.$id);\n\n\ttry {\n\t\tconst localStorageValue: typeof store[keyof typeof store] = JSON.parse(localStorage.getItem(localStorageKey) as string);\n\n\t\tif (typeof localStorageValue === typeof store[stateName]) {\n\t\t\tstore[stateName] = localStorageValue;\n\t\t}\n\t} catch (e) {\n\t\tconsole.warn(new Error(`В localStorage[${localStorageKey}] не корректный json`));\n\t}\n};\n\n/**\n * Добавить автосохранение состояние при его изменении\n * @param stateName - имя свойства состояния\n * @param store\n */\nconst addSaverLocalStorge = <T extends Store>(stateName: keyof T, store: T) => {\n\t// если store.$id не знадан, значит сохранение состояния в компоненте отключено\n\tif (!store.$id) return;\n\n\tconst localStorageKey = genStorageKey(stateName, store.$id);\n\n\twatch(() => store[stateName], () => {\n\t\tlocalStorage.setItem(localStorageKey, JSON.stringify(store[stateName]));\n\t}, { immediate: true });\n};\n\nexport default {\n\tloadLocalStorge,\n\taddSaverLocalStorge,\n};","import type { InjectionKey, ModelRef } from 'vue';\nimport { computed, ref } from 'vue';\nimport Core from '@/core/core/core';\nimport { defineStore, useStore } from '@/core/utils/store';\nimport StoreLocalStorage from '@/core/utils/store/localStorage';\nimport type { Props, Store } from './tabsView';\nimport { getHash } from '@/core/utils/route';\n\nconst popstateCallbacks = new Set<(e: PopStateEvent) => void>();\n\naddEventListener('popstate', (e) => {\n\tpopstateCallbacks.forEach(popstateCallback => popstateCallback(e));\n});\n\nexport const injectionKey = Symbol() as InjectionKey<Store>;\n\n/**\n * Инициировать Store компонента\n */\nexport const defineTabsStore = (props: Props, model: ModelRef<string | undefined>) => {\n\tconst store = defineStore(injectionKey, () => {\n\t\tconst showMenuInPopup = computed(() => props.showMenuInPopup ?? Core.state.isMobile);\n\t\tconst pageMod = computed(() => props.pageMod);\n\t\tconst isShort = ref(false);\n\n\t\tconst component = ref(undefined);\n\t\tconst scrollable = ref(true);\n\n\t\treturn {\n\t\t\tshowMenuInPopup,\n\t\t\tpageMod,\n\t\t\tisShort,\n\t\t\tactiveItemName: model,\n\t\t\tcomponent,\n\t\t\tscrollable,\n\t\t};\n\t}, props.idState);\n\n\tif (props.isShortable) {\n\t\tconst stateName = 'isShort';\n\n\t\tStoreLocalStorage.loadLocalStorge(stateName, store);\n\t\tStoreLocalStorage.addSaverLocalStorge(stateName, store);\n\t}\n\n\tif (store.$id) {\n\t\tconst popstateCallback = (e: PopStateEvent) => {\n\t\t\tmodel.value = getHash(store.$id!);\n\t\t};\n\n\t\tpopstateCallbacks.add(popstateCallback);\n\t}\n\n\treturn store;\n};\n\n/**\n * Получить Store компонента\n */\nexport const useTabsStore = () => useStore(injectionKey);\n","<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport { genHash } from '@/core/utils/route';\nimport { TopPopupListItem } from '@/components/popup/popup';\nimport { useTabsStore } from './store';\nimport type { PropsMenuItem } from './tabsView';\n\nconst props = withDefaults(defineProps<PropsMenuItem>(), {\n\tscrollable: true,\n\tcomponent: undefined,\n});\n\nconst store = useTabsStore();\n\nconst href = computed(() => {\n\t// это внутренняя хеш навигация, ссылка на вкладку\n\tif (props.name && store.$id) {\n\t\treturn genHash(store.$id, props.name);\n\t}\n\n\treturn props.href;\n});\n\nconst tagName = computed(() => {\n\tif (store.showMenuInPopup) {\n\t\treturn TopPopupListItem;\n\t}\n\n\treturn href ? 'a' : 'button';\n});\n\n/**\n * Клик по элементу меню\n */\nconst onClick = (e: MouseEvent) => {\n\t// это внутренняя хеш навигация, ссылка на вкладку\n\tif (!props.href && href.value) {\n\t\te.preventDefault();\n\t}\n\n\tif (props.name) {\n\t\tstore.activeItemName = props.name;\n\t}\n};\n</script>\n\n<template>\n\t<component\n\t\t:is=\"tagName\"\n\t\ttarget=\"_self\"\n\t\t:class=\"{\n\t\t\t['top-tabsView_menuItem']: !store.showMenuInPopup,\n\t\t\t['top-active']: name && store.activeItemName === name,\n\t\t\t['top-disabled']: disabled,\n\t\t\t['top-spa-disabled']: true,\n\t\t}\"\n\t\t:href=\"href\"\n\t\t:data-top-icon=\"icon || undefined\"\n\t\t:disabled=\"disabled || undefined\"\n\t\t@click=\"onClick\"\n\t>\n\t\t<slot name=\"default\" v-if=\"store.showMenuInPopup\"></slot>\n\n\t\t<span\n\t\t\tv-else-if=\"$slots.default && !store.isShort\"\n\t\t\tclass=\"top-ellipsis\"\n\t\t>\n\t\t\t<slot name=\"default\"></slot>\n\t\t</span>\n\t</component>\n</template>\n\n<style>\n.top-tabsView_menuItem {\n\t--top-icon-color: var(--color-text-2);\n\t--top-icon-width: calc(var(--top-icon-size));\n\n\tcursor: pointer;\n\tbox-sizing: border-box;\n\n\tborder: none;\n\tborder-radius: var(--top-radius-2);\n\tpadding: var(--top-padding-2);\n\tbackground: transparent;\n\theight: 40px;\n\n\tcolor: var(--color-text-1);\n\ttext-decoration: none;\n\twhite-space: nowrap;\n\n\tdisplay: flex;\n\tgap: var(--top-gap-2);\n\talign-items: center;\n\tjustify-content: flex-start;\n\ttransition: background var(--transition);\n}\n\n.top-tabsView_menuItem:hover {\n\t--top-icon-color: var(--color-text-1);\n\n\tbackground: var(--color-bg-shading-1);\n\ttext-decoration: none;\n}\n\n.top-tabsView_menuItem.top-active {\n\t--top-icon-color: inherit;\n\n\tbackground: var(--color-layout-front-1);\n\tcolor: inherit;\n}\n\n.top-tabsView_menuItem:disabled:not(option):not(optgroup):not(.top-forms-option),\n.top-tabsView_menuItem:disabled ~ .top-formsCaption,\n.top-tabsView_menuItem.top-disabled[data-top-icon]:before,\n.top-tabsView_menuItem.top-disabled[data-top-icon2]:after {\n\topacity: unset;\n\tfilter: unset;\n}\n\n.top-tabsView_menuItem.top-disabled {\n\t--top-icon-color: var(--color-text-4);\n\n\tcolor: var(--color-text-4);\n}\n</style>\n","// TODO: Эту функцию можно вынести в глобальный utils\n\nimport { sleepWhile } from '@/core/utils/system';\n\n/**\n * Проверка нахождения компонента в состояние загрузки\n * @param component\n */\nexport const checkComponentIsLoading = (component: any) => {\n\treturn component?.name === 'AsyncComponentWrapper' && !component?.__asyncResolved;\n};\n\n/**\n * Презагрузить компонент\n *\n * Некоторое время ожидает загрузку компонента, прежде чем завершит работу\n */\nexport const preResolveComponent = async (component: any, condition: Function) => {\n\tif (component?.name !== 'AsyncComponentWrapper') return;\n\tif (component?.__asyncResolved) return;\n\n\tcomponent.__asyncLoader();\n\n\tawait sleepWhile(() => {\n\t\treturn condition() && checkComponentIsLoading(component);\n\t}, 200);\n};\n","<script setup lang=\"ts\">\nimport type { Ref, VNode } from 'vue';\nimport { markRaw, onMounted, onUnmounted, ref, useSlots, watch } from 'vue';\nimport { TopPopup } from '../../popup/popup';\nimport { getHash, setHash } from '@/core/utils/route';\n\nimport type { MenuItem, PropsMenu, PropsMenuItem } from './tabsView';\nimport { useTabsStore } from './store';\nimport TabsViewMenuItem from './menuItem.vue';\nimport { preResolveComponent } from './utils';\n\ndefineProps<PropsMenu>();\n\nconst isLoading = defineModel('isLoading');\n\nconst store = useTabsStore();\n\nconst slots = useSlots();\n\n// словарь используется для оптимизации получения нужного menuItem\nconst menuItemByName: Map<PropsMenuItem['name'], MenuItem> = new Map();\n\n// заполнить словарь с menuItem, по элементам в slot default\nconst setMenuItemByName = () => {\n\tif (!slots.default) return;\n\n\tconst component: any = slots.default({}).find(item => item.key === '_menu');\n\tif (!component) return;\n\n\tsetMenuItemByNameFromItems(component.children);\n};\n\n// заполнить словарь с menuItem, по элементам\nconst setMenuItemByNameFromItems = (menuItems: VNode[]) => {\n\tmenuItems.forEach((subComponent: any) => {\n\t\t// это не компонент элемента меню\n\t\tif (subComponent.type.__name && subComponent.type.__name !== TabsViewMenuItem.__name) return;\n\n\t\t// это не компонент, например template\n\t\tif (!subComponent.type.__name && typeof subComponent.children === 'object') {\n\t\t\tsetMenuItemByNameFromItems(subComponent.children);\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (!subComponent.props?.name || subComponent.props?.disabled) return;\n\n\t\tconst menuItem: MenuItem = {\n\t\t\ttitle: (subComponent.children.default?.()[0].children as string).trim(),\n\t\t\ticon: subComponent.props.icon,\n\t\t\tcomponent: subComponent.props.component ? markRaw(subComponent.props.component) : TabsViewMenuItem.props.component.default,\n\t\t\tscrollable: subComponent.props.scrollable ?? TabsViewMenuItem.props.scrollable.default,\n\t\t};\n\n\t\tmenuItemByName.set(subComponent.props.name, menuItem);\n\t});\n};\n\n/**\n * activeMenuItem нужен:\n * - для вывода текста активной вкладки в меню с popup\n * - для вывода компонента активной вкладки (store.component)\n * - для установки store.scrollable\n */\nconst activeMenuItem: Ref<MenuItem | null> = ref(null);\n\n/**\n * Кол-во изменений активной вкладки\n */\nlet countChanged = 0;\n\n/**\n * Смена активной вкладки\n *\n * TODO: смена slot, например смена языка, требует повторного выполнения setMenuItemByName()\n */\nwatch(\n\t() => store.activeItemName,\n\tasync () => {\n\t\tconst numberChanged = ++countChanged; // порядковый номер текущего изменения\n\n\t\tif (menuItemByName.size === 0) {\n\t\t\tsetMenuItemByName();\n\t\t}\n\n\t\tif (menuItemByName.size === 0) {\n\t\t\tstore.activeItemName = '';\n\n\t\t\treturn;\n\t\t}\n\n\t\tactiveMenuItem.value = menuItemByName.get(store.activeItemName) ?? null;\n\n\t\t// элемент не найден, установить из хеша страницы\n\t\tif (!activeMenuItem.value && store.$id) {\n\t\t\tconst activeItemName = getHash(store.$id);\n\n\t\t\tactiveMenuItem.value = menuItemByName.get(activeItemName) ?? null;\n\n\t\t\tif (activeMenuItem.value) {\n\t\t\t\tstore.activeItemName = activeItemName;\n\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// элемент не найден, установить первый доступный\n\t\tif (!activeMenuItem.value) {\n\t\t\tstore.activeItemName = menuItemByName.keys().next().value!;\n\n\t\t\treturn;\n\t\t}\n\n\t\t// запрошена смена на уже активный элемент\n\t\tif (activeMenuItem.value.component === store.component) {\n\t\t\tisLoading.value = false;\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (store.$id) setHash(store.$id, store.activeItemName, false);\n\n\t\t// флаг загрузки будет сброшен при инициализации компонента\n\t\tisLoading.value = true;\n\n\t\t/**\n\t\t * Презагрузить компонент\n\t\t *\n\t\t * Нужно для того, чтобы минимизировать скачки интерфейса при ожидании загрузки асинхронного компонента\n\t\t */\n\t\tawait preResolveComponent(activeMenuItem.value.component, () => numberChanged === countChanged);\n\n\t\t// влкадка была сменена еще раз во время sleepWhile\n\t\tif (numberChanged !== countChanged) {\n\t\t\treturn;\n\t\t}\n\n\t\tstore.scrollable = activeMenuItem.value.scrollable;\n\t\tstore.component = activeMenuItem.value.component;\n\n\t\tif (activeMenuItem.value && !store.component) {\n\t\t\tconsole.warn(`Компонент вкладки ${store.activeItemName} не найден. Добавьте props.component для пункта меню ${store.activeItemName}.`);\n\t\t}\n\t},\n\t{ immediate: true },\n);\n\nconst elRef = ref();\nlet resizeObserver: ResizeObserver;\n\nonMounted(() => {\n\tresizeObserver = new ResizeObserver(() => {\n\t\telRef.value.parentElement.style.setProperty('--top-tabsView-contents-offset-top', elRef.value.offsetHeight + 'px');\n\t});\n\n\tresizeObserver.observe(elRef.value);\n});\n\nonUnmounted(() => {\n\tresizeObserver.disconnect();\n});\n</script>\n\n<template>\n\t<div\n\t\tref=\"elRef\"\n\t\t:class=\"{\n\t\t\t'top-tabsView_menu': true,\n\t\t\t'top-tabsView_menu-inPopup_0': !store.showMenuInPopup,\n\t\t\t'top-tabsView_menu-inPopup_1': store.showMenuInPopup,\n\t\t\t'top-tabsView_menu-short': store.isShort && !store.showMenuInPopup,\n\t\t}\"\n\t>\n\t\t<!-- Спрятать меню под кнопку в popup -->\n\t\t<TopPopup v-if=\"store.showMenuInPopup\">\n\t\t\t<template #opener>\n\t\t\t\t<div class=\"top-tabsView_menuOpener\">\n\t\t\t\t\t<div\n\t\t\t\t\t\tv-if=\"activeMenuItem\"\n\t\t\t\t\t\tclass=\"top-tabsView_menuOpenerActiveItem\"\n\t\t\t\t\t\t:data-top-icon=\"activeMenuItem.icon\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<span class=\"top-ellipsis\">\n\t\t\t\t\t\t\t{{ activeMenuItem.title }}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div class=\"top-tabsView_menuOpenerIcon\" data-top-icon=\"\"></div>\n\t\t\t\t</div>\n\t\t\t</template>\n\n\t\t\t<template #contentList>\n\t\t\t\t<slot></slot>\n\t\t\t</template>\n\t\t</TopPopup>\n\n\t\t<!-- Отобразить меню на странице -->\n\t\t<template v-else>\n\t\t\t<div class=\"top-tabsView_menuList\">\n\t\t\t\t<slot></slot>\n\t\t\t</div>\n\n\t\t\t<div\n\t\t\t\tv-if=\"isShortable\"\n\t\t\t\tclass=\"top-tabsView_menuFooter\"\n\t\t\t>\n\t\t\t\t<TabsViewMenuItem\n\t\t\t\t\tv-if=\"isShortable\"\n\t\t\t\t\t:icon=\"store.isShort ? '' : ''\"\n\t\t\t\t\t@click=\"store.isShort = !store.isShort\"\n\t\t\t\t>\n\t\t\t\t\t{{ store.isShort ? '' : 'Свернуть' }} <!--TODO: translate-->\n\t\t\t\t</TabsViewMenuItem>\n\t\t\t</div>\n\t\t</template>\n\t</div>\n</template>\n\n<style>\n/* режим отображение табов в основной области документа */\n.top-tabsView-pageMod .top-tabsView_menu {\n\tbox-sizing: border-box;\n\tposition: sticky;\n\ttop: var(--top-tabsView-top);\n\tz-index: 10;\n}\n\n/* режим отображение табов в основной области документа без popup */\n.top-tabsView-pageMod .top-tabsView_menu-inPopup_0 {\n\theight: calc(var(--100vh) - var(--top-tabsView-top));\n}\n\n/* стантартный режим */\n.top-tabsView_menu-inPopup_0 {\n\tbox-sizing: border-box;\n\twidth: var(--top-tabsView-menu-width);\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\tflex-shrink: 0;\n}\n\n/* режим вывода в popup */\n.top-tabsView_menu-inPopup_1 {\n\tborder-bottom: 1px solid var(--color-line-2-opacity);\n}\n\n.top-tabsView_menu-short {\n\twidth: auto;\n}\n\n.top-tabsView_menu > .top-tabsView_menuOpener {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n}\n\n.top-tabsView_menu > .top-tabsView_menuOpener:hover {\n\tbackground: var(--color-layer-1);\n}\n\n.top-tabsView_menuOpenerIcon { display: flex; }\n\n.top-tabsView_menuOpenerActiveItem {\n\t--top-forms-padding: 0px;\n\n\tbox-sizing: border-box;\n\tpadding: var(--top-padding-2);\n\tmax-width: calc(100% - var(--top-forms-base-height));\n\twhite-space: nowrap;\n\tflex-grow: 1;\n\tdisplay: flex;\n\talign-items: center;\n\tgap: var(--top-padding-2);\n}\n\n.top-tabsView_menuList,\n.top-tabsView_menuFooter {\n\tpadding: var(--top-padding-2);\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: var(--top-gap-2);\n}\n\n.top-tabsView_menuList {\n\toverflow-y: auto;\n}\n\n.top-tabsView_menu-short .top-tabsView_menuFooter > .top-tabsView_menuItem {\n\t--top-icon-width: 100%;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { defineModel, onMounted, onUnmounted, ref, watch } from 'vue';\nimport Core from '@/core/core/core';\nimport { delHash } from '@/core/utils/route';\nimport type { Props } from './tabsView';\nimport { defineTabsStore } from './store';\nimport TabsViewMenu from './menu.vue';\nimport TopLoadbar from '@/components/forms/loadbar/loadbar.vue';\nimport { checkComponentIsLoading } from './utils';\n\nconst props = withDefaults(defineProps<Props>(), {\n\tshowMenuInPopup: undefined,\n\tisShortable: false,\n});\n\nconst model = defineModel<string>();\n\nconst store = defineTabsStore(props, model);\n\nconst uid = Math.random();\n\nif (props.pageMod) Core.state.documentClassModificators.set(uid, 'top-hasTabsViewPageMod');\n\nonUnmounted(() => {\n\tif (props.pageMod) Core.state.documentClassModificators.delete(uid);\n\n\tif (store.$id) delHash(store.$id, store.activeItemName, true);\n});\n\nconst componentRef = ref();\nconst isLoading = ref(false);\n\nwatch([componentRef, () => store.component], () => {\n\tisLoading.value = checkComponentIsLoading(store.component);\n}, { immediate: true });\n</script>\n\n<template>\n\t<div\n\t\t:class=\"{\n\t\t\t'top-tabsView': true,\n\t\t\t'top-tabsView-pageMod': props.pageMod,\n\t\t\t'top-tabsView-inPopup': store.showMenuInPopup,\n\t\t}\"\n\t>\n\t\t<TabsViewMenu\n\t\t\t:isShortable=\"isShortable\"\n\t\t\tv-model:isLoading=\"isLoading\"\n\t\t>\n\t\t\t<!-- @slot Меню, ожидает передачу компонентов TabsViewMenuItem и TabsViewMenuTitle -->\n\t\t\t<slot name=\"menu\"></slot>\n\t\t</TabsViewMenu>\n\n\t\t<div\n\t\t\t:class=\"{\n\t\t\t\t'top-tabsView_contents': true,\n\t\t\t\t'top-tabsView_contents-isLoading': isLoading,\n\t\t\t\t'top-tabsView_contents-noScrollable': !store.scrollable,\n\t\t\t}\"\n\t\t>\n\t\t\t<TopLoadbar v-if=\"isLoading\"/>\n\n\t\t\t<keep-alive>\n\t\t\t\t<component\n\t\t\t\t\tref=\"componentRef\"\n\t\t\t\t\t:is=\"store.component\"\n\t\t\t\t/>\n\t\t\t</keep-alive>\n\t\t</div>\n\t</div>\n</template>\n\n<style>\n:root {\n\t--top-tabsView-top: 0px;\n\t--top-tabsView-menu-width: 220px;\n\t--top-tabsView-contents-offset-top: 0px;\n}\n\n.top-tabsView {\n\tbackground: var(--color-layout-middle);\n\twidth: 100%;\n\theight: 100%;\n\tdisplay: flex;\n\tflex-direction: row;\n}\n\n.top-tabsView_contents {\n\tborder-radius: var(--top-radius-4);\n\tbackground: var(--color-layout-front-1);\n\tpadding: var(--top-padding-4);\n\tflex-grow: 1;\n\toverflow: auto;\n\tposition: relative;\n}\n\n.top-tabsView_contents-isLoading {\n\tpointer-events: none;\n}\n\n.top-tabsView_contents-noScrollable {\n\twidth: calc(100% - var(--top-tabsView-menu-width));\n\tpadding: 0;\n\toverflow: visible;\n}\n\n/* top-tabsView-inPopup */\n.top-tabsView-inPopup {\n\tbackground: var(--color-layout-front-1);\n\tflex-direction: column;\n}\n\n.top-tabsView-inPopup > .top-tabsView_contents {\n\tborder-radius: 0;\n}\n\n.top-tabsView-inPopup > .top-tabsView_contents-noScrollable {\n\twidth: auto;\n}\n</style>\n","<script setup lang=\"ts\">\n\n</script>\n\n<template>\n\t<div class=\"top-tabsView_menuDelimeter\"></div>\n</template>\n\n<style>\n.top-tabsView_menuDelimeter {\n\tpadding: var(--top-padding-1) 0;\n\tdisplay: flex;\n}\n\n.top-tabsView_menuDelimeter:before {\n\tcontent: \"\";\n\theight: 2px;\n\tbackground: var(--color-line-2);\n\tflex-grow: 1;\n}\n\n.top-tabsView_menuDelimeter:first-child,\n.top-tabsView_menuDelimeter + .top-tabsView_menuDelimeter {\n\tdisplay: none;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { useTabsStore } from './store';\nimport type { PropsMenuTitle } from './tabsView';\nimport TabsViewMenuDelimeter from './menuDelimeter.vue';\nimport { TopPopupListItem } from '../../popup/popup';\n\ndefineProps<PropsMenuTitle>();\n\nconst store = useTabsStore();\n</script>\n\n<template>\n\t<TopPopupListItem\n\t\tv-if=\"store.showMenuInPopup\"\n\t\ttype=\"title\"\n\t>\n\t\t<slot></slot>\n\t</TopPopupListItem>\n\n\t<TabsViewMenuDelimeter v-else-if=\"store.isShort\"/>\n\n\t<div\n\t\tv-else\n\t\t:class=\"{\n\t\t\t'top-tabsView_menuTitle': true,\n\t\t\t'top-tabsView_menuTitle-subtitle': isSubtitle,\n\t\t}\"\n\t>\n\t\t<slot></slot>\n\t</div>\n</template>\n\n<style>\n.top-tabsView_menuTitle {\n\tpadding: var(--top-padding-4) var(--top-padding-2) var(--top-padding-1);\n\tfont-weight: 600;\n\tcolor: var(--color-text-1);\n}\n\n.top-tabsView_menuTitle-subtitle {\n\tpadding-top: var(--top-padding-1);\n\tfont-size: 12px;\n\tfont-weight: 400;\n\tcolor: var(--color-text-2);\n}\n</style>\n","import type { ComponentCustomProps } from 'vue';\n\nimport TabsView from './tabsView/tabsView.vue';\nimport TabsViewMenuItem from './tabsView/menuItem.vue';\nimport TabsViewMenuTitle from './tabsView/menuTitle.vue';\n\nexport const TopTabsView = TabsView as typeof TabsView & ComponentCustomProps;\nexport const TopTabsViewMenuItem = TabsViewMenuItem as typeof TabsViewMenuItem & ComponentCustomProps;\nexport const TopTabsViewMenuTitle = TabsViewMenuTitle as typeof TabsViewMenuTitle & ComponentCustomProps;\n"],"names":["genStorageKey","stateName","stateKey","loadLocalStorge","store","localStorageKey","localStorageValue","addSaverLocalStorge","watch","StoreLocalStorage","popstateCallbacks","e","popstateCallback","injectionKey","defineTabsStore","props","model","defineStore","showMenuInPopup","computed","Core","pageMod","isShort","ref","component","scrollable","getHash","useTabsStore","useStore","__props","href","genHash","tagName","TopPopupListItem","onClick","checkComponentIsLoading","preResolveComponent","condition","sleepWhile","isLoading","useModel","slots","useSlots","menuItemByName","setMenuItemByName","item","setMenuItemByNameFromItems","menuItems","subComponent","_sfc_main$4","_a","_b","menuItem","_d","_c","markRaw","activeMenuItem","countChanged","numberChanged","activeItemName","setHash","elRef","resizeObserver","onMounted","onUnmounted","uid","delHash","componentRef","_sfc_render","_ctx","_cache","TopTabsView","_sfc_main$2","TopTabsViewMenuItem","TopTabsViewMenuTitle","_sfc_main"],"mappings":";;;;;;;;;AAQA,MAAAA,IAAA,CAAAC,GAAAC,MAGC,OAFA,OAAAD,CAAA,CAEA,IAAAC,CAAA,IAQDC,KAAA,CAAAF,GAAAG,MAAA;AAEC,MAAA,CAAAA,EAAA,IAAA;AAEA,QAAAC,IAAAL,EAAAC,GAAAG,EAAA,GAAA;AAEA,MAAA;AACC,UAAAE,IAAA,KAAA,MAAA,aAAA,QAAAD,CAAA,CAAA;AAEA,IAAA,OAAAC,KAAA,OAAAF,EAAAH,CAAA,MACCG,EAAAH,CAAA,IAAAK;AAAA,EACD,QAAA;AAEA,YAAA,KAAA,IAAA,MAAA,kBAAAD,CAAA,sBAAA,CAAA;AAAA,EAA+E;AAEjF,GAOAE,KAAA,CAAAN,GAAAG,MAAA;AAEC,MAAA,CAAAA,EAAA,IAAA;AAEA,QAAAC,IAAAL,EAAAC,GAAAG,EAAA,GAAA;AAEA,EAAAI,EAAA,MAAAJ,EAAAH,CAAA,GAAA,MAAA;AACC,iBAAA,QAAAI,GAAA,KAAA,UAAAD,EAAAH,CAAA,CAAA,CAAA;AAAA,EAAsE,GAAA,EAAA,WAAA,GAAA,CAAA;AAExE,GAEAQ,IAAA;AAAA,EAAe,iBAAAN;AAAA,EACd,qBAAAI;AA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|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
define(["require","exports","../.chunks/forms-
|
|
1
|
+
define(["require","exports","../.chunks/forms-CJ5N_pAq.amd"],function(l,t,e){"use strict";if(typeof r>"u")var r=window.Vue;async function a(o,n=!1){let i=!1;return navigator.clipboard&&(await navigator.clipboard.writeText(o),i=!0,n&&e.Core.notice(e.useI18n().Common.Copied_to_clipboard+"","info")),i}async function u(o){let n=!1;e.isSafari()||(n=await a(o));const i='<a href="'+o+'" target="_blank">'+o+"</a>",c=e.useI18n().Common.Copied_to_clipboard+`:
|
|
2
2
|
`+i;if(n)e.Core.notice(c,"info");else{if(!navigator.clipboard){e.Core.notice(e.useI18n().Common.Cannot_copied_to_clipboard+`:
|
|
3
3
|
`+e.useI18n().Common.Copy_guest_link_manually+`
|
|
4
4
|
`+i,"error");return}const d={onclick:()=>a(o).then(()=>e.Core.notice(c,"info")),default:e.useI18n().Common.Copy+"",class:"copy"};await e.Core.notice(e.useI18n().Common.Guest_link_created+`
|
package/utils/clipboard.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as t, u as a, b as s } from "../.chunks/forms-
|
|
1
|
+
import { C as t, u as a, b as s } from "../.chunks/forms-Dg0Huskq.es.js";
|
|
2
2
|
async function r(o, e = !1) {
|
|
3
3
|
let i = !1;
|
|
4
4
|
return navigator.clipboard && (await navigator.clipboard.writeText(o), i = !0, e && t.notice(a().Common.Copied_to_clipboard + "", "info")), i;
|