@topvisor/ui 1.0.27 → 1.0.28-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.chunks/{core-BmIJ2adg.amd.js → core-CAMGByIQ.amd.js} +2 -2
- package/.chunks/{core-BmIJ2adg.amd.js.map → core-CAMGByIQ.amd.js.map} +1 -1
- package/.chunks/{core-C0QEqD1d.es.js → core-asoGK-7D.es.js} +4 -4
- package/.chunks/{core-C0QEqD1d.es.js.map → core-asoGK-7D.es.js.map} +1 -1
- package/.chunks/{datepicker-CXhUvPw5.es.js → datepicker-BYBYKhbw.es.js} +2 -2
- package/.chunks/{datepicker-CXhUvPw5.es.js.map → datepicker-BYBYKhbw.es.js.map} +1 -1
- package/.chunks/{datepicker-bNYuHqTY.amd.js → datepicker-BvawRSTl.amd.js} +2 -2
- package/.chunks/{datepicker-bNYuHqTY.amd.js.map → datepicker-BvawRSTl.amd.js.map} +1 -1
- package/.chunks/{dialog_selectorRegions-kjMlLJUX.es.js → dialog_selectorRegions-CpBiVjgI.es.js} +4 -4
- package/.chunks/{dialog_selectorRegions-kjMlLJUX.es.js.map → dialog_selectorRegions-CpBiVjgI.es.js.map} +1 -1
- package/.chunks/{dialog_selectorRegions-D9DQxYlD.amd.js → dialog_selectorRegions-DVz3N6Dj.amd.js} +2 -2
- package/.chunks/{dialog_selectorRegions-D9DQxYlD.amd.js.map → dialog_selectorRegions-DVz3N6Dj.amd.js.map} +1 -1
- package/.chunks/{dialogs.vue_vue_type_script_setup_true_lang-IEhQGR1d.es.js → dialogs.vue_vue_type_script_setup_true_lang--09NOqOd.es.js} +2 -2
- package/.chunks/{dialogs.vue_vue_type_script_setup_true_lang-IEhQGR1d.es.js.map → dialogs.vue_vue_type_script_setup_true_lang--09NOqOd.es.js.map} +1 -1
- package/.chunks/{dialogs.vue_vue_type_script_setup_true_lang-ChHXFPiF.amd.js → dialogs.vue_vue_type_script_setup_true_lang-BCvCrDYf.amd.js} +2 -2
- package/.chunks/{dialogs.vue_vue_type_script_setup_true_lang-ChHXFPiF.amd.js.map → dialogs.vue_vue_type_script_setup_true_lang-BCvCrDYf.amd.js.map} +1 -1
- package/.chunks/{forms-CJ5N_pAq.amd.js → forms-CD0nOB5f.amd.js} +3 -3
- package/.chunks/{forms-CJ5N_pAq.amd.js.map → forms-CD0nOB5f.amd.js.map} +1 -1
- package/.chunks/{forms-Dg0Huskq.es.js → forms-qJ3k2PG6.es.js} +7 -7
- package/.chunks/{forms-Dg0Huskq.es.js.map → forms-qJ3k2PG6.es.js.map} +1 -1
- package/.chunks/{listItem.vue_vue_type_script_setup_true_lang-Ccx-3_PR.amd.js → listItem.vue_vue_type_script_setup_true_lang-BAEJrRYd.amd.js} +2 -2
- package/.chunks/{listItem.vue_vue_type_script_setup_true_lang-Ccx-3_PR.amd.js.map → listItem.vue_vue_type_script_setup_true_lang-BAEJrRYd.amd.js.map} +1 -1
- package/.chunks/{listItem.vue_vue_type_script_setup_true_lang-CN0_pb-f.es.js → listItem.vue_vue_type_script_setup_true_lang-BlC9NJdi.es.js} +2 -2
- package/.chunks/{listItem.vue_vue_type_script_setup_true_lang-CN0_pb-f.es.js.map → listItem.vue_vue_type_script_setup_true_lang-BlC9NJdi.es.js.map} +1 -1
- package/.chunks/{menu.vue_vue_type_style_index_0_lang-B9HkLtVf.es.js → menu.vue_vue_type_style_index_0_lang-CDkyMyEi.es.js} +2 -2
- package/.chunks/{menu.vue_vue_type_style_index_0_lang-B9HkLtVf.es.js.map → menu.vue_vue_type_style_index_0_lang-CDkyMyEi.es.js.map} +1 -1
- package/.chunks/{menu.vue_vue_type_style_index_0_lang-Bn4GA1gj.amd.js → menu.vue_vue_type_style_index_0_lang-Oq5353Ax.amd.js} +2 -2
- package/.chunks/{menu.vue_vue_type_style_index_0_lang-Bn4GA1gj.amd.js.map → menu.vue_vue_type_style_index_0_lang-Oq5353Ax.amd.js.map} +1 -1
- package/.chunks/{notice-COAtZx4K.amd.js → notice-rP8nJxrF.amd.js} +2 -2
- package/.chunks/{notice-COAtZx4K.amd.js.map → notice-rP8nJxrF.amd.js.map} +1 -1
- package/.chunks/{notice-DfI-Ga6e.es.js → notice-somyoQTl.es.js} +2 -2
- package/.chunks/{notice-DfI-Ga6e.es.js.map → notice-somyoQTl.es.js.map} +1 -1
- package/.chunks/{page.vue_vue_type_script_setup_true_lang-CQbcjBRq.amd.js → page.vue_vue_type_script_setup_true_lang-D8EtPAsl.amd.js} +2 -2
- package/.chunks/{page.vue_vue_type_script_setup_true_lang-CQbcjBRq.amd.js.map → page.vue_vue_type_script_setup_true_lang-D8EtPAsl.amd.js.map} +1 -1
- package/.chunks/{page.vue_vue_type_script_setup_true_lang-DqkGsz8-.es.js → page.vue_vue_type_script_setup_true_lang-SJpF_87B.es.js} +4 -4
- package/.chunks/{page.vue_vue_type_script_setup_true_lang-DqkGsz8-.es.js.map → page.vue_vue_type_script_setup_true_lang-SJpF_87B.es.js.map} +1 -1
- package/.chunks/{popup-Cvlw738y.amd.js → popup-BpdlKk5T.amd.js} +2 -2
- package/.chunks/{popup-Cvlw738y.amd.js.map → popup-BpdlKk5T.amd.js.map} +1 -1
- package/.chunks/{popup-ScwGndLi.es.js → popup-NHfxJUAB.es.js} +2 -2
- package/.chunks/{popup-ScwGndLi.es.js.map → popup-NHfxJUAB.es.js.map} +1 -1
- package/.chunks/{utils-6pAQX17-.es.js → utils-B-1oTT6I.es.js} +2 -2
- package/.chunks/{utils-6pAQX17-.es.js.map → utils-B-1oTT6I.es.js.map} +1 -1
- package/.chunks/{utils-Kng8viAk.amd.js → utils-BPFSJAiy.amd.js} +2 -2
- package/.chunks/{utils-Kng8viAk.amd.js.map → utils-BPFSJAiy.amd.js.map} +1 -1
- package/.chunks/{utils-dA01j_vJ.amd.js → utils-CZwaa5j-.amd.js} +2 -2
- package/.chunks/{utils-dA01j_vJ.amd.js.map → utils-CZwaa5j-.amd.js.map} +1 -1
- package/.chunks/{utils-B8OQ-bo6.es.js → utils-DI9i3mGB.es.js} +3 -3
- package/.chunks/{utils-B8OQ-bo6.es.js.map → utils-DI9i3mGB.es.js.map} +1 -1
- package/assets/core.css +1 -1
- package/assets/forms.css +1 -1
- package/assets/formsExt.css +1 -1
- package/charts/charts.amd.js +1 -1
- package/charts/charts.js +1 -1
- package/components/formsExt/checkboxGroup/checkboxGroup.vue.d.ts +16 -0
- package/components/formsExt/checkboxGroup/types.d.ts +20 -0
- package/components/formsExt/formsExt.d.ts +2 -0
- package/core/app.amd.js +1 -1
- package/core/app.js +5 -5
- package/dialog/dialog.amd.js +1 -1
- package/dialog/dialog.js +2 -2
- package/forms/forms.amd.js +1 -1
- package/forms/forms.js +1 -1
- package/formsExt/formsExt.amd.js +1 -1
- package/formsExt/formsExt.amd.js.map +1 -1
- package/formsExt/formsExt.js +278 -226
- 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.js +1 -1
- package/utils/clipboard.amd.js +1 -1
- package/utils/clipboard.js +1 -1
- package/utils/date.amd.js +1 -1
- package/utils/date.js +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/charts/charts.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Core as P } from "../core/app.js";
|
|
2
2
|
import { defineComponent as T, mergeModels as S, useModel as $, computed as h, createElementBlock as i, openBlock as a, normalizeClass as f, createElementVNode as r, createCommentVNode as k, toDisplayString as g, Fragment as w, renderList as H, normalizeStyle as L, unref as F, ref as b, watch as V, onMounted as N, onUnmounted as R, renderSlot as z, createBlock as G, Teleport as O } from "vue";
|
|
3
|
-
import { c as X } from "../.chunks/forms-
|
|
3
|
+
import { c as X } from "../.chunks/forms-qJ3k2PG6.es.js";
|
|
4
4
|
import { percentOfNumber as I } from "../utils/number.js";
|
|
5
5
|
const E = ["../assets/charts.css"].map((v) => import.meta.resolve(v));
|
|
6
6
|
P.insertCSSLinkToPage(E, !0);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Props, Style } from './types';
|
|
2
|
+
import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
3
|
+
import { Size } from '../../forms/helpers';
|
|
4
|
+
type __VLS_Props = Props;
|
|
5
|
+
type __VLS_PublicProps = {
|
|
6
|
+
modelValue: Props['modelValue'];
|
|
7
|
+
} & __VLS_Props;
|
|
8
|
+
declare const _default: DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
9
|
+
"update:modelValue": (value: string[]) => any;
|
|
10
|
+
}, string, PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
11
|
+
"onUpdate:modelValue"?: ((value: string[]) => any) | undefined;
|
|
12
|
+
}>, {
|
|
13
|
+
size: Size;
|
|
14
|
+
styling: Style;
|
|
15
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Size, sizes } from '../../forms/helpers';
|
|
2
|
+
export interface Item {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
icon?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface Props {
|
|
9
|
+
modelValue: Item['id'][];
|
|
10
|
+
items: Item[];
|
|
11
|
+
size?: Size;
|
|
12
|
+
styling?: Style;
|
|
13
|
+
isError?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const styling: {
|
|
16
|
+
readonly outline: "outline";
|
|
17
|
+
readonly borderless: "borderless";
|
|
18
|
+
};
|
|
19
|
+
export type Style = typeof styling[keyof typeof styling];
|
|
20
|
+
export { sizes };
|
|
@@ -2,12 +2,14 @@ import { ComponentCustomProps } from 'vue';
|
|
|
2
2
|
import { default as EditArea } from './editArea/editArea.vue';
|
|
3
3
|
import { default as EditInput } from './editInput/editInput.vue';
|
|
4
4
|
import { default as RadioGroup } from './radioGroup/radioGroup.vue';
|
|
5
|
+
import { default as CheckboxGroup } from './checkboxGroup/checkboxGroup.vue';
|
|
5
6
|
import { default as Selector2 } from './selector2/selector2.vue';
|
|
6
7
|
import { default as Menu } from './menu/menu.vue';
|
|
7
8
|
import { default as Info } from './info/info.vue';
|
|
8
9
|
export declare const TopEditArea: typeof EditArea & ComponentCustomProps;
|
|
9
10
|
export declare const TopEditInput: typeof EditInput & ComponentCustomProps;
|
|
10
11
|
export declare const TopRadioGroup: typeof RadioGroup & ComponentCustomProps;
|
|
12
|
+
export declare const TopCheckboxGroup: typeof CheckboxGroup & ComponentCustomProps;
|
|
11
13
|
export declare const TopSelector2: typeof Selector2 & ComponentCustomProps;
|
|
12
14
|
export declare const TopMenu: typeof Menu & ComponentCustomProps;
|
|
13
15
|
export declare const TopInfo: typeof Info & ComponentCustomProps;
|
package/core/app.amd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
define(["require","exports","../.chunks/forms-
|
|
1
|
+
define(["require","exports","../.chunks/forms-CD0nOB5f.amd","../.chunks/core-CAMGByIQ.amd","vue","../utils/clipboard.amd","../utils/string.amd","../utils/route.amd","../.chunks/utils-BPFSJAiy.amd","../.chunks/dialogs.vue_vue_type_script_setup_true_lang-BCvCrDYf.amd"],function(y,n,c,l,d,m,S,p,g,k){"use strict";if(typeof d>"u")var d=window.Vue;class E{#s;#t;#e;#i;#c;#a=[];#o=[];#n=[];#r=[];constructor(s){var t;this.#t=s.store,this.#s=this.#t.$id,this.#e=s.options.Page,this.#i=s.options.user,this.#c=s.options.Api,this.#a=s.options.tpaNamesUrlHash||[],this.#o=s.options.tpaNamesStorage||[],this.#n=s.options.tpaNamesStorageLocal||[],this.#r=s.options.tpaNamesGuestLink||[],s.store.genGuestLink=(i,a)=>this.genGuestLink(i,a),(t=this.#i.guest_data)!=null&&t.data||(this.#u(),this.#u(!0),this.#l()),this.#S(),this.#k();const e=c.debounce(()=>{this.#m(),this.#p(),this.#p(!0)});s.store.$subscribe(e)}async genGuestLink(s,e){const t=this.#g();e=Object.assign(e,Object.fromEntries(t));const i=await this.#c.gen(s,"fetchColumn").call({},e);i!=null&&i.errors||await m.guestLinkToClipboard(i.result)}#g(){const s=new Map;return this.#r.forEach(e=>{const t=S.camelToSnakeCase(e);s.set(t,this.#t[e])}),s}#h(s){s.forEach((e,t)=>{const i=this.#t[t];if(e!=null&&i!==void 0&&e!=null&&e.constructor&&e.constructor===i.constructor){if(t.indexOf("date")===0&&!Array.isArray(e)){if(typeof e=="string"&&!/\d\d\d\d-\d\d-\d\d/.test(e))return}this.#t[t]=e}})}#f(s){const e=new Map;return s.forEach((t,i)=>{t!==null&&(t=JSON.stringify(t),e.set(i,t))}),e}#d(s){const e=new Map;return s.forEach((t,i)=>{if(!(t==null||t==="false")){try{if(typeof t=="string"&&!/^\d\d\d\d-\d\d-\d\d$/.test(t)&&(t=JSON.parse(t)),t==null||t==="false")return}catch{}e.set(i,t)}}),e}#l(){let s;try{s=JSON.parse(p.getHash(this.#s))}catch{}if(!s)return;const e=new Map;this.#a.forEach(t=>{const i=s[t];i&&e.set(t,i)}),this.#h(e)}#m(){const s=new Map;this.#a.forEach(i=>{const a=this.#t[i];s.set(i,a)});const e=Object.fromEntries(s),t=JSON.stringify(e);p.setHash(this.#s,t)}#u(s=!1){const e=new Map;let t=this.#o,i="state:"+this.#s;s&&(t=this.#n,i="state:"+this.#s+":"+location.pathname),t.forEach(o=>{const r=localStorage.getItem(i+":"+o);e.set(o,r)});const a=this.#d(e);this.#h(a)}#p(s=!1){const e=new Map;let t=this.#o,i="state:"+this.#s;s&&(t=this.#n,i="state:"+this.#s+":"+location.pathname),t.forEach(o=>{const r=this.#t[o];e.set(o,r)});const a=this.#f(e);t.forEach(o=>{const r=a.get(o);localStorage.setItem(i+":"+o,r)})}#S(){var a,o,r;const s=(o=(a=this.#i)==null?void 0:a.guest_data)==null?void 0:o.data;if(!s)return;this.#i.id===-1&&(this.#i.positionsReverseDates=s.positionsReverseDates);const e=new Map;this.#r.forEach(h=>{const u=s[h];e.set(h,u)});const t=this.#d(e);this.#h(t);const i=$(".mod_guest_title");if(((r=this.#t.competitorsIds)==null?void 0:r.length)===1&&this.#e.page.data.competitors){let h=this.#e.page.data.competitors.filter(u=>u.id===s.competitorsIds[0]);h.length&&($("a",i).attr("href","http://"+h[0].url),$("a",i).text(h[0].name))}}#k(){this.#t.regionsIndexes&&d.watch(this.#t.regionsIndexes,s=>{if(!s.length)return;s.forEach((i,a)=>s[a]=i);const e=TplProjectSelectorRegion.genSearchersMap(),t=[];e.forEach(i=>{i.regions.forEach(a=>{a.index!==-1&&t.push(a.index)})}),this.#t.regionsIndexes=s.filter(i=>t.includes(i))},{immediate:!0}),this.#t.competitorsIds&&d.watch(this.#t.competitorsIds,s=>{if(!s.length)return;s.forEach((t,i)=>s[i]=t);const e=[this.#e.page.data.project.id];this.#e.page.data.project.competitors.forEach(t=>{t.on>=0&&e.push(t.id)}),this.#t.competitorsIds=s.filter(t=>e.includes(t))},{immediate:!0})}}const w=f=>{var e,t,i,a;const s=f;!((e=s.options.tpaNamesUrlHash)!=null&&e.length)&&!((t=s.options.tpaNamesStorage)!=null&&t.length)&&!((i=s.options.tpaNamesStorageLocal)!=null&&i.length)&&!((a=s.options.tpaNamesGuestLink)!=null&&a.length)||new E(s)};n.Core=c.Core,n.i18nPlugin=c.i18n,n.useI18n=c.useI18n,n.useI18nLang=c.useI18nLang,n.corePlugin=l.core,n.useAsyncTopDialog=g.useAsyncTopDialog,n.useTopDialog=g.useTopDialog,n.TopDialogWorker=k.TopDialogWorker,n.piniaTPAPlugin=w,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
|
|
2
2
|
//# sourceMappingURL=app.amd.js.map
|
package/core/app.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { d } from "../.chunks/forms-
|
|
2
|
-
import { C as P, i as T, u as b, a as y } from "../.chunks/forms-
|
|
3
|
-
import { c as G } from "../.chunks/core-
|
|
1
|
+
import { d } from "../.chunks/forms-qJ3k2PG6.es.js";
|
|
2
|
+
import { C as P, i as T, u as b, a as y } from "../.chunks/forms-qJ3k2PG6.es.js";
|
|
3
|
+
import { c as G } from "../.chunks/core-asoGK-7D.es.js";
|
|
4
4
|
import { watch as p } from "vue";
|
|
5
5
|
import { guestLinkToClipboard as f } from "../utils/clipboard.js";
|
|
6
6
|
import { camelToSnakeCase as g } from "../utils/string.js";
|
|
7
7
|
import { getHash as m, setHash as l } from "../utils/route.js";
|
|
8
|
-
import { u as A, a as D } from "../.chunks/utils-
|
|
9
|
-
import { T as j } from "../.chunks/dialogs.vue_vue_type_script_setup_true_lang
|
|
8
|
+
import { u as A, a as D } from "../.chunks/utils-B-1oTT6I.es.js";
|
|
9
|
+
import { T as j } from "../.chunks/dialogs.vue_vue_type_script_setup_true_lang--09NOqOd.es.js";
|
|
10
10
|
class u {
|
|
11
11
|
#s;
|
|
12
12
|
#t;
|
package/dialog/dialog.amd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
define(["require","exports","../.chunks/page.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
define(["require","exports","../.chunks/page.vue_vue_type_script_setup_true_lang-D8EtPAsl.amd","vue","../.chunks/utils-BPFSJAiy.amd"],function(c,n,u,e,t){"use strict";if(typeof e>"u")var e=window.Vue;const i={name:{type:String,required:!0},order:{type:Number,required:!0},prevName:String,footerFullWith:Boolean},l=e.defineComponent({__name:"pageComponent",props:{component:{},keepAlive:{type:Boolean,default:!0},props:{},name:{},order:{},prevName:{},footerFullWith:{type:Boolean}},setup(m){const a=m,r=t.useTopDialogSelf(),s=(o,p)=>{if(!p.value){if(o.name!=="AsyncComponentWrapper"){p.value=!0;return}r.needShowPage(a.name)&&(r.isLoadingPage.value=!0,o.__asyncResolved&&(p.value=!0,r.isLoadingPage.value=!1))}};if(a.component.name==="AsyncComponentWrapper"){const o=e.ref(!1);e.onUpdated(()=>{s(a.component,o)})}return(o,p)=>(e.openBlock(),e.createBlock(e.KeepAlive,{include:o.keepAlive?"":"none"},[e.unref(r).needShowPage(o.name)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.component),e.mergeProps({key:0},a,{name:o.name,order:o.order,prevName:o.prevName}),null,16,["name","order","prevName"])):e.createCommentVNode("",!0)],1032,["include"]))}});n.TopDialog=u._sfc_main,n.TopDialogPage=u._sfc_main$1,n.useTopDialogSelf=t.useTopDialogSelf,n.TopDialogPageComponent=l,n.propsPageCommon=i,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
|
|
2
2
|
//# sourceMappingURL=dialog.amd.js.map
|
package/dialog/dialog.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { _ as k, a as B } from "../.chunks/page.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
import { _ as k, a as B } from "../.chunks/page.vue_vue_type_script_setup_true_lang-SJpF_87B.es.js";
|
|
2
2
|
import { defineComponent as l, ref as i, onUpdated as u, createBlock as a, openBlock as p, KeepAlive as s, createCommentVNode as d, unref as g, resolveDynamicComponent as c, mergeProps as f } from "vue";
|
|
3
|
-
import { b as v } from "../.chunks/utils-
|
|
3
|
+
import { b as v } from "../.chunks/utils-B-1oTT6I.es.js";
|
|
4
4
|
const C = {
|
|
5
5
|
name: {
|
|
6
6
|
type: String,
|
package/forms/forms.amd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
define(["require","exports","../.chunks/forms-
|
|
1
|
+
define(["require","exports","../.chunks/forms-CD0nOB5f.amd"],function(n,T,a){"use strict";if(typeof e>"u")var e=window.Vue;T.TopAvatar=a.TopAvatar,T.TopButton=a.TopButton,T.TopCheckbox=a.TopCheckbox,T.TopControlLabel=a.TopControlLabel,T.TopHint=a.TopHint,T.TopInput=a.TopInput,T.TopInputDate=a.TopInputDate,T.TopInputRange=a.TopInputRange,T.TopLoadbar=a.TopLoadbar,T.TopRadio=a.TopRadio,T.TopSelect=a.TopSelect,T.TopSwitcher=a.TopSwitcher,T.TopTextarea=a.TopTextarea,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})});
|
|
2
2
|
//# sourceMappingURL=forms.amd.js.map
|
package/forms/forms.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as p, g as T, h as s, j as t, k as e, l as n, m as r, n as l, o as u, p as b, q as c, r as h, s as i } from "../.chunks/forms-
|
|
1
|
+
import { T as p, g as T, h as s, j as t, k as e, l as n, m as r, n as l, o as u, p as b, q as c, r as h, s as i } from "../.chunks/forms-qJ3k2PG6.es.js";
|
|
2
2
|
export {
|
|
3
3
|
p as TopAvatar,
|
|
4
4
|
T as TopButton,
|
package/formsExt/formsExt.amd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
define(["require","exports","vue","../.chunks/forms-CJ5N_pAq.amd","../utils/keyboard.amd","../popup/popup.amd","../.chunks/menu.vue_vue_type_style_index_0_lang-Bn4GA1gj.amd","../require/css.amd!../assets/formsExt.css"],function(ae,V,e,B,$,w,I){"use strict";if(typeof e>"u")var e=window.Vue;const N={class:"top-editArea_footer"},M=e.defineComponent({__name:"editArea",props:{defaultValue:{default:""},title:{},cancelText:{default:"Cancel"},submitText:{default:"Send"},closeText:{default:"Close"},isFocused:{type:Boolean},forceShowCloseBtn:{type:Boolean},attachToKeyboard:{type:Boolean},modelValue:{},name:{},placeholder:{},styling:{},rows:{},minHeight:{},expandable:{type:Boolean,default:!0},disabled:{type:Boolean},readonly:{type:Boolean},isError:{type:Boolean},hint:{}},emits:["submit","close","clickOnTitle"],setup(i,{emit:r}){const t=i,l=r,m=e.ref(t.defaultValue),h=e.ref(t.isFocused),d=e.computed(()=>m.value!==t.defaultValue),f=a=>{l("submit",a),m.value=t.defaultValue},c=()=>{if(t.forceShowCloseBtn&&!d.value){l("close");return}m.value=t.defaultValue},v=()=>{t.attachToKeyboard&&l("clickOnTitle")};return(a,y)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"top-editArea":!0,"top-editArea-attachedToKeyboard":a.attachToKeyboard})},[a.title?(e.openBlock(),e.createElementBlock("div",{key:0,class:"top-editArea_title",onClick:y[0]||(y[0]=s=>v())},e.toDisplayString(a.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass({"top-editArea_form":!0,"top-error":a.isError,"top-focus":h.value})},[e.createVNode(B._sfc_main$3,{modelValue:m.value,"onUpdate:modelValue":y[1]||(y[1]=s=>m.value=s),name:a.name,placeholder:a.placeholder,rows:a.rows,minHeight:a.minHeight,expandable:a.expandable,disabled:a.disabled,readonly:a.readonly,isError:a.isError,hint:a.hint,class:"top-editArea_element",onFocus:y[2]||(y[2]=()=>h.value=!0),onBlur:y[3]||(y[3]=()=>h.value=!1),onKeyup:[e.withKeys(c,["esc"]),y[4]||(y[4]=e.withKeys(e.withModifiers(s=>f(m.value),["ctrl"]),["enter"]))]},null,8,["modelValue","name","placeholder","rows","minHeight","expandable","disabled","readonly","isError","hint"]),e.createElementVNode("div",N,[d.value||a.forceShowCloseBtn?(e.openBlock(),e.createBlock(B._sfc_main,{key:0,icon:a.$core.state.isMobile?"":"",class:"top-editArea_button",color:"theme",styling:"soft",onClick:c},e.createSlots({_:2},[a.$core.state.isMobile?void 0:{name:"default",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.cancelText),1)]),key:"0"}]),1032,["icon"])):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createBlock(B._sfc_main,{key:1,class:"top-editArea_button",icon:a.$core.state.isMobile?"":"",onClick:y[5]||(y[5]=s=>f(m.value))},e.createSlots({_:2},[a.$core.state.isMobile?void 0:{name:"default",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.submitText),1)]),key:"0"}]),1032,["icon"])):e.createCommentVNode("",!0)])],2)],2))}}),L={class:"top-editInput"},_=e.defineComponent({__name:"editInput",props:{modelValue:{},input:{},button:{}},emits:["update:modelValue"],setup(i,{emit:r}){const t=i,l=e.ref(t.modelValue);e.watch(e.toRef(t.modelValue),()=>{l.value=t.modelValue});const m=r,h=()=>{m("update:modelValue",l.value)};return(d,f)=>(e.openBlock(),e.createElementBlock("div",L,[e.createVNode(B._sfc_main$2,e.mergeProps(d.input,{onKeydownCapture:f[0]||(f[0]=e.withKeys(e.withModifiers(c=>l.value=d.modelValue,["stop"]),["esc"])),onKeydown:e.withKeys(e.withModifiers(h,["stop"]),["enter"]),modelValue:l.value,"onUpdate:modelValue":f[1]||(f[1]=c=>l.value=c)}),null,16,["onKeydown","modelValue"]),l.value!==d.modelValue?(e.openBlock(),e.createBlock(B._sfc_main,e.mergeProps({key:0,icon:"",styling:"soft"},d.button,{onClick:h}),null,16)):e.createCommentVNode("",!0)]))}}),K=["data-top-icon","onClick"],P={key:0,class:"top-radioGroup_circle"},z=["value","disabled"],D=e.defineComponent({__name:"radioGroup",props:e.mergeModels({modelValue:{},radiosProps:{},showIndicator:{type:Boolean},size:{default:"s"},isError:{type:Boolean}},{modelValue:{required:!0},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue"],["update:modelValue"]),setup(i,{emit:r}){const t=e.useModel(i,"modelValue"),l=i,m=e.ref(null);e.watch(t,()=>{var d,f,c,v,a;(d=l.radiosProps)!=null&&d.some(y=>y.value===t.value)||(t.value=((c=(f=l.radiosProps)==null?void 0:f[0])==null?void 0:c.value)??""),(a=(v=m.value)==null?void 0:v.querySelector(".radioGroup_item-selected"))==null||a.scrollIntoView()},{immediate:!0});const h="radioGroup-"+Math.random();return(d,f)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"elRef",ref:m,class:e.normalizeClass({"top-radioGroup":!0,"top-scrollBarXHidding":!0,["top-size_"+d.size]:!!d.size,"top-error":d.isError})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.radiosProps,c=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass({"top-radioGroup_item-selected":c.value===t.value,"top-radioGroup_item":!0,"top-forms-focusable":!0,"top-disabled":c.disabled}),"data-top-icon":c.icon,onClick:v=>t.value=c.value},[e.createTextVNode(e.toDisplayString(c.title)+" ",1),d.showIndicator?(e.openBlock(),e.createElementBlock("span",P)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":f[0]||(f[0]=v=>t.value=v),name:h,type:"radio",class:e.normalizeClass({"top-unvisible":!0}),value:c.value,disabled:c.disabled},null,8,z),[[e.vModelRadio,t.value]])],10,K))),256))],2))}}),O=(i,r,t)=>{const l=e.ref([]),m=e.ref(!1);let h="",d;i&&!i.params.limit&&(i.params.limit=100);const f=async()=>{if(!i)return;let s,k;if(t&&(i.cache??=new Map,k=JSON.stringify(i.params),s=i.cache.get(k),s))return s;if(m.value=!0,s=await i.call(),m.value=!1,s.errors)return;if(!Array.isArray(s.result)){console.warn("В result ожидался массив");return}const C=s.result.findIndex(b=>b.id===void 0||b.name===void 0);if(C!==-1){console.warn(`В result[${C}] нет id или name`);return}return t&&i.cache.set(k,s),s},c=async()=>{if(!i)return;i.params.offset=0,i.params.search=h;const s=await f();s&&(d=s.nextOffset,l.value=s.result)},v=async()=>{if(!i||!d||m.value)return;i.params.offset=d,i.params.search=h;const s=await f();s&&(d=s.nextOffset,l.value=l.value.concat(s.result))},a=B.debounce(()=>c(),200);return{items:l,isLoading:m,loadAppend:v,setSearchTextAndLoad:(s,k=!0)=>{i&&(s.length<r||s===h&&l.value.length||(h=s,k?a():c()))}}},F={class:"top-selector2_itemMulti top-ellipsis"},G=e.defineComponent({__name:"itemMulti",props:{id:{},name:{}},emits:["delete"],setup(i){return(r,t)=>(e.openBlock(),e.createElementBlock("div",F,[e.createTextVNode(e.toDisplayString(r.name)+" ",1),e.createElementVNode("span",{class:"top-selector2_itemMultiDelete","data-top-icon":"",onClick:t[0]||(t[0]=l=>r.$emit("delete",r.id)),onMousedown:t[1]||(t[1]=e.withModifiers(()=>{},["stop"]))},null,32)]))}}),H={key:0,class:"top-selector2_activeItems"},R={key:1,class:"top-selector2_activeName top-ellipsis"},U=e.defineComponent({__name:"selector2",props:e.mergeModels({modelValue:{},items:{default:()=>[]},multiselect:{type:Boolean},disabled:{type:Boolean},size:{default:"s"},isError:{type:Boolean},apiRequest:{},minLength:{default:0},useCache:{type:Boolean},appendSearchToResult:{type:Boolean},appendAllValue:{type:Boolean},addChanger:{type:Boolean},placeholder:{},showSelectedInInput:{type:Boolean,default:!0},showSearch:{type:Boolean,default:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(i){const r=i,t=e.useModel(i,"modelValue"),l=e.ref(""),m=()=>{l.value="",v.items.value=[]},h={id:0,name:B.useI18n().Common.All},d=e.ref(null),f=e.ref(null),c=()=>{var o;return(o=d.value)==null?void 0:o.popup};window.__STORYBOOK_PREVIEW__&&!r.modelValue&&e.watch(()=>r.multiselect,()=>{t.value=r.multiselect?[]:{id:null,name:""}},{immediate:!0});const v=O(r.apiRequest,r.minLength,r.useCache),a=e.computed(()=>{const o=[];return!r.multiselect&&r.appendAllValue&&o.push(h),r.items.forEach(n=>o.push({...n})),o}),y=(o,n=!0)=>n&&o.id===null?Array.isArray(t.value)?t.value.some(p=>p.id===o.id&&p.name===o.name):o.name===t.value.name:Array.isArray(t.value)?t.value.some(p=>p.id===o.id):o.id===t.value.id,s=e.computed(()=>{const o=l.value.toLowerCase(),n=$.invertKeyboardLayout(o);let p=[];return a.value.forEach(u=>{const g=u.name.toLowerCase();(u.id===Number(o)||g.includes(o)||g.includes(n))&&(g===o||g===n?p.unshift(u):p.push(u))}),p.push(...v.items.value),r.appendSearchToResult&&l.value&&(!p.length||p[0].name.toLowerCase()!==o)&&p.push({id:null,name:l.value}),r.multiselect&&(p=p.filter(u=>!y(u))),p}),k=e.ref(v.isLoading.value);e.watch(v.isLoading,()=>{k.value=v.isLoading.value});const C=async o=>{var n,p;if(r.multiselect){if(!Array.isArray(t.value)||y(o))return;r.apiRequest&&l.value&&(k.value=!0);const u=[...t.value];u.push({...o}),t.value=u,B.Core.state.isMobile?(n=c())==null||n.close():setTimeout(()=>{var g,S,A,E;(g=c())==null||g.recalcPosition(),(E=(A=(S=c())==null?void 0:S.elPopupWidget)==null?void 0:A.querySelector("input"))==null||E.focus(),l.value&&m()})}else JSON.stringify(o)!==JSON.stringify(t.value)&&(t.value={...o}),(p=c())==null||p.close()},b=()=>{if(!Array.isArray(t.value)){const n=(a.value.findIndex(p=>p.id===t.value.id)+1)%a.value.length;t.value={...a.value[n]}}},te=async o=>{Array.isArray(t.value)&&(t.value=t.value.filter(n=>n.id!==o),setTimeout(()=>{var n;(n=c())==null||n.recalcPosition()}))},T=e.ref(!1);r.apiRequest&&(e.watch(T,()=>{T.value&&v.setSearchTextAndLoad(l.value,!1)}),e.watch(l,()=>v.setSearchTextAndLoad(l.value)));const oe=o=>{const n=o.target;n.scrollTop/(n.scrollHeight-n.offsetHeight)>.8&&v.loadAppend()},le=()=>{var o;T.value=!1,(o=f.value)==null||o.focus(),l.value&&m()};return(o,n)=>{const p=e.resolveDirective("top-focus");return e.openBlock(),e.createBlock(e.unref(w.TopPopup),{ref_key:"popupRef",ref:d,onOpen:n[3]||(n[3]=u=>T.value=!0),onClose:n[4]||(n[4]=u=>le()),onScrollContentList:n[5]||(n[5]=u=>o.apiRequest?oe(u):void 0),notch:!1,transitionDuration:0},e.createSlots({opener:e.withCtx(()=>[e.withDirectives((e.openBlock(),e.createElementBlock("div",{ref_key:"elRef",ref:f,class:e.normalizeClass({"top-selector2":!0,"top-selector2-multiselect":o.multiselect,["top-size_"+o.size]:!0,"top-disabled":o.disabled,"top-forms-focusable":!o.disabled,"top-error":o.isError}),onKeydown:[n[0]||(n[0]=e.withKeys(e.withModifiers(u=>u.currentTarget.click(),["stop","prevent"]),["up","down","enter","space"])),n[1]||(n[1]=e.withKeys(u=>t.value=[],["delete"]))],tabindex:"0"},[o.multiselect?(e.openBlock(),e.createElementBlock("div",H,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.value,u=>(e.openBlock(),e.createBlock(G,{id:u.id,name:u.name,onDelete:te},null,8,["id","name"]))),256))])):e.createCommentVNode("",!0),o.multiselect?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",R,e.toDisplayString(Array.isArray(t.value)?"":t.value.name),1)),o.addChanger&&!o.multiselect&&a.value.length>1&&!o.disabled?(e.openBlock(),e.createElementBlock("span",{key:2,class:"top-changer top-changer-selector",onClick:e.withModifiers(b,["stop"])})):e.createCommentVNode("",!0)],34)),[[p,o.isError,void 0,{onupdate:!0}]])]),contentList:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,u=>(e.openBlock(),e.createBlock(e.unref(w.TopPopupListItem),{class:e.normalizeClass({"top-active":!Array.isArray(t.value)&&!o.multiselect&&t.value.name===u.name}),key:u.id??void 0,onClick:e.withModifiers(g=>C(u),["stop"])},{default:e.withCtx(()=>[o.$slots.item?e.renderSlot(o.$slots,"item",{key:0,item:u}):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(u.name),1)],64))]),_:2},1032,["class","onClick"]))),128)),!k.value&&!s.value.length?(e.openBlock(),e.createBlock(e.unref(w.TopPopupListItem),{key:0,type:"regular"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.$i18n.Common.No_results),1)]),_:1})):e.createCommentVNode("",!0)]),_:2},[o.showSearch?{name:"widget",fn:e.withCtx(()=>[e.createVNode(e.unref(w.TopPopupWidgetInput),{title:"Поиск",icon:"",modelValue:l.value,"onUpdate:modelValue":n[2]||(n[2]=u=>l.value=u),isLoading:k.value,placeholder:!Array.isArray(t.value)&&!o.multiselect&&o.showSelectedInInput?t.value.name:o.placeholder},null,8,["modelValue","isLoading","placeholder"])]),key:"0"}:void 0]),1536)}}}),W=["data-top-icon"],J={class:"top-info_text"},j={key:0,class:"top-info_value"},X=e.defineComponent({__name:"info",props:{icon:{},styling:{default:"default"},size:{default:"default"}},setup(i){return(r,t)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"top-info":!0,["top-size_"+r.size]:!0,["top-info-styling_"+r.styling]:!0}),"data-top-icon":r.icon},[e.createElementVNode("div",J,[e.renderSlot(r.$slots,"default")]),r.$slots.additional?(e.openBlock(),e.createElementBlock("span",j,[e.renderSlot(r.$slots,"additional")])):e.createCommentVNode("",!0)],10,W))}}),Y=M,Q=_,Z=D,q=U,x=I._sfc_main,ee=X;V.TopEditArea=Y,V.TopEditInput=Q,V.TopInfo=ee,V.TopMenu=x,V.TopRadioGroup=Z,V.TopSelector2=q,Object.defineProperty(V,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
define(["require","exports","vue","../.chunks/forms-CD0nOB5f.amd","../utils/keyboard.amd","../popup/popup.amd","../.chunks/menu.vue_vue_type_style_index_0_lang-Oq5353Ax.amd","../require/css.amd!../assets/formsExt.css"],function(ie,B,e,g,$,C,M){"use strict";if(typeof e>"u")var e=window.Vue;const N={class:"top-editArea_footer"},I=e.defineComponent({__name:"editArea",props:{defaultValue:{default:""},title:{},cancelText:{default:"Cancel"},submitText:{default:"Send"},closeText:{default:"Close"},isFocused:{type:Boolean},forceShowCloseBtn:{type:Boolean},attachToKeyboard:{type:Boolean},modelValue:{},name:{},placeholder:{},styling:{},rows:{},minHeight:{},expandable:{type:Boolean,default:!0},disabled:{type:Boolean},readonly:{type:Boolean},isError:{type:Boolean},hint:{}},emits:["submit","close","clickOnTitle"],setup(s,{emit:n}){const o=s,l=n,c=e.ref(o.defaultValue),u=e.ref(o.isFocused),p=e.computed(()=>c.value!==o.defaultValue),v=a=>{l("submit",a),c.value=o.defaultValue},m=()=>{if(o.forceShowCloseBtn&&!p.value){l("close");return}c.value=o.defaultValue},y=()=>{o.attachToKeyboard&&l("clickOnTitle")};return(a,h)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"top-editArea":!0,"top-editArea-attachedToKeyboard":a.attachToKeyboard})},[a.title?(e.openBlock(),e.createElementBlock("div",{key:0,class:"top-editArea_title",onClick:h[0]||(h[0]=i=>y())},e.toDisplayString(a.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass({"top-editArea_form":!0,"top-error":a.isError,"top-focus":u.value})},[e.createVNode(g._sfc_main$3,{modelValue:c.value,"onUpdate:modelValue":h[1]||(h[1]=i=>c.value=i),name:a.name,placeholder:a.placeholder,rows:a.rows,minHeight:a.minHeight,expandable:a.expandable,disabled:a.disabled,readonly:a.readonly,isError:a.isError,hint:a.hint,class:"top-editArea_element",onFocus:h[2]||(h[2]=()=>u.value=!0),onBlur:h[3]||(h[3]=()=>u.value=!1),onKeyup:[e.withKeys(m,["esc"]),h[4]||(h[4]=e.withKeys(e.withModifiers(i=>v(c.value),["ctrl"]),["enter"]))]},null,8,["modelValue","name","placeholder","rows","minHeight","expandable","disabled","readonly","isError","hint"]),e.createElementVNode("div",N,[p.value||a.forceShowCloseBtn?(e.openBlock(),e.createBlock(g._sfc_main,{key:0,icon:a.$core.state.isMobile?"":"",class:"top-editArea_button",color:"theme",styling:"soft",onClick:m},e.createSlots({_:2},[a.$core.state.isMobile?void 0:{name:"default",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.cancelText),1)]),key:"0"}]),1032,["icon"])):e.createCommentVNode("",!0),p.value?(e.openBlock(),e.createBlock(g._sfc_main,{key:1,class:"top-editArea_button",icon:a.$core.state.isMobile?"":"",onClick:h[5]||(h[5]=i=>v(c.value))},e.createSlots({_:2},[a.$core.state.isMobile?void 0:{name:"default",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.submitText),1)]),key:"0"}]),1032,["icon"])):e.createCommentVNode("",!0)])],2)],2))}}),_={class:"top-editInput"},L=e.defineComponent({__name:"editInput",props:{modelValue:{},input:{},button:{}},emits:["update:modelValue"],setup(s,{emit:n}){const o=s,l=e.ref(o.modelValue);e.watch(e.toRef(o.modelValue),()=>{l.value=o.modelValue});const c=n,u=()=>{c("update:modelValue",l.value)};return(p,v)=>(e.openBlock(),e.createElementBlock("div",_,[e.createVNode(g._sfc_main$2,e.mergeProps(p.input,{onKeydownCapture:v[0]||(v[0]=e.withKeys(e.withModifiers(m=>l.value=p.modelValue,["stop"]),["esc"])),onKeydown:e.withKeys(e.withModifiers(u,["stop"]),["enter"]),modelValue:l.value,"onUpdate:modelValue":v[1]||(v[1]=m=>l.value=m)}),null,16,["onKeydown","modelValue"]),l.value!==p.modelValue?(e.openBlock(),e.createBlock(g._sfc_main,e.mergeProps({key:0,icon:"",styling:"soft"},p.button,{onClick:u}),null,16)):e.createCommentVNode("",!0)]))}}),z=["data-top-icon","onClick"],K={key:0,class:"top-radioGroup_circle"},P=["value","disabled"],D=e.defineComponent({__name:"radioGroup",props:e.mergeModels({modelValue:{},radiosProps:{},showIndicator:{type:Boolean},size:{default:"s"},isError:{type:Boolean}},{modelValue:{required:!0},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue"],["update:modelValue"]),setup(s,{emit:n}){const o=e.useModel(s,"modelValue"),l=s,c=e.ref(null);e.watch(o,()=>{var p,v,m,y,a;(p=l.radiosProps)!=null&&p.some(h=>h.value===o.value)||(o.value=((m=(v=l.radiosProps)==null?void 0:v[0])==null?void 0:m.value)??""),(a=(y=c.value)==null?void 0:y.querySelector(".radioGroup_item-selected"))==null||a.scrollIntoView()},{immediate:!0});const u="radioGroup-"+Math.random();return(p,v)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"elRef",ref:c,class:e.normalizeClass({"top-radioGroup":!0,"top-scrollBarXHidding":!0,["top-size_"+p.size]:!!p.size,"top-error":p.isError})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.radiosProps,m=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass({"top-radioGroup_item-selected":m.value===o.value,"top-radioGroup_item":!0,"top-forms-focusable":!0,"top-disabled":m.disabled}),"data-top-icon":m.icon,onClick:y=>o.value=m.value},[e.createTextVNode(e.toDisplayString(m.title)+" ",1),p.showIndicator?(e.openBlock(),e.createElementBlock("span",K)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":v[0]||(v[0]=y=>o.value=y),name:u,type:"radio",class:e.normalizeClass({"top-unvisible":!0}),value:m.value,disabled:m.disabled},null,8,P),[[e.vModelRadio,o.value]])],10,z))),256))],2))}}),G=["data-top-icon"],O=["value","checked","disabled","onChange"],F=e.defineComponent({__name:"checkboxGroup",props:e.mergeModels({modelValue:{},items:{},size:{default:"s"},styling:{default:"outline"},isError:{type:Boolean}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(s){const n=e.useModel(s,"modelValue"),o=l=>{const c=[...n.value],u=c.indexOf(l);u===-1?c.push(l):c.splice(u,1),n.value=c};return(l,c)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"top-checkboxGroup":!0,["top-checkboxGroup-"+l.styling]:!0,"top-scrollBarXHidding":!0,["top-size_"+l.size]:!!l.size,"top-error":l.isError})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.items,u=>(e.openBlock(),e.createElementBlock("label",{key:u.id,class:e.normalizeClass({"top-checkboxGroup_item":!0,"top-checkboxGroup_item-selected":n.value.includes(u.id),"top-forms-focusable":!0,"top-disabled":u.disabled}),"data-top-icon":u.icon},[e.createElementVNode("input",{type:"checkbox",class:"top-unvisible",value:u.id,checked:n.value.includes(u.id),disabled:u.disabled,onChange:p=>o(u.id)},null,40,O),e.createTextVNode(" "+e.toDisplayString(u.title),1)],10,G))),128))],2))}}),H=(s,n,o)=>{const l=e.ref([]),c=e.ref(!1);let u="",p;s&&!s.params.limit&&(s.params.limit=100);const v=async()=>{if(!s)return;let i,k;if(o&&(s.cache??=new Map,k=JSON.stringify(s.params),i=s.cache.get(k),i))return i;if(c.value=!0,i=await s.call(),c.value=!1,i.errors)return;if(!Array.isArray(i.result)){console.warn("В result ожидался массив");return}const b=i.result.findIndex(w=>w.id===void 0||w.name===void 0);if(b!==-1){console.warn(`В result[${b}] нет id или name`);return}return o&&s.cache.set(k,i),i},m=async()=>{if(!s)return;s.params.offset=0,s.params.search=u;const i=await v();i&&(p=i.nextOffset,l.value=i.result)},y=async()=>{if(!s||!p||c.value)return;s.params.offset=p,s.params.search=u;const i=await v();i&&(p=i.nextOffset,l.value=l.value.concat(i.result))},a=g.debounce(()=>m(),200);return{items:l,isLoading:c,loadAppend:y,setSearchTextAndLoad:(i,k=!0)=>{s&&(i.length<n||i===u&&l.value.length||(u=i,k?a():m()))}}},R={class:"top-selector2_itemMulti top-ellipsis"},U=e.defineComponent({__name:"itemMulti",props:{id:{},name:{}},emits:["delete"],setup(s){return(n,o)=>(e.openBlock(),e.createElementBlock("div",R,[e.createTextVNode(e.toDisplayString(n.name)+" ",1),e.createElementVNode("span",{class:"top-selector2_itemMultiDelete","data-top-icon":"",onClick:o[0]||(o[0]=l=>n.$emit("delete",n.id)),onMousedown:o[1]||(o[1]=e.withModifiers(()=>{},["stop"]))},null,32)]))}}),W={key:0,class:"top-selector2_activeItems"},J={key:1,class:"top-selector2_activeName top-ellipsis"},X=e.defineComponent({__name:"selector2",props:e.mergeModels({modelValue:{},items:{default:()=>[]},multiselect:{type:Boolean},disabled:{type:Boolean},size:{default:"s"},isError:{type:Boolean},apiRequest:{},minLength:{default:0},useCache:{type:Boolean},appendSearchToResult:{type:Boolean},appendAllValue:{type:Boolean},addChanger:{type:Boolean},placeholder:{},showSelectedInInput:{type:Boolean,default:!0},showSearch:{type:Boolean,default:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(s){const n=s,o=e.useModel(s,"modelValue"),l=e.ref(""),c=()=>{l.value="",y.items.value=[]},u={id:0,name:g.useI18n().Common.All},p=e.ref(null),v=e.ref(null),m=()=>{var t;return(t=p.value)==null?void 0:t.popup};window.__STORYBOOK_PREVIEW__&&!n.modelValue&&e.watch(()=>n.multiselect,()=>{o.value=n.multiselect?[]:{id:null,name:""}},{immediate:!0});const y=H(n.apiRequest,n.minLength,n.useCache),a=e.computed(()=>{const t=[];return!n.multiselect&&n.appendAllValue&&t.push(u),n.items.forEach(r=>t.push({...r})),t}),h=(t,r=!0)=>r&&t.id===null?Array.isArray(o.value)?o.value.some(f=>f.id===t.id&&f.name===t.name):t.name===o.value.name:Array.isArray(o.value)?o.value.some(f=>f.id===t.id):t.id===o.value.id,i=e.computed(()=>{const t=l.value.toLowerCase(),r=$.invertKeyboardLayout(t);let f=[];return a.value.forEach(d=>{const V=d.name.toLowerCase();(d.id===Number(t)||V.includes(t)||V.includes(r))&&(V===t||V===r?f.unshift(d):f.push(d))}),f.push(...y.items.value),n.appendSearchToResult&&l.value&&(!f.length||f[0].name.toLowerCase()!==t)&&f.push({id:null,name:l.value}),n.multiselect&&(f=f.filter(d=>!h(d))),f}),k=e.ref(y.isLoading.value);e.watch(y.isLoading,()=>{k.value=y.isLoading.value});const b=async t=>{var r,f;if(n.multiselect){if(!Array.isArray(o.value)||h(t))return;n.apiRequest&&l.value&&(k.value=!0);const d=[...o.value];d.push({...t}),o.value=d,g.Core.state.isMobile?(r=m())==null||r.close():setTimeout(()=>{var V,E,S,A;(V=m())==null||V.recalcPosition(),(A=(S=(E=m())==null?void 0:E.elPopupWidget)==null?void 0:S.querySelector("input"))==null||A.focus(),l.value&&c()})}else JSON.stringify(t)!==JSON.stringify(o.value)&&(o.value={...t}),(f=m())==null||f.close()},w=()=>{if(!Array.isArray(o.value)){const r=(a.value.findIndex(f=>f.id===o.value.id)+1)%a.value.length;o.value={...a.value[r]}}},ae=async t=>{Array.isArray(o.value)&&(o.value=o.value.filter(r=>r.id!==t),setTimeout(()=>{var r;(r=m())==null||r.recalcPosition()}))},T=e.ref(!1);n.apiRequest&&(e.watch(T,()=>{T.value&&y.setSearchTextAndLoad(l.value,!1)}),e.watch(l,()=>y.setSearchTextAndLoad(l.value)));const re=t=>{const r=t.target;r.scrollTop/(r.scrollHeight-r.offsetHeight)>.8&&y.loadAppend()},se=()=>{var t;T.value=!1,(t=v.value)==null||t.focus(),l.value&&c()};return(t,r)=>{const f=e.resolveDirective("top-focus");return e.openBlock(),e.createBlock(e.unref(C.TopPopup),{ref_key:"popupRef",ref:p,onOpen:r[3]||(r[3]=d=>T.value=!0),onClose:r[4]||(r[4]=d=>se()),onScrollContentList:r[5]||(r[5]=d=>t.apiRequest?re(d):void 0),notch:!1,transitionDuration:0},e.createSlots({opener:e.withCtx(()=>[e.withDirectives((e.openBlock(),e.createElementBlock("div",{ref_key:"elRef",ref:v,class:e.normalizeClass({"top-selector2":!0,"top-selector2-multiselect":t.multiselect,["top-size_"+t.size]:!0,"top-disabled":t.disabled,"top-forms-focusable":!t.disabled,"top-error":t.isError}),onKeydown:[r[0]||(r[0]=e.withKeys(e.withModifiers(d=>d.currentTarget.click(),["stop","prevent"]),["up","down","enter","space"])),r[1]||(r[1]=e.withKeys(d=>o.value=[],["delete"]))],tabindex:"0"},[t.multiselect?(e.openBlock(),e.createElementBlock("div",W,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,d=>(e.openBlock(),e.createBlock(U,{id:d.id,name:d.name,onDelete:ae},null,8,["id","name"]))),256))])):e.createCommentVNode("",!0),t.multiselect?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",J,e.toDisplayString(Array.isArray(o.value)?"":o.value.name),1)),t.addChanger&&!t.multiselect&&a.value.length>1&&!t.disabled?(e.openBlock(),e.createElementBlock("span",{key:2,class:"top-changer top-changer-selector",onClick:e.withModifiers(w,["stop"])})):e.createCommentVNode("",!0)],34)),[[f,t.isError,void 0,{onupdate:!0}]])]),contentList:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,d=>(e.openBlock(),e.createBlock(e.unref(C.TopPopupListItem),{class:e.normalizeClass({"top-active":!Array.isArray(o.value)&&!t.multiselect&&o.value.name===d.name}),key:d.id??void 0,onClick:e.withModifiers(V=>b(d),["stop"])},{default:e.withCtx(()=>[t.$slots.item?e.renderSlot(t.$slots,"item",{key:0,item:d}):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(d.name),1)],64))]),_:2},1032,["class","onClick"]))),128)),!k.value&&!i.value.length?(e.openBlock(),e.createBlock(e.unref(C.TopPopupListItem),{key:0,type:"regular"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.$i18n.Common.No_results),1)]),_:1})):e.createCommentVNode("",!0)]),_:2},[t.showSearch?{name:"widget",fn:e.withCtx(()=>[e.createVNode(e.unref(C.TopPopupWidgetInput),{title:"Поиск",icon:"",modelValue:l.value,"onUpdate:modelValue":r[2]||(r[2]=d=>l.value=d),isLoading:k.value,placeholder:!Array.isArray(o.value)&&!t.multiselect&&t.showSelectedInInput?o.value.name:t.placeholder},null,8,["modelValue","isLoading","placeholder"])]),key:"0"}:void 0]),1536)}}}),j=["data-top-icon"],Y={class:"top-info_text"},Q={key:0,class:"top-info_value"},Z=e.defineComponent({__name:"info",props:{icon:{},styling:{default:"default"},size:{default:"default"}},setup(s){return(n,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"top-info":!0,["top-size_"+n.size]:!0,["top-info-styling_"+n.styling]:!0}),"data-top-icon":n.icon},[e.createElementVNode("div",Y,[e.renderSlot(n.$slots,"default")]),n.$slots.additional?(e.openBlock(),e.createElementBlock("span",Q,[e.renderSlot(n.$slots,"additional")])):e.createCommentVNode("",!0)],10,j))}}),q=I,x=L,ee=D,oe=F,te=X,le=M._sfc_main,ne=Z;B.TopCheckboxGroup=oe,B.TopEditArea=q,B.TopEditInput=x,B.TopInfo=ne,B.TopMenu=le,B.TopRadioGroup=ee,B.TopSelector2=te,Object.defineProperty(B,Symbol.toStringTag,{value:"Module"})});
|
|
2
2
|
//# sourceMappingURL=formsExt.amd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formsExt.amd.js","sources":["../../src/components/formsExt/editArea/editArea.vue","../../src/components/formsExt/editInput/editInput.vue","../../src/components/formsExt/radioGroup/radioGroup.vue","../../src/components/formsExt/selector2/api.ts","../../src/components/formsExt/selector2/selector2.vue","../../src/components/formsExt/formsExt.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, ref } from 'vue';\nimport Button from '@/components/forms/button/button.vue';\nimport type { Emits, Props } from './editArea';\nimport Textarea from '@/components/forms/textarea/textarea.vue';\n\nconst props = withDefaults(defineProps<Props>(), {\n\tdefaultValue: '',\n\tcancelText: 'Cancel',\n\tsubmitText: 'Send',\n\tcloseText: 'Close',\n\texpandable: true,\n});\n\nconst emit = defineEmits<Emits>();\n\nconst localValue = ref(props.defaultValue);\n\nconst isFocused = ref(props.isFocused);\n\nconst isChanged = computed(() => localValue.value !== props.defaultValue);\n\nconst submit = (value: string) => {\n\temit('submit', value);\n\n\tlocalValue.value = props.defaultValue;\n};\n\nconst cancel = () => {\n\tif (props.forceShowCloseBtn && !isChanged.value) {\n\t\temit('close');\n\n\t\treturn;\n\t}\n\n\tlocalValue.value = props.defaultValue;\n};\n\nconst clickOnTitle = () => {\n\tif (props.attachToKeyboard) emit('clickOnTitle');\n};\n</script>\n\n<template>\n\t<div\n\t\t:class=\"{\n\t\t\t'top-editArea': true,\n\t\t\t'top-editArea-attachedToKeyboard': attachToKeyboard,\n\t\t}\"\n\t>\n\t\t<div\n\t\t\tv-if=\"title\"\n\t\t\tclass=\"top-editArea_title\"\n\t\t\t@click=\"clickOnTitle()\"\n\t\t>\n\t\t\t{{ title }}\n\t\t</div>\n\n\t\t<div\n\t\t\t:class=\"{\n\t\t\t\t'top-editArea_form': true,\n\t\t\t\t'top-error': isError,\n\t\t\t\t'top-focus': isFocused,\n\t\t\t}\"\n\t\t>\n\t\t\t<Textarea\n\t\t\t\tv-model=\"localValue\"\n\t\t\t\t:name=\"name\"\n\t\t\t\t:placeholder=\"placeholder\"\n\t\t\t\t:rows=\"rows\"\n\t\t\t\t:minHeight=\"minHeight\"\n\t\t\t\t:expandable=\"expandable\"\n\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t:readonly=\"readonly\"\n\t\t\t\t:isError=\"isError\"\n\t\t\t\t:hint=\"hint\"\n\t\t\t\tclass=\"top-editArea_element\"\n\t\t\t\t@focus=\"() => isFocused = true\"\n\t\t\t\t@blur=\"() => isFocused = false\"\n\t\t\t\t@keyup.esc=\"cancel\"\n\t\t\t\t@keyup.ctrl.enter=\"submit(localValue)\"\n\t\t\t/>\n\n\t\t\t<div class=\"top-editArea_footer\">\n\t\t\t\t<Button\n\t\t\t\t\tv-if=\"isChanged || forceShowCloseBtn\"\n\t\t\t\t\t:icon=\"$core.state.isMobile ? '': ''\"\n\t\t\t\t\tclass=\"top-editArea_button\"\n\t\t\t\t\tcolor=\"theme\"\n\t\t\t\t\tstyling=\"soft\"\n\t\t\t\t\t@click=\"cancel\"\n\t\t\t\t>\n\t\t\t\t\t<template\n\t\t\t\t\t\t#default\n\t\t\t\t\t\tv-if=\"!$core.state.isMobile\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{{ cancelText }}\n\t\t\t\t\t</template>\n\t\t\t\t</Button>\n\n\t\t\t\t<Button\n\t\t\t\t\tclass=\"top-editArea_button\"\n\t\t\t\t\tv-if=\"isChanged\"\n\t\t\t\t\t:icon=\"$core.state.isMobile ? '': ''\"\n\t\t\t\t\t@click=\"submit(localValue)\"\n\t\t\t\t>\n\t\t\t\t\t<template\n\t\t\t\t\t\t#default\n\t\t\t\t\t\tv-if=\"!$core.state.isMobile\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{{ submitText }}\n\t\t\t\t\t</template>\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</template>\n\n<style>\n.top-editArea {\n\t--top-editArea-bottom: env(keyboard-inset-height, 0px);\n\t--top-editArea-offset-bottom: 0px;\n\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 6px;\n}\n\n.top-editArea_title {\n\tfont-size: 12px;\n}\n\n.top-editArea_form {\n\tflex-direction: column;\n\toutline: none;\n}\n\n.top-editArea_form:not(.top-error):hover,\n.top-editArea_form:not(.top-error).top-focus {\n\tborder-color: var(--top-forms-border-color-hover);\n}\n\n/* textarea в EditArea */\n.top-textarea {\n\twidth: 100%;\n}\n\n.top-editArea_element.top-textarea_textarea {\n\t--top-forms-border-width: 0px;\n\n\toutline: none;\n\tanimation: none;\n}\n\n/* footer */\n.top-editArea_footer {\n\tpadding: var(--top-forms-padding);\n\tdisplay: flex;\n\tmin-height: 32px;\n\talign-self: flex-end;\n\tjustify-content: flex-end;\n\tgap: var(--top-forms-padding);\n}\n\n/* attachedToKeyboard */\n.top-editArea-attachedToKeyboard {\n\tbackground: var(--top-forms-background-color);\n\tposition: fixed;\n\tbottom: calc(var(--top-editArea-offset-bottom) + var(--top-editArea-bottom));\n\tright: 0;\n\tleft: 0;\n\tz-index: 2;\n\tgap: 0;\n\ttransition: bottom var(--transition-fast);\n}\n\n.top-editArea-attachedToKeyboard .top-editArea_form {\n\tborder-radius: 0;\n\tborder: none;\n\tborder-top: 1px solid var(--top-forms-border-color);\n}\n\n.top-editArea-attachedToKeyboard .top-editArea_title {\n\tcursor: pointer;\n\tborder-top: 1px solid var(--color-line-2-opacity);\n\tpadding: var(--top-forms-padding);\n}\n\n.top-editArea-attachedToKeyboard .top-editArea_footer > [data-top-icon] {\n\tborder-radius: 100%;\n}\n\n@media screen and (max-width: 900px) {\n\t.top-editArea_form{\n\t\tflex-direction: row;\n\t}\n}\n</style>\n","<script setup lang=\"ts\">\nimport { ref, toRef, watch } from 'vue';\nimport type { Emits, Props } from './editInput';\nimport TopInput from '@/components/forms/input/input.vue';\nimport TopButton from '@/components/forms/button/button.vue';\n\nconst props = defineProps<Props>();\n\nconst intermediateValue = ref(props.modelValue);\n\nwatch(toRef(props.modelValue), () => {\n\tintermediateValue.value = props.modelValue;\n});\n\nconst emit = defineEmits<Emits>();\n\nconst submit = () => {\n\temit('update:modelValue', intermediateValue.value);\n};\n</script>\n\n<template>\n\t<div class=\"top-editInput\">\n\t\t<TopInput\n\t\t\t:=\"input\"\n\t\t\t@keydown.esc.capture.stop=\"intermediateValue = modelValue\"\n\t\t\t@keydown.enter.stop=\"submit\"\n\t\t\tv-model=\"intermediateValue\"\n\t\t/>\n\n\t\t<TopButton\n\t\t\tv-if=\"intermediateValue !== modelValue\"\n\t\t\ticon=\"\"\n\t\t\tstyling=\"soft\"\n\t\t\t:=\"button\"\n\t\t\t@click=\"submit\"\n\t\t/>\n\t</div>\n</template>\n\n<style>\n.top-editInput {\n\twidth: 220px;\n\tflex-grow: 1;\n\tdisplay: flex;\n\talign-items: flex-end;\n\tgap: var(--top-gap-1);\n}\n\n.top-editInput .top-input {\n\twidth: unset;\n\tflex-grow: 1;\n}\n</style>\n","<script setup lang=\"ts\">\nimport type { Ref } from '@vue/reactivity';\nimport { ref, watch } from 'vue';\nimport type { Props, Emits } from './radioGroup';\n\nconst model = defineModel<string>({\n\trequired: true,\n});\n\nconst props = withDefaults(defineProps<Props>(), {\n\tsize: 's',\n});\n\nconst emit = defineEmits<Emits>();\n\nconst elRef: Ref<HTMLElement | null> = ref(null);\n\nwatch(model, () => {\n\tif (!props.radiosProps?.some(item => item.value === model.value)) {\n\t\tmodel.value = props.radiosProps?.[0]?.value ?? '';\n\t}\n\n\telRef.value?.querySelector('.radioGroup_item-selected')?.scrollIntoView();\n}, { immediate: true });\n\nconst uid = 'radioGroup-' + Math.random();\n</script>\n\n<template>\n\t<div\n\t\tref=\"elRef\"\n\t\t:class=\"{\n\t\t\t['top-radioGroup']: true,\n\t\t\t['top-scrollBarXHidding']: true,\n\t\t\t['top-size_' + size]: !!size,\n\t\t\t['top-error']: isError,\n\t\t}\"\n\t>\n\t\t<label\n\t\t\tv-for=\"item of radiosProps\"\n\t\t\t:class=\"{\n\t\t\t\t['top-radioGroup_item-selected']: item.value === model,\n\t\t\t\t['top-radioGroup_item']: true,\n\t\t\t\t['top-forms-focusable']: true,\n\t\t\t\t['top-disabled']: item.disabled,\n\t\t\t}\"\n\t\t\t:data-top-icon=\"item.icon\"\n\t\t\t@click=\"model = item.value\"\n\t\t>\n\t\t\t{{ item.title }}\n\n\t\t\t<span\n\t\t\t\tv-if=\"showIndicator\"\n\t\t\t\tclass=\"top-radioGroup_circle\"\n\t\t\t></span>\n\n\t\t\t<!-- Для нативной навигации -->\n\t\t\t<input\n\t\t\t\tv-model=\"model\"\n\t\t\t\t:name=\"uid\"\n\t\t\t\ttype=\"radio\"\n\t\t\t\t:class=\"{\n\t\t\t\t\t['top-unvisible']: true,\n\t\t\t\t}\"\n\t\t\t\t:value=\"item.value\"\n\t\t\t\t:disabled=\"item.disabled\"\n\t\t\t/>\n\t\t</label>\n\t</div>\n</template>\n\n<style>\n@import \"./styles/top-scrollBar.css\";\n\n.top-radioGroup {\n\tuser-select: none;\n\tbox-sizing: border-box;\n\tborder-radius: 8px;\n\tbackground-color: var(--color-layout-middle);\n\theight: var(--top-forms-base-height);\n\tpadding: 2px;\n\tgap: 2px;\n\tdisplay: flex;\n\talign-items: flex-start;\n}\n\n.top-radioGroup_item {\n\tcolor: var(--color-text-2);\n\tcursor: pointer;\n\tbox-sizing: border-box;\n\tborder-radius: 6px;\n\theight: calc(var(--top-forms-base-height) - 4px);\n\tpadding: 0 16px;\n\tfont-weight: 400;\n\twhite-space: nowrap;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tflex-grow: 1;\n\tgap: 4px;\n}\n\n.top-radioGroup_item:hover {\n\tbackground-color: var(--color-layout-front-1);\n\tbox-shadow: 0px 4px 32px 0px rgba(4, 9, 84, 0.10), 0px 0px 4px 0px rgba(4, 9, 84, 0.08);\n}\n\n/* selected */\n.top-radioGroup_item-selected {\n\tcolor: var(--color-text-1);\n\tpointer-events: none;\n\tbackground-color: var(--color-bg-lightning-1);\n\tbox-shadow: 0px 4px 32px 0px rgba(4, 9, 84, 0.10), 0px 0px 4px 0px rgba(4, 9, 84, 0.08);\n}\n\n/* circle */\n.top-radioGroup_circle {\n\tcontent: \"\";\n\tbox-sizing: border-box;\n\tborder: 1px solid var(--color-line-3-opacity);\n\tborder-radius: 50%;\n\tpadding: 3px;\n\tmargin-left: auto;\n\twidth: calc(var(--top-forms-option-height) - 3px * 2);\n\theight: calc(var(--top-forms-option-height) - 3px * 2);\n}\n\n.top-radioGroup_item:hover .top-radioGroup_circle:before {\n\tborder-color: var(--color-line-primary-1);\n}\n\n/* circle selected */\n.top-radioGroup_item-selected .top-radioGroup_circle {\n\tborder-color: var(--color-line-primary-1);\n\tborder-width: 5px;\n}\n\n.top-radioGroup_item-selected:hover .top-radioGroup_circle {\n\tborder-color: var(--color-line-primary-1);\n}\n\n/* top-error */\n.top-radioGroup.top-error .top-radioGroup_item:not(.top-disabled) .top-radioGroup_circle {\n\tborder-color: var(--color-line-negative-1);\n}\n</style>\n","import type { Ref } from 'vue';\nimport { ref } from 'vue';\nimport { debounce } from '@/core/utils/lodash';\nimport type { Item, Props } from './selector2';\n\nexport const useAPI = (apiRequest: Props['apiRequest'], minLength: number, useCache: Props['useCache']) => {\n\t/**\n\t * Список, полученный через API\n\t */\n\tconst items: Ref<Array<Item>> = ref([]);\n\n\t/**\n\t * Флаг - идет загрузка\n\t */\n\tconst isLoading = ref(false);\n\n\tlet _searchText = '';\n\tlet _nextOffset: number | undefined;\n\n\tif (apiRequest && !apiRequest.params.limit) {\n\t\tapiRequest.params.limit = 100;\n\t}\n\n\t/**\n\t * Выполнить обращение к API\n\t *\n\t * При ошибке вернет undefined\n\t */\n\tconst callAPIRequest = async (): Promise<{ nextOffset?: number, result: Array<Item> } | undefined> => {\n\t\tif (!apiRequest) return;\n\n\t\tlet res;\n\t\tlet cacheKey;\n\n\t\tif (useCache) {\n\t\t\t// кэш для полученных ответов через apiRequest\n\t\t\t// общий для всех компонентов, использующих apiRequest\n\t\t\tapiRequest.cache ??= new Map();\n\n\t\t\tcacheKey = JSON.stringify(apiRequest.params);\n\t\t\tres = apiRequest.cache.get(cacheKey);\n\n\t\t\tif (res) {\n\t\t\t\treturn res;\n\t\t\t}\n\t\t}\n\n\t\tisLoading.value = true;\n\t\tres = await apiRequest.call();\n\t\tisLoading.value = false;\n\n\t\tif (res.errors) return;\n\n\t\tif (!Array.isArray(res.result)) {\n\t\t\tconsole.warn(`В result ожидался массив`);\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst indexWithError = (res.result as Array<Item | any>).findIndex(item => item.id === undefined || item.name === undefined);\n\t\tif (indexWithError !== -1) {\n\t\t\tconsole.warn(`В result[${indexWithError}] нет id или name`);\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (useCache) {\n\t\t\tapiRequest.cache.set(cacheKey as string, res);\n\t\t}\n\n\t\treturn res;\n\t};\n\n\t/**\n\t * Загрузить items\n\t */\n\tconst load = async () => {\n\t\tif (!apiRequest) return;\n\n\t\tapiRequest.params.offset = 0;\n\t\tapiRequest.params.search = _searchText;\n\n\t\tconst res = await callAPIRequest();\n\t\tif (!res) return;\n\n\t\t_nextOffset = res.nextOffset;\n\n\t\titems.value = res.result;\n\t};\n\n\t/**\n\t * Загрузить следующую страницу items\n\t */\n\tconst loadAppend = async () => {\n\t\tif (!apiRequest) return;\n\n\t\t// данных о следующих страницах не обнаружено\n\t\tif (!_nextOffset) return;\n\n\t\t// дозагружать нельзя, если не завершена предыдущшая загрузка\n\t\tif (isLoading.value) return;\n\n\t\tapiRequest.params.offset = _nextOffset;\n\t\tapiRequest.params.search = _searchText;\n\n\t\tconst res = await callAPIRequest();\n\t\tif (!res) return;\n\n\t\t_nextOffset = res.nextOffset;\n\n\t\titems.value = items.value.concat(res.result);\n\t};\n\n\tconst loadDebounce = debounce(() => load(), 200);\n\n\t/**\n\t * Выполнить поиск по указанному тексту\n\t *\n\t * Если длина текста меньше minLength, поиск не будет проивзеден\n\t *\n\t * Если текст не изменился, поиск не будет проивзеден\n\t * @param searchText - текст поиска\n\t * @param useDebounce - отложенное выполнение поиска\n\t */\n\tconst setSearchTextAndLoad = (searchText: string, useDebounce = true) => {\n\t\tif (!apiRequest) return;\n\n\t\tif (searchText.length < minLength) return;\n\n\t\t// условия поиска не поменялись, данные загружены\n\t\tif (searchText === _searchText && items.value.length) return;\n\n\t\t_searchText = searchText;\n\n\t\tif (useDebounce) {\n\t\t\tloadDebounce();\n\t\t} else {\n\t\t\tvoid load();\n\t\t}\n\t};\n\n\treturn {\n\t\titems,\n\t\tisLoading,\n\t\tloadAppend,\n\t\tsetSearchTextAndLoad,\n\t};\n};\n","<script setup lang=\"ts\">\nimport type { ComputedRef, ModelRef, ComponentInstance } from 'vue';\nimport { computed, ref, watch } from 'vue';\nimport Core from '@/core/core/core';\nimport { invertKeyboardLayout } from '@/core/utils/keyboard';\nimport { useI18n } from '@/core/plugins/i18n';\nimport { TopPopup, TopPopupListItem, TopPopupWidgetInput } from '@/components/popup/popup';\nimport type { TopLibPopup } from '@/components/popup/lib/popup';\nimport type { Item, Props, Slots } from './selector2';\nimport { useAPI } from './api';\nimport Selector2ItemMulti from './itemMulti.vue';\n\nconst props = withDefaults(defineProps<Props>(), {\n\titems: () => [] as Array<Item>,\n\tsize: 's',\n\tminLength: 0,\n\tshowSelectedInInput: true,\n\tshowSearch: true,\n});\n\nconst model = defineModel<Props['modelValue']>() as ModelRef<Props['modelValue']>;\n\ndefineSlots<Slots>();\n\n/**\n * Текст поиска по результатам\n */\nconst searchText = ref('');\n\n/**\n * Сброс поиска\n */\nconst resetSearch = () => {\n\tsearchText.value = '';\n\tAPI.items.value = [];\n};\n\n\nconst itemAll = {\n\tid: 0,\n\tname: useI18n().Common.All!,\n};\n\n/**\n * Экземпляр компонента Popup\n */\nconst popupRef = ref<ComponentInstance<typeof TopPopup> | null>(null);\n\n/**\n * Основной элемент селектора\n */\nconst elRef = ref<HTMLElement | null>(null);\n\n/**\n * Получить доступ к объекту popup\n */\nconst getPopup = (): TopLibPopup | undefined => {\n\treturn popupRef.value?.popup;\n};\n\n// для storybook\nif ((window as any).__STORYBOOK_PREVIEW__ && !props.modelValue) {\n\twatch(\n\t\t() => props.multiselect,\n\t\t() => {\n\t\t\tmodel.value = props.multiselect ? [] : { id: null, name: '' };\n\t\t},\n\t\t{ immediate: true },\n\t);\n}\n\nconst API = useAPI(props.apiRequest, props.minLength, props.useCache);\n\n/**\n * Варианты выбора: props.items + \"Выбрать все\"\n */\nconst localItems: ComputedRef<Array<Item>> = computed(() => {\n\tconst items: Array<Item> = [];\n\n\tif (!props.multiselect && props.appendAllValue) {\n\t\titems.push(itemAll);\n\t}\n\n\tprops.items.forEach(item => items.push({ ...item }));\n\n\treturn items;\n});\n\n/**\n * Проверить, что элемент выбран\n */\nconst isSelected = (item: Item, checkNameForNullId = true) => {\n\tif (checkNameForNullId && item.id === null) {\n\t\tif (Array.isArray(model.value)) {\n\t\t\treturn model.value.some(itemSelected => itemSelected.id === item.id && itemSelected.name === item.name);\n\t\t} else {\n\t\t\treturn item.name === model.value.name;\n\t\t}\n\t}\n\n\tif (Array.isArray(model.value)) {\n\t\treturn model.value.some(itemSelected => itemSelected.id === item.id);\n\t} else {\n\t\treturn item.id === model.value.id;\n\t}\n};\n\n/**\n * Варианты выбора, которые выводятся\n */\nconst itemsForShow = computed(() => {\n\tconst searchString = searchText.value.toLowerCase();\n\tconst searchStringInvertKeyboard = invertKeyboardLayout(searchString);\n\n\tlet items: typeof localItems.value = [];\n\n\tlocalItems.value.forEach((item) => {\n\t\tconst itemName = item.name.toLowerCase();\n\n\t\tif (\n\t\t\titem.id === Number(searchString) ||\n\t\t\titemName.includes(searchString) ||\n\t\t\titemName.includes(searchStringInvertKeyboard)\n\t\t) {\n\t\t\tif (itemName === searchString || itemName === searchStringInvertKeyboard) {\n\t\t\t\titems.unshift(item);\n\t\t\t} else {\n\t\t\t\titems.push(item);\n\t\t\t}\n\t\t}\n\t});\n\n\titems.push(...API.items.value);\n\n\tif (\n\t\tprops.appendSearchToResult &&\n\t\t!!searchText.value &&\n\t\t(!items.length || items[0].name.toLowerCase() !== searchString)\n\t) {\n\t\titems.push({\n\t\t\tid: null,\n\t\t\tname: searchText.value,\n\t\t});\n\t}\n\n\tif (props.multiselect) {\n\t\titems = items.filter(item => !isSelected(item));\n\t}\n\n\treturn items;\n});\n\n/**\n * Флаг - идет загрузка\n *\n * Скрывает вывод заглушки \"Нет результатов\" - для загрузки данных через API (multiselect = true) - (см. selectItem)\n */\nconst isLoading = ref(API.isLoading.value);\n\nwatch(API.isLoading, () => {\n\tisLoading.value = API.isLoading.value;\n});\n\n/**\n * Выбрать значение\n *\n * Управляет закрытием окна\n */\nconst selectItem = async (item: Item) => {\n\tif (props.multiselect) {\n\t\tif (!Array.isArray(model.value)) return;\n\n\t\tif (isSelected(item)) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (props.apiRequest && searchText.value) {\n\t\t\tisLoading.value = true;\n\t\t}\n\n\t\tconst newModel = [...model.value];\n\t\tnewModel.push({ ...item });\n\t\tmodel.value = newModel;\n\n\t\tif (Core.state.isMobile) {\n\t\t\tgetPopup()?.close();\n\t\t} else {\n\t\t\tsetTimeout(() => {\n\t\t\t\tgetPopup()?.recalcPosition();\n\t\t\t\tgetPopup()?.elPopupWidget?.querySelector('input')?.focus();\n\n\t\t\t\tif (searchText.value) resetSearch();\n\t\t\t});\n\t\t}\n\t} else {\n\t\tif (JSON.stringify(item) !== JSON.stringify(model.value)) {\n\t\t\tmodel.value = { ...item };\n\t\t}\n\n\t\tgetPopup()?.close();\n\t}\n};\n\n/**\n * Выбрать следующее значение\n */\nconst selectNextItem = () => {\n\tif (!Array.isArray(model.value)) {\n\t\tconst currentIndex = localItems.value.findIndex(item => item.id === (model.value as Item).id);\n\t\tconst nextIndex = (currentIndex + 1) % localItems.value.length;\n\t\tmodel.value = { ...localItems.value[nextIndex] };\n\t}\n};\n\n/**\n * Удалить выбранное значение по id\n * @param id\n */\nconst deleteItemById = async (id: Item['id']) => {\n\tif (Array.isArray(model.value)) {\n\t\tmodel.value = model.value.filter(item => item.id !== id);\n\n\t\tsetTimeout(() => {\n\t\t\tgetPopup()?.recalcPosition();\n\t\t});\n\t}\n};\n\nconst isOpened = ref(false); // флаг попап открыт\n\nif (props.apiRequest) {\n\twatch(isOpened, () => {\n\t\tif (isOpened.value) {\n\t\t\t// при открытии сразу выполнить поиск\n\t\t\tAPI.setSearchTextAndLoad(searchText.value, false);\n\t\t}\n\t});\n\n\t// отложенный поиск при вводе текста\n\twatch(searchText, () => API.setSearchTextAndLoad(searchText.value));\n}\n\nconst onScrollContentList = (e: Event) => {\n\tconst el = e.target as HTMLElement;\n\n\tif (el.scrollTop / (el.scrollHeight - el.offsetHeight) > 0.8) {\n\t\tAPI.loadAppend();\n\t}\n};\n\nconst onClose = () => {\n\tisOpened.value = false;\n\n\telRef.value?.focus();\n\n\tif (searchText.value) resetSearch();\n};\n</script>\n\n<template>\n\t<TopPopup\n\t\tref=\"popupRef\"\n\t\t@open=\"isOpened = true\"\n\t\t@close=\"onClose()\"\n\t\t@scrollContentList=\"apiRequest ? onScrollContentList($event) : undefined\"\n\t\t:notch=\"false\"\n\t\t:transitionDuration=\"0\"\n\t>\n\t\t<template #opener>\n\t\t\t<div\n\t\t\t\tref=\"elRef\"\n\t\t\t\tv-top-focus.onupdate=\"isError\"\n\t\t\t\t:class=\"{\n\t\t\t\t\t'top-selector2' : true,\n\t\t\t\t\t'top-selector2-multiselect': multiselect,\n\t\t\t\t\t['top-size_' + size]: true,\n\t\t\t\t\t['top-disabled']: disabled,\n\t\t\t\t\t['top-forms-focusable']: !disabled,\n\t\t\t\t\t['top-error']: isError,\n\t\t\t\t}\"\n\t\t\t\t@keydown.up.down.enter.space.stop.prevent=\"($event.currentTarget as HTMLElement).click()\"\n\t\t\t\t@keydown.delete=\"model = []\"\n\t\t\t\ttabindex=\"0\"\n\t\t\t>\n\t\t\t\t<template v-if=\"multiselect\">\n\t\t\t\t\t<div class=\"top-selector2_activeItems\">\n\t\t\t\t\t\t<Selector2ItemMulti\n\t\t\t\t\t\t\tv-for=\"item of model as Array<Item>\"\n\t\t\t\t\t\t\t:id=\"item.id\"\n\t\t\t\t\t\t\t:name=\"item.name\"\n\t\t\t\t\t\t\t@delete=\"deleteItemById\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</template>\n\n\t\t\t\t<span v-if=\"!multiselect\" class=\"top-selector2_activeName top-ellipsis\">\n\t\t\t\t\t{{ !Array.isArray(model) ? model.name : '' }}\n\t\t\t\t</span>\n\n\t\t\t\t<span\n\t\t\t\t\tv-if=\"addChanger && !multiselect && localItems.length > 1 && !disabled\"\n\t\t\t\t\tclass=\"top-changer top-changer-selector\"\n\t\t\t\t\t@click.stop=\"selectNextItem\"\n\t\t\t\t></span>\n\t\t\t</div>\n\t\t</template>\n\n\t\t<template #widget v-if=\"showSearch\">\n\t\t\t<TopPopupWidgetInput\n\t\t\t\ttitle=\"Поиск\"\n\t\t\t\ticon=\"\"\n\t\t\t\tv-model=\"searchText\"\n\t\t\t\t:isLoading=\"isLoading\"\n\t\t\t\t:placeholder=\"!Array.isArray(model) && !multiselect && showSelectedInInput ? model.name : placeholder\"\n\t\t\t/>\n\t\t</template>\n\n\t\t<template #contentList>\n\t\t\t<TopPopupListItem\n\t\t\t\tv-for=\"item of itemsForShow\"\n\t\t\t\t:class=\"{\n\t\t\t\t\t'top-active': !Array.isArray(model) && !multiselect && model.name === item.name\n\t\t\t\t}\"\n\t\t\t\t:key=\"item.id ?? undefined\"\n\t\t\t\t@click.stop=\"selectItem(item)\"\n\t\t\t>\n\t\t\t\t<slot\n\t\t\t\t\tv-if=\"$slots.item\"\n\t\t\t\t\tname=\"item\"\n\t\t\t\t\t:item=\"item\"\n\t\t\t\t></slot>\n\n\t\t\t\t<template\n\t\t\t\t\tv-else\n\t\t\t\t>\n\t\t\t\t\t{{ item.name }}\n\t\t\t\t</template>\n\t\t\t</TopPopupListItem>\n\n\t\t\t<TopPopupListItem\n\t\t\t\tv-if=\"!isLoading && !itemsForShow.length\"\n\t\t\t\ttype=\"regular\"\n\t\t\t>\n\t\t\t\t{{ $i18n.Common.No_results }}\n\t\t\t</TopPopupListItem>\n\t\t</template>\n\t</TopPopup>\n</template>\n\n<style>\n.top-selector2 {\n\twidth: 180px;\n\tmin-height: var(--top-forms-base-height);\n\tbox-sizing: border-box;\n\tposition: relative;\n\tdisplay: flex;\n\toverflow: hidden;\n\tpadding: var(--top-padding-1) var(--top-forms-padding);\n\tcolor: var(--top-forms-placeholder-color);\n\n\tborder-radius: var(--top-radius-2);\n\tborder: 1px solid var(--top-forms-border-color);\n\tbackground: var(--top-forms-background-color);\n}\n\n.top-selector2-multiselect {\n\twidth: unset;\n\tmin-width: 180px;\n\tpadding: var(--top-padding-1);\n}\n\n.top-selector2.top-active {\n\t--top-forms-border-color: var(--top-forms-border-color-hover);\n}\n\n.top-selector2_activeItems {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: var(--top-padding-1);\n\tmax-width: 100%;\n}\n\n.top-selector2_activeName {\n\twhite-space: nowrap;\n}\n\n.top-changer-selector {\n\ttransform: translateX(-16px);\n}\n</style>\n","import type { ComponentCustomProps } from 'vue';\n\nimport EditArea from './editArea/editArea.vue';\nimport EditInput from './editInput/editInput.vue';\nimport RadioGroup from './radioGroup/radioGroup.vue';\nimport Selector2 from './selector2/selector2.vue';\nimport Menu from './menu/menu.vue';\nimport Info from './info/info.vue';\n\nexport const TopEditArea = EditArea as typeof EditArea & ComponentCustomProps;\nexport const TopEditInput = EditInput as typeof EditInput & ComponentCustomProps;\nexport const TopRadioGroup = RadioGroup as typeof RadioGroup & ComponentCustomProps;\nexport const TopSelector2 = Selector2 as typeof Selector2 & ComponentCustomProps;\nexport const TopMenu = Menu as typeof Menu & ComponentCustomProps;\nexport const TopInfo = Info as typeof Info & ComponentCustomProps;\n"],"names":["isChanged","vue","localValue","props","submit","value","emit","intermediateValue","elRef","model","_a","item","_c","_b","items","isLoading","_nextOffset","apiRequest","res","cacheKey","indexWithError","_searchText","callAPIRequest","loadAppend","searchText","minLength","loadDebounce","API","forms","popupRef","useAPI","localItems","itemAll","itemSelected","itemsForShow","searchStringInvertKeyboard","utils_keyboard","searchString","isSelected","selectItem","newModel","getPopup","resetSearch","nextIndex","deleteItemById","id","isOpened","onScrollContentList","e","el","TopEditArea","_sfc_main$5","TopEditInput","_sfc_main$4","TopRadioGroup","_sfc_main$3","TopSelector2","_sfc_main$1","TopMenu","menu_vue_vue_type_style_index_0_lang","TopInfo","_sfc_main"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"formsExt.amd.js","sources":["../../src/components/formsExt/editArea/editArea.vue","../../src/components/formsExt/editInput/editInput.vue","../../src/components/formsExt/radioGroup/radioGroup.vue","../../src/components/formsExt/checkboxGroup/checkboxGroup.vue","../../src/components/formsExt/selector2/api.ts","../../src/components/formsExt/selector2/selector2.vue","../../src/components/formsExt/formsExt.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, ref } from 'vue';\nimport Button from '@/components/forms/button/button.vue';\nimport type { Emits, Props } from './editArea';\nimport Textarea from '@/components/forms/textarea/textarea.vue';\n\nconst props = withDefaults(defineProps<Props>(), {\n\tdefaultValue: '',\n\tcancelText: 'Cancel',\n\tsubmitText: 'Send',\n\tcloseText: 'Close',\n\texpandable: true,\n});\n\nconst emit = defineEmits<Emits>();\n\nconst localValue = ref(props.defaultValue);\n\nconst isFocused = ref(props.isFocused);\n\nconst isChanged = computed(() => localValue.value !== props.defaultValue);\n\nconst submit = (value: string) => {\n\temit('submit', value);\n\n\tlocalValue.value = props.defaultValue;\n};\n\nconst cancel = () => {\n\tif (props.forceShowCloseBtn && !isChanged.value) {\n\t\temit('close');\n\n\t\treturn;\n\t}\n\n\tlocalValue.value = props.defaultValue;\n};\n\nconst clickOnTitle = () => {\n\tif (props.attachToKeyboard) emit('clickOnTitle');\n};\n</script>\n\n<template>\n\t<div\n\t\t:class=\"{\n\t\t\t'top-editArea': true,\n\t\t\t'top-editArea-attachedToKeyboard': attachToKeyboard,\n\t\t}\"\n\t>\n\t\t<div\n\t\t\tv-if=\"title\"\n\t\t\tclass=\"top-editArea_title\"\n\t\t\t@click=\"clickOnTitle()\"\n\t\t>\n\t\t\t{{ title }}\n\t\t</div>\n\n\t\t<div\n\t\t\t:class=\"{\n\t\t\t\t'top-editArea_form': true,\n\t\t\t\t'top-error': isError,\n\t\t\t\t'top-focus': isFocused,\n\t\t\t}\"\n\t\t>\n\t\t\t<Textarea\n\t\t\t\tv-model=\"localValue\"\n\t\t\t\t:name=\"name\"\n\t\t\t\t:placeholder=\"placeholder\"\n\t\t\t\t:rows=\"rows\"\n\t\t\t\t:minHeight=\"minHeight\"\n\t\t\t\t:expandable=\"expandable\"\n\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t:readonly=\"readonly\"\n\t\t\t\t:isError=\"isError\"\n\t\t\t\t:hint=\"hint\"\n\t\t\t\tclass=\"top-editArea_element\"\n\t\t\t\t@focus=\"() => isFocused = true\"\n\t\t\t\t@blur=\"() => isFocused = false\"\n\t\t\t\t@keyup.esc=\"cancel\"\n\t\t\t\t@keyup.ctrl.enter=\"submit(localValue)\"\n\t\t\t/>\n\n\t\t\t<div class=\"top-editArea_footer\">\n\t\t\t\t<Button\n\t\t\t\t\tv-if=\"isChanged || forceShowCloseBtn\"\n\t\t\t\t\t:icon=\"$core.state.isMobile ? '': ''\"\n\t\t\t\t\tclass=\"top-editArea_button\"\n\t\t\t\t\tcolor=\"theme\"\n\t\t\t\t\tstyling=\"soft\"\n\t\t\t\t\t@click=\"cancel\"\n\t\t\t\t>\n\t\t\t\t\t<template\n\t\t\t\t\t\t#default\n\t\t\t\t\t\tv-if=\"!$core.state.isMobile\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{{ cancelText }}\n\t\t\t\t\t</template>\n\t\t\t\t</Button>\n\n\t\t\t\t<Button\n\t\t\t\t\tclass=\"top-editArea_button\"\n\t\t\t\t\tv-if=\"isChanged\"\n\t\t\t\t\t:icon=\"$core.state.isMobile ? '': ''\"\n\t\t\t\t\t@click=\"submit(localValue)\"\n\t\t\t\t>\n\t\t\t\t\t<template\n\t\t\t\t\t\t#default\n\t\t\t\t\t\tv-if=\"!$core.state.isMobile\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{{ submitText }}\n\t\t\t\t\t</template>\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</template>\n\n<style>\n.top-editArea {\n\t--top-editArea-bottom: env(keyboard-inset-height, 0px);\n\t--top-editArea-offset-bottom: 0px;\n\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 6px;\n}\n\n.top-editArea_title {\n\tfont-size: 12px;\n}\n\n.top-editArea_form {\n\tflex-direction: column;\n\toutline: none;\n}\n\n.top-editArea_form:not(.top-error):hover,\n.top-editArea_form:not(.top-error).top-focus {\n\tborder-color: var(--top-forms-border-color-hover);\n}\n\n/* textarea в EditArea */\n.top-textarea {\n\twidth: 100%;\n}\n\n.top-editArea_element.top-textarea_textarea {\n\t--top-forms-border-width: 0px;\n\n\toutline: none;\n\tanimation: none;\n}\n\n/* footer */\n.top-editArea_footer {\n\tpadding: var(--top-forms-padding);\n\tdisplay: flex;\n\tmin-height: 32px;\n\talign-self: flex-end;\n\tjustify-content: flex-end;\n\tgap: var(--top-forms-padding);\n}\n\n/* attachedToKeyboard */\n.top-editArea-attachedToKeyboard {\n\tbackground: var(--top-forms-background-color);\n\tposition: fixed;\n\tbottom: calc(var(--top-editArea-offset-bottom) + var(--top-editArea-bottom));\n\tright: 0;\n\tleft: 0;\n\tz-index: 2;\n\tgap: 0;\n\ttransition: bottom var(--transition-fast);\n}\n\n.top-editArea-attachedToKeyboard .top-editArea_form {\n\tborder-radius: 0;\n\tborder: none;\n\tborder-top: 1px solid var(--top-forms-border-color);\n}\n\n.top-editArea-attachedToKeyboard .top-editArea_title {\n\tcursor: pointer;\n\tborder-top: 1px solid var(--color-line-2-opacity);\n\tpadding: var(--top-forms-padding);\n}\n\n.top-editArea-attachedToKeyboard .top-editArea_footer > [data-top-icon] {\n\tborder-radius: 100%;\n}\n\n@media screen and (max-width: 900px) {\n\t.top-editArea_form{\n\t\tflex-direction: row;\n\t}\n}\n</style>\n","<script setup lang=\"ts\">\nimport { ref, toRef, watch } from 'vue';\nimport type { Emits, Props } from './editInput';\nimport TopInput from '@/components/forms/input/input.vue';\nimport TopButton from '@/components/forms/button/button.vue';\n\nconst props = defineProps<Props>();\n\nconst intermediateValue = ref(props.modelValue);\n\nwatch(toRef(props.modelValue), () => {\n\tintermediateValue.value = props.modelValue;\n});\n\nconst emit = defineEmits<Emits>();\n\nconst submit = () => {\n\temit('update:modelValue', intermediateValue.value);\n};\n</script>\n\n<template>\n\t<div class=\"top-editInput\">\n\t\t<TopInput\n\t\t\t:=\"input\"\n\t\t\t@keydown.esc.capture.stop=\"intermediateValue = modelValue\"\n\t\t\t@keydown.enter.stop=\"submit\"\n\t\t\tv-model=\"intermediateValue\"\n\t\t/>\n\n\t\t<TopButton\n\t\t\tv-if=\"intermediateValue !== modelValue\"\n\t\t\ticon=\"\"\n\t\t\tstyling=\"soft\"\n\t\t\t:=\"button\"\n\t\t\t@click=\"submit\"\n\t\t/>\n\t</div>\n</template>\n\n<style>\n.top-editInput {\n\twidth: 220px;\n\tflex-grow: 1;\n\tdisplay: flex;\n\talign-items: flex-end;\n\tgap: var(--top-gap-1);\n}\n\n.top-editInput .top-input {\n\twidth: unset;\n\tflex-grow: 1;\n}\n</style>\n","<script setup lang=\"ts\">\nimport type { Ref } from '@vue/reactivity';\nimport { ref, watch } from 'vue';\nimport type { Props, Emits } from './radioGroup';\n\nconst model = defineModel<string>({\n\trequired: true,\n});\n\nconst props = withDefaults(defineProps<Props>(), {\n\tsize: 's',\n});\n\nconst emit = defineEmits<Emits>();\n\nconst elRef: Ref<HTMLElement | null> = ref(null);\n\nwatch(model, () => {\n\tif (!props.radiosProps?.some(item => item.value === model.value)) {\n\t\tmodel.value = props.radiosProps?.[0]?.value ?? '';\n\t}\n\n\telRef.value?.querySelector('.radioGroup_item-selected')?.scrollIntoView();\n}, { immediate: true });\n\nconst uid = 'radioGroup-' + Math.random();\n</script>\n\n<template>\n\t<div\n\t\tref=\"elRef\"\n\t\t:class=\"{\n\t\t\t['top-radioGroup']: true,\n\t\t\t['top-scrollBarXHidding']: true,\n\t\t\t['top-size_' + size]: !!size,\n\t\t\t['top-error']: isError,\n\t\t}\"\n\t>\n\t\t<label\n\t\t\tv-for=\"item of radiosProps\"\n\t\t\t:class=\"{\n\t\t\t\t['top-radioGroup_item-selected']: item.value === model,\n\t\t\t\t['top-radioGroup_item']: true,\n\t\t\t\t['top-forms-focusable']: true,\n\t\t\t\t['top-disabled']: item.disabled,\n\t\t\t}\"\n\t\t\t:data-top-icon=\"item.icon\"\n\t\t\t@click=\"model = item.value\"\n\t\t>\n\t\t\t{{ item.title }}\n\n\t\t\t<span\n\t\t\t\tv-if=\"showIndicator\"\n\t\t\t\tclass=\"top-radioGroup_circle\"\n\t\t\t></span>\n\n\t\t\t<!-- Для нативной навигации -->\n\t\t\t<input\n\t\t\t\tv-model=\"model\"\n\t\t\t\t:name=\"uid\"\n\t\t\t\ttype=\"radio\"\n\t\t\t\t:class=\"{\n\t\t\t\t\t['top-unvisible']: true,\n\t\t\t\t}\"\n\t\t\t\t:value=\"item.value\"\n\t\t\t\t:disabled=\"item.disabled\"\n\t\t\t/>\n\t\t</label>\n\t</div>\n</template>\n\n<style>\n.top-radioGroup {\n\tuser-select: none;\n\tbox-sizing: border-box;\n\tborder-radius: 8px;\n\tbackground-color: var(--color-layout-middle);\n\theight: var(--top-forms-base-height);\n\tpadding: 2px;\n\tgap: 2px;\n\tdisplay: flex;\n\talign-items: flex-start;\n}\n\n.top-radioGroup_item {\n\tcolor: var(--color-text-2);\n\tcursor: pointer;\n\tbox-sizing: border-box;\n\tborder-radius: 6px;\n\theight: calc(var(--top-forms-base-height) - 4px);\n\tpadding: 0 16px;\n\tfont-weight: 400;\n\twhite-space: nowrap;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tflex-grow: 1;\n\tgap: 4px;\n}\n\n.top-radioGroup_item:hover {\n\tbackground-color: var(--color-layout-front-1);\n\tbox-shadow: 0px 4px 32px 0px rgba(4, 9, 84, 0.10), 0px 0px 4px 0px rgba(4, 9, 84, 0.08);\n}\n\n/* selected */\n.top-radioGroup_item-selected {\n\tcolor: var(--color-text-1);\n\tpointer-events: none;\n\tbackground-color: var(--color-bg-lightning-1);\n\tbox-shadow: 0px 4px 32px 0px rgba(4, 9, 84, 0.10), 0px 0px 4px 0px rgba(4, 9, 84, 0.08);\n}\n\n/* circle */\n.top-radioGroup_circle {\n\tcontent: \"\";\n\tbox-sizing: border-box;\n\tborder: 1px solid var(--color-line-3-opacity);\n\tborder-radius: 50%;\n\tpadding: 3px;\n\tmargin-left: auto;\n\twidth: calc(var(--top-forms-option-height) - 3px * 2);\n\theight: calc(var(--top-forms-option-height) - 3px * 2);\n}\n\n.top-radioGroup_item:hover .top-radioGroup_circle:before {\n\tborder-color: var(--color-line-primary-1);\n}\n\n/* circle selected */\n.top-radioGroup_item-selected .top-radioGroup_circle {\n\tborder-color: var(--color-line-primary-1);\n\tborder-width: 5px;\n}\n\n.top-radioGroup_item-selected:hover .top-radioGroup_circle {\n\tborder-color: var(--color-line-primary-1);\n}\n\n/* top-error */\n.top-radioGroup.top-error .top-radioGroup_item:not(.top-disabled) .top-radioGroup_circle {\n\tborder-color: var(--color-line-negative-1);\n}\n</style>\n","<script setup lang=\"ts\">\nimport type { Props } from './types';\n\nconst model = defineModel<Props['modelValue']>({\n\trequired: true,\n});\n\nwithDefaults(defineProps<Props>(), {\n\tsize: 's',\n\tstyling: 'outline',\n});\n\nconst onChange = (id: string) => {\n\tconst newModel = [...model.value];\n\tconst index = newModel.indexOf(id);\n\n\tif (index === -1) {\n\t\tnewModel.push(id);\n\t} else {\n\t\tnewModel.splice(index, 1);\n\t}\n\n\tmodel.value = newModel;\n};\n</script>\n\n<template>\n\t<div\n\t\t:class=\"{\n \t\t['top-checkboxGroup']: true,\n \t\t['top-checkboxGroup-' + styling]: true,\n \t\t['top-scrollBarXHidding']: true,\n \t\t['top-size_' + size]: !!size,\n \t\t['top-error']: isError,\n \t}\"\n\t>\n\t\t<label\n\t\t\tv-for=\"item in items\"\n\t\t\t:key=\"item.id\"\n\t\t\t:class=\"{\n\t\t\t\t['top-checkboxGroup_item']: true,\n\t\t\t\t['top-checkboxGroup_item-selected']: model.includes(item.id),\n\t\t\t\t['top-forms-focusable']: true,\n\t\t\t\t['top-disabled']: item.disabled,\n\t\t\t}\"\n\t\t\t:data-top-icon=\"item.icon\"\n\t\t>\n\t\t\t<input\n\t\t\t\ttype=\"checkbox\"\n\t\t\t\tclass=\"top-unvisible\"\n\t\t\t\t:value=\"item.id\"\n\t\t\t\t:checked=\"model.includes(item.id)\"\n\t\t\t\t:disabled=\"item.disabled\"\n\t\t\t\t@change=\"onChange(item.id)\"\n\t\t\t/>\n\n\t\t\t{{ item.title }}\n\t\t</label>\n\t</div>\n</template>\n\n<style>\n.top-checkboxGroup {\n\tuser-select: none;\n\tborder-radius: 8px;\n\theight: var(--top-forms-base-height);\n\tbox-sizing: border-box;\n\tdisplay: flex;\n}\n\n.top-checkboxGroup_item {\n\tbox-sizing: border-box;\n\tpadding: 1px var(--top-padding-4);\n\tcursor: pointer;\n\tfont-weight: 600;\n\twhite-space: nowrap;\n\tdisplay: flex;\n\tflex-grow: 1;\n\tjustify-content: center;\n\talign-items: center;\n\tgap: var(--top-gap-1);\n}\n\n/* outline */\n.top-checkboxGroup-outline {\n\tborder: 1px solid var(--color-line-1);\n\tbackground: var(--color-layout-front-1);\n}\n\n.top-checkboxGroup-outline .top-checkboxGroup_item {\n\theight: calc(var(--top-forms-base-height) - 2px);\n\tmin-height: 100%;\n}\n\n.top-checkboxGroup-outline .top-checkboxGroup_item:hover {\n\tbackground: var(--color-layer-primary-1);\n}\n\n.top-checkboxGroup-outline .top-checkboxGroup_item-selected {\n\tbackground: var(--color-bg-primary-1);\n\tcolor: var(--color-text-white);\n\t--top-icon-color: var(--color-text-white);\n}\n\n.top-checkboxGroup-outline .top-checkboxGroup_item-selected:hover {\n\tbackground: var(--color-bg-primary-2);\n}\n\n.top-checkboxGroup-outline.top-error .top-checkboxGroup_item:hover {\n\tbackground: var(--color-layer-negative-1);\n}\n\n.top-checkboxGroup-outline.top-error .top-checkboxGroup_item-selected {\n\tbackground: var(--color-bg-negative-1);\n}\n\n.top-checkboxGroup-outline.top-error .top-checkboxGroup_item-selected:hover {\n\tbackground: var(--color-bg-negative-2);\n}\n\n/* borderless */\n.top-checkboxGroup-borderless {\n\tpadding: 2px;\n\tbackground: var(--color-bg-shading-2);\n\tgap: 2px;\n}\n\n.top-checkboxGroup-borderless .top-checkboxGroup_item {\n\tborder-radius: 6px;\n\theight: calc(var(--top-forms-base-height) - 4px);\n}\n\n.top-checkboxGroup-borderless .top-checkboxGroup_item:hover {\n\tbox-shadow: var(--top-shadow-s);\n\tbackground: var(--color-bg-lightning-1);\n}\n\n.top-checkboxGroup-borderless .top-checkboxGroup_item-selected {\n\tbackground: var(--color-bg-primary-1);\n\tcolor: var(--color-text-white);\n\t--top-icon-color: var(--color-text-white);\n}\n\n.top-checkboxGroup-borderless .top-checkboxGroup_item-selected:hover {\n\tbackground: var(--color-bg-primary-2);\n}\n\n.top-checkboxGroup-borderless.top-error .top-checkboxGroup_item:hover {\n\tbackground: var(--color-bg-lightning-1);\n}\n\n.top-checkboxGroup-borderless.top-error .top-checkboxGroup_item-selected {\n\tbackground: var(--color-bg-negative-1);\n}\n\n.top-checkboxGroup-borderless.top-error .top-checkboxGroup_item-selected:hover {\n\tbackground: var(--color-bg-negative-2);\n}\n</style>\n","import type { Ref } from 'vue';\nimport { ref } from 'vue';\nimport { debounce } from '@/core/utils/lodash';\nimport type { Item, Props } from './selector2';\n\nexport const useAPI = (apiRequest: Props['apiRequest'], minLength: number, useCache: Props['useCache']) => {\n\t/**\n\t * Список, полученный через API\n\t */\n\tconst items: Ref<Array<Item>> = ref([]);\n\n\t/**\n\t * Флаг - идет загрузка\n\t */\n\tconst isLoading = ref(false);\n\n\tlet _searchText = '';\n\tlet _nextOffset: number | undefined;\n\n\tif (apiRequest && !apiRequest.params.limit) {\n\t\tapiRequest.params.limit = 100;\n\t}\n\n\t/**\n\t * Выполнить обращение к API\n\t *\n\t * При ошибке вернет undefined\n\t */\n\tconst callAPIRequest = async (): Promise<{ nextOffset?: number, result: Array<Item> } | undefined> => {\n\t\tif (!apiRequest) return;\n\n\t\tlet res;\n\t\tlet cacheKey;\n\n\t\tif (useCache) {\n\t\t\t// кэш для полученных ответов через apiRequest\n\t\t\t// общий для всех компонентов, использующих apiRequest\n\t\t\tapiRequest.cache ??= new Map();\n\n\t\t\tcacheKey = JSON.stringify(apiRequest.params);\n\t\t\tres = apiRequest.cache.get(cacheKey);\n\n\t\t\tif (res) {\n\t\t\t\treturn res;\n\t\t\t}\n\t\t}\n\n\t\tisLoading.value = true;\n\t\tres = await apiRequest.call();\n\t\tisLoading.value = false;\n\n\t\tif (res.errors) return;\n\n\t\tif (!Array.isArray(res.result)) {\n\t\t\tconsole.warn(`В result ожидался массив`);\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst indexWithError = (res.result as Array<Item | any>).findIndex(item => item.id === undefined || item.name === undefined);\n\t\tif (indexWithError !== -1) {\n\t\t\tconsole.warn(`В result[${indexWithError}] нет id или name`);\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (useCache) {\n\t\t\tapiRequest.cache.set(cacheKey as string, res);\n\t\t}\n\n\t\treturn res;\n\t};\n\n\t/**\n\t * Загрузить items\n\t */\n\tconst load = async () => {\n\t\tif (!apiRequest) return;\n\n\t\tapiRequest.params.offset = 0;\n\t\tapiRequest.params.search = _searchText;\n\n\t\tconst res = await callAPIRequest();\n\t\tif (!res) return;\n\n\t\t_nextOffset = res.nextOffset;\n\n\t\titems.value = res.result;\n\t};\n\n\t/**\n\t * Загрузить следующую страницу items\n\t */\n\tconst loadAppend = async () => {\n\t\tif (!apiRequest) return;\n\n\t\t// данных о следующих страницах не обнаружено\n\t\tif (!_nextOffset) return;\n\n\t\t// дозагружать нельзя, если не завершена предыдущшая загрузка\n\t\tif (isLoading.value) return;\n\n\t\tapiRequest.params.offset = _nextOffset;\n\t\tapiRequest.params.search = _searchText;\n\n\t\tconst res = await callAPIRequest();\n\t\tif (!res) return;\n\n\t\t_nextOffset = res.nextOffset;\n\n\t\titems.value = items.value.concat(res.result);\n\t};\n\n\tconst loadDebounce = debounce(() => load(), 200);\n\n\t/**\n\t * Выполнить поиск по указанному тексту\n\t *\n\t * Если длина текста меньше minLength, поиск не будет проивзеден\n\t *\n\t * Если текст не изменился, поиск не будет проивзеден\n\t * @param searchText - текст поиска\n\t * @param useDebounce - отложенное выполнение поиска\n\t */\n\tconst setSearchTextAndLoad = (searchText: string, useDebounce = true) => {\n\t\tif (!apiRequest) return;\n\n\t\tif (searchText.length < minLength) return;\n\n\t\t// условия поиска не поменялись, данные загружены\n\t\tif (searchText === _searchText && items.value.length) return;\n\n\t\t_searchText = searchText;\n\n\t\tif (useDebounce) {\n\t\t\tloadDebounce();\n\t\t} else {\n\t\t\tvoid load();\n\t\t}\n\t};\n\n\treturn {\n\t\titems,\n\t\tisLoading,\n\t\tloadAppend,\n\t\tsetSearchTextAndLoad,\n\t};\n};\n","<script setup lang=\"ts\">\nimport type { ComputedRef, ModelRef, ComponentInstance } from 'vue';\nimport { computed, ref, watch } from 'vue';\nimport Core from '@/core/core/core';\nimport { invertKeyboardLayout } from '@/core/utils/keyboard';\nimport { useI18n } from '@/core/plugins/i18n';\nimport { TopPopup, TopPopupListItem, TopPopupWidgetInput } from '@/components/popup/popup';\nimport type { TopLibPopup } from '@/components/popup/lib/popup';\nimport type { Item, Props, Slots } from './selector2';\nimport { useAPI } from './api';\nimport Selector2ItemMulti from './itemMulti.vue';\n\nconst props = withDefaults(defineProps<Props>(), {\n\titems: () => [] as Array<Item>,\n\tsize: 's',\n\tminLength: 0,\n\tshowSelectedInInput: true,\n\tshowSearch: true,\n});\n\nconst model = defineModel<Props['modelValue']>() as ModelRef<Props['modelValue']>;\n\ndefineSlots<Slots>();\n\n/**\n * Текст поиска по результатам\n */\nconst searchText = ref('');\n\n/**\n * Сброс поиска\n */\nconst resetSearch = () => {\n\tsearchText.value = '';\n\tAPI.items.value = [];\n};\n\n\nconst itemAll = {\n\tid: 0,\n\tname: useI18n().Common.All!,\n};\n\n/**\n * Экземпляр компонента Popup\n */\nconst popupRef = ref<ComponentInstance<typeof TopPopup> | null>(null);\n\n/**\n * Основной элемент селектора\n */\nconst elRef = ref<HTMLElement | null>(null);\n\n/**\n * Получить доступ к объекту popup\n */\nconst getPopup = (): TopLibPopup | undefined => {\n\treturn popupRef.value?.popup;\n};\n\n// для storybook\nif ((window as any).__STORYBOOK_PREVIEW__ && !props.modelValue) {\n\twatch(\n\t\t() => props.multiselect,\n\t\t() => {\n\t\t\tmodel.value = props.multiselect ? [] : { id: null, name: '' };\n\t\t},\n\t\t{ immediate: true },\n\t);\n}\n\nconst API = useAPI(props.apiRequest, props.minLength, props.useCache);\n\n/**\n * Варианты выбора: props.items + \"Выбрать все\"\n */\nconst localItems: ComputedRef<Array<Item>> = computed(() => {\n\tconst items: Array<Item> = [];\n\n\tif (!props.multiselect && props.appendAllValue) {\n\t\titems.push(itemAll);\n\t}\n\n\tprops.items.forEach(item => items.push({ ...item }));\n\n\treturn items;\n});\n\n/**\n * Проверить, что элемент выбран\n */\nconst isSelected = (item: Item, checkNameForNullId = true) => {\n\tif (checkNameForNullId && item.id === null) {\n\t\tif (Array.isArray(model.value)) {\n\t\t\treturn model.value.some(itemSelected => itemSelected.id === item.id && itemSelected.name === item.name);\n\t\t} else {\n\t\t\treturn item.name === model.value.name;\n\t\t}\n\t}\n\n\tif (Array.isArray(model.value)) {\n\t\treturn model.value.some(itemSelected => itemSelected.id === item.id);\n\t} else {\n\t\treturn item.id === model.value.id;\n\t}\n};\n\n/**\n * Варианты выбора, которые выводятся\n */\nconst itemsForShow = computed(() => {\n\tconst searchString = searchText.value.toLowerCase();\n\tconst searchStringInvertKeyboard = invertKeyboardLayout(searchString);\n\n\tlet items: typeof localItems.value = [];\n\n\tlocalItems.value.forEach((item) => {\n\t\tconst itemName = item.name.toLowerCase();\n\n\t\tif (\n\t\t\titem.id === Number(searchString) ||\n\t\t\titemName.includes(searchString) ||\n\t\t\titemName.includes(searchStringInvertKeyboard)\n\t\t) {\n\t\t\tif (itemName === searchString || itemName === searchStringInvertKeyboard) {\n\t\t\t\titems.unshift(item);\n\t\t\t} else {\n\t\t\t\titems.push(item);\n\t\t\t}\n\t\t}\n\t});\n\n\titems.push(...API.items.value);\n\n\tif (\n\t\tprops.appendSearchToResult &&\n\t\t!!searchText.value &&\n\t\t(!items.length || items[0].name.toLowerCase() !== searchString)\n\t) {\n\t\titems.push({\n\t\t\tid: null,\n\t\t\tname: searchText.value,\n\t\t});\n\t}\n\n\tif (props.multiselect) {\n\t\titems = items.filter(item => !isSelected(item));\n\t}\n\n\treturn items;\n});\n\n/**\n * Флаг - идет загрузка\n *\n * Скрывает вывод заглушки \"Нет результатов\" - для загрузки данных через API (multiselect = true) - (см. selectItem)\n */\nconst isLoading = ref(API.isLoading.value);\n\nwatch(API.isLoading, () => {\n\tisLoading.value = API.isLoading.value;\n});\n\n/**\n * Выбрать значение\n *\n * Управляет закрытием окна\n */\nconst selectItem = async (item: Item) => {\n\tif (props.multiselect) {\n\t\tif (!Array.isArray(model.value)) return;\n\n\t\tif (isSelected(item)) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (props.apiRequest && searchText.value) {\n\t\t\tisLoading.value = true;\n\t\t}\n\n\t\tconst newModel = [...model.value];\n\t\tnewModel.push({ ...item });\n\t\tmodel.value = newModel;\n\n\t\tif (Core.state.isMobile) {\n\t\t\tgetPopup()?.close();\n\t\t} else {\n\t\t\tsetTimeout(() => {\n\t\t\t\tgetPopup()?.recalcPosition();\n\t\t\t\tgetPopup()?.elPopupWidget?.querySelector('input')?.focus();\n\n\t\t\t\tif (searchText.value) resetSearch();\n\t\t\t});\n\t\t}\n\t} else {\n\t\tif (JSON.stringify(item) !== JSON.stringify(model.value)) {\n\t\t\tmodel.value = { ...item };\n\t\t}\n\n\t\tgetPopup()?.close();\n\t}\n};\n\n/**\n * Выбрать следующее значение\n */\nconst selectNextItem = () => {\n\tif (!Array.isArray(model.value)) {\n\t\tconst currentIndex = localItems.value.findIndex(item => item.id === (model.value as Item).id);\n\t\tconst nextIndex = (currentIndex + 1) % localItems.value.length;\n\t\tmodel.value = { ...localItems.value[nextIndex] };\n\t}\n};\n\n/**\n * Удалить выбранное значение по id\n * @param id\n */\nconst deleteItemById = async (id: Item['id']) => {\n\tif (Array.isArray(model.value)) {\n\t\tmodel.value = model.value.filter(item => item.id !== id);\n\n\t\tsetTimeout(() => {\n\t\t\tgetPopup()?.recalcPosition();\n\t\t});\n\t}\n};\n\nconst isOpened = ref(false); // флаг попап открыт\n\nif (props.apiRequest) {\n\twatch(isOpened, () => {\n\t\tif (isOpened.value) {\n\t\t\t// при открытии сразу выполнить поиск\n\t\t\tAPI.setSearchTextAndLoad(searchText.value, false);\n\t\t}\n\t});\n\n\t// отложенный поиск при вводе текста\n\twatch(searchText, () => API.setSearchTextAndLoad(searchText.value));\n}\n\nconst onScrollContentList = (e: Event) => {\n\tconst el = e.target as HTMLElement;\n\n\tif (el.scrollTop / (el.scrollHeight - el.offsetHeight) > 0.8) {\n\t\tAPI.loadAppend();\n\t}\n};\n\nconst onClose = () => {\n\tisOpened.value = false;\n\n\telRef.value?.focus();\n\n\tif (searchText.value) resetSearch();\n};\n</script>\n\n<template>\n\t<TopPopup\n\t\tref=\"popupRef\"\n\t\t@open=\"isOpened = true\"\n\t\t@close=\"onClose()\"\n\t\t@scrollContentList=\"apiRequest ? onScrollContentList($event) : undefined\"\n\t\t:notch=\"false\"\n\t\t:transitionDuration=\"0\"\n\t>\n\t\t<template #opener>\n\t\t\t<div\n\t\t\t\tref=\"elRef\"\n\t\t\t\tv-top-focus.onupdate=\"isError\"\n\t\t\t\t:class=\"{\n\t\t\t\t\t'top-selector2' : true,\n\t\t\t\t\t'top-selector2-multiselect': multiselect,\n\t\t\t\t\t['top-size_' + size]: true,\n\t\t\t\t\t['top-disabled']: disabled,\n\t\t\t\t\t['top-forms-focusable']: !disabled,\n\t\t\t\t\t['top-error']: isError,\n\t\t\t\t}\"\n\t\t\t\t@keydown.up.down.enter.space.stop.prevent=\"($event.currentTarget as HTMLElement).click()\"\n\t\t\t\t@keydown.delete=\"model = []\"\n\t\t\t\ttabindex=\"0\"\n\t\t\t>\n\t\t\t\t<template v-if=\"multiselect\">\n\t\t\t\t\t<div class=\"top-selector2_activeItems\">\n\t\t\t\t\t\t<Selector2ItemMulti\n\t\t\t\t\t\t\tv-for=\"item of model as Array<Item>\"\n\t\t\t\t\t\t\t:id=\"item.id\"\n\t\t\t\t\t\t\t:name=\"item.name\"\n\t\t\t\t\t\t\t@delete=\"deleteItemById\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</template>\n\n\t\t\t\t<span v-if=\"!multiselect\" class=\"top-selector2_activeName top-ellipsis\">\n\t\t\t\t\t{{ !Array.isArray(model) ? model.name : '' }}\n\t\t\t\t</span>\n\n\t\t\t\t<span\n\t\t\t\t\tv-if=\"addChanger && !multiselect && localItems.length > 1 && !disabled\"\n\t\t\t\t\tclass=\"top-changer top-changer-selector\"\n\t\t\t\t\t@click.stop=\"selectNextItem\"\n\t\t\t\t></span>\n\t\t\t</div>\n\t\t</template>\n\n\t\t<template #widget v-if=\"showSearch\">\n\t\t\t<TopPopupWidgetInput\n\t\t\t\ttitle=\"Поиск\"\n\t\t\t\ticon=\"\"\n\t\t\t\tv-model=\"searchText\"\n\t\t\t\t:isLoading=\"isLoading\"\n\t\t\t\t:placeholder=\"!Array.isArray(model) && !multiselect && showSelectedInInput ? model.name : placeholder\"\n\t\t\t/>\n\t\t</template>\n\n\t\t<template #contentList>\n\t\t\t<TopPopupListItem\n\t\t\t\tv-for=\"item of itemsForShow\"\n\t\t\t\t:class=\"{\n\t\t\t\t\t'top-active': !Array.isArray(model) && !multiselect && model.name === item.name\n\t\t\t\t}\"\n\t\t\t\t:key=\"item.id ?? undefined\"\n\t\t\t\t@click.stop=\"selectItem(item)\"\n\t\t\t>\n\t\t\t\t<slot\n\t\t\t\t\tv-if=\"$slots.item\"\n\t\t\t\t\tname=\"item\"\n\t\t\t\t\t:item=\"item\"\n\t\t\t\t></slot>\n\n\t\t\t\t<template\n\t\t\t\t\tv-else\n\t\t\t\t>\n\t\t\t\t\t{{ item.name }}\n\t\t\t\t</template>\n\t\t\t</TopPopupListItem>\n\n\t\t\t<TopPopupListItem\n\t\t\t\tv-if=\"!isLoading && !itemsForShow.length\"\n\t\t\t\ttype=\"regular\"\n\t\t\t>\n\t\t\t\t{{ $i18n.Common.No_results }}\n\t\t\t</TopPopupListItem>\n\t\t</template>\n\t</TopPopup>\n</template>\n\n<style>\n.top-selector2 {\n\twidth: 180px;\n\tmin-height: var(--top-forms-base-height);\n\tbox-sizing: border-box;\n\tposition: relative;\n\tdisplay: flex;\n\toverflow: hidden;\n\tpadding: var(--top-padding-1) var(--top-forms-padding);\n\tcolor: var(--top-forms-placeholder-color);\n\n\tborder-radius: var(--top-radius-2);\n\tborder: 1px solid var(--top-forms-border-color);\n\tbackground: var(--top-forms-background-color);\n}\n\n.top-selector2-multiselect {\n\twidth: unset;\n\tmin-width: 180px;\n\tpadding: var(--top-padding-1);\n}\n\n.top-selector2.top-active {\n\t--top-forms-border-color: var(--top-forms-border-color-hover);\n}\n\n.top-selector2_activeItems {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: var(--top-padding-1);\n\tmax-width: 100%;\n}\n\n.top-selector2_activeName {\n\twhite-space: nowrap;\n}\n\n.top-changer-selector {\n\ttransform: translateX(-16px);\n}\n</style>\n","import type { ComponentCustomProps } from 'vue';\n\nimport EditArea from './editArea/editArea.vue';\nimport EditInput from './editInput/editInput.vue';\nimport RadioGroup from './radioGroup/radioGroup.vue';\nimport CheckboxGroup from './checkboxGroup/checkboxGroup.vue';\nimport Selector2 from './selector2/selector2.vue';\nimport Menu from './menu/menu.vue';\nimport Info from './info/info.vue';\n\nexport const TopEditArea = EditArea as typeof EditArea & ComponentCustomProps;\nexport const TopEditInput = EditInput as typeof EditInput & ComponentCustomProps;\nexport const TopRadioGroup = RadioGroup as typeof RadioGroup & ComponentCustomProps;\nexport const TopCheckboxGroup = CheckboxGroup as typeof CheckboxGroup & ComponentCustomProps;\nexport const TopSelector2 = Selector2 as typeof Selector2 & ComponentCustomProps;\nexport const TopMenu = Menu as typeof Menu & ComponentCustomProps;\nexport const TopInfo = Info as typeof Info & ComponentCustomProps;\n"],"names":["isChanged","vue","localValue","props","submit","value","emit","intermediateValue","elRef","model","_a","item","_c","_b","onChange","id","index","newModel","items","isLoading","_nextOffset","apiRequest","res","cacheKey","indexWithError","_searchText","callAPIRequest","loadAppend","searchText","minLength","loadDebounce","API","forms","popupRef","useAPI","localItems","itemAll","itemSelected","itemsForShow","searchStringInvertKeyboard","utils_keyboard","searchString","isSelected","selectItem","getPopup","resetSearch","nextIndex","deleteItemById","isOpened","onScrollContentList","e","el","TopEditArea","_sfc_main$6","TopEditInput","_sfc_main$5","TopRadioGroup","_sfc_main$4","TopCheckboxGroup","_sfc_main$3","TopSelector2","_sfc_main$1","TopMenu","menu_vue_vue_type_style_index_0_lang","TopInfo","_sfc_main"],"mappings":"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"}
|