@topvisor/ui 1.0.28 → 1.0.30-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.chunks/{core-asoGK-7D.es.js → core-DerSGhnf.es.js} +5 -5
- package/.chunks/core-DerSGhnf.es.js.map +1 -0
- package/.chunks/core-tZjrVA9F.amd.js +2 -0
- package/.chunks/core-tZjrVA9F.amd.js.map +1 -0
- package/.chunks/{datepicker-BYBYKhbw.es.js → datepicker-KbendK1M.es.js} +2 -2
- package/.chunks/{datepicker-BYBYKhbw.es.js.map → datepicker-KbendK1M.es.js.map} +1 -1
- package/.chunks/{datepicker-BvawRSTl.amd.js → datepicker-Xsb3xcX8.amd.js} +2 -2
- package/.chunks/{datepicker-BvawRSTl.amd.js.map → datepicker-Xsb3xcX8.amd.js.map} +1 -1
- package/.chunks/{dialog_selectorRegions-CpBiVjgI.es.js → dialog_selectorRegions-CQB8rW_o.es.js} +4 -4
- package/.chunks/{dialog_selectorRegions-CpBiVjgI.es.js.map → dialog_selectorRegions-CQB8rW_o.es.js.map} +1 -1
- package/.chunks/{dialog_selectorRegions-DVz3N6Dj.amd.js → dialog_selectorRegions-Chq0yqFg.amd.js} +2 -2
- package/.chunks/{dialog_selectorRegions-DVz3N6Dj.amd.js.map → dialog_selectorRegions-Chq0yqFg.amd.js.map} +1 -1
- package/.chunks/{dialogs.vue_vue_type_script_setup_true_lang--09NOqOd.es.js → dialogs.vue_vue_type_script_setup_true_lang-BRv3Mpzj.es.js} +43 -43
- package/.chunks/dialogs.vue_vue_type_script_setup_true_lang-BRv3Mpzj.es.js.map +1 -0
- package/.chunks/dialogs.vue_vue_type_script_setup_true_lang-DRXenVvu.amd.js +2 -0
- package/.chunks/dialogs.vue_vue_type_script_setup_true_lang-DRXenVvu.amd.js.map +1 -0
- package/.chunks/{forms-CD0nOB5f.amd.js → forms-BvGGRIzu.amd.js} +3 -3
- package/.chunks/{forms-CD0nOB5f.amd.js.map → forms-BvGGRIzu.amd.js.map} +1 -1
- package/.chunks/{forms-qJ3k2PG6.es.js → forms-DvSi_Mh8.es.js} +251 -236
- package/.chunks/{forms-qJ3k2PG6.es.js.map → forms-DvSi_Mh8.es.js.map} +1 -1
- package/.chunks/{listItem.vue_vue_type_script_setup_true_lang-BlC9NJdi.es.js → listItem.vue_vue_type_script_setup_true_lang-BsOU-bZ6.es.js} +2 -2
- package/.chunks/{listItem.vue_vue_type_script_setup_true_lang-BlC9NJdi.es.js.map → listItem.vue_vue_type_script_setup_true_lang-BsOU-bZ6.es.js.map} +1 -1
- package/.chunks/{listItem.vue_vue_type_script_setup_true_lang-BAEJrRYd.amd.js → listItem.vue_vue_type_script_setup_true_lang-yo0gJ6X4.amd.js} +2 -2
- package/.chunks/{listItem.vue_vue_type_script_setup_true_lang-BAEJrRYd.amd.js.map → listItem.vue_vue_type_script_setup_true_lang-yo0gJ6X4.amd.js.map} +1 -1
- package/.chunks/{menu.vue_vue_type_style_index_0_lang-Oq5353Ax.amd.js → menu.vue_vue_type_style_index_0_lang-DdTdt1qa.amd.js} +2 -2
- package/.chunks/{menu.vue_vue_type_style_index_0_lang-Oq5353Ax.amd.js.map → menu.vue_vue_type_style_index_0_lang-DdTdt1qa.amd.js.map} +1 -1
- package/.chunks/{menu.vue_vue_type_style_index_0_lang-CDkyMyEi.es.js → menu.vue_vue_type_style_index_0_lang-LMqVTnj9.es.js} +2 -2
- package/.chunks/{menu.vue_vue_type_style_index_0_lang-CDkyMyEi.es.js.map → menu.vue_vue_type_style_index_0_lang-LMqVTnj9.es.js.map} +1 -1
- package/.chunks/{notice-rP8nJxrF.amd.js → notice-CB8iRenB.amd.js} +2 -2
- package/.chunks/{notice-rP8nJxrF.amd.js.map → notice-CB8iRenB.amd.js.map} +1 -1
- package/.chunks/{notice-somyoQTl.es.js → notice-DNMb2ah9.es.js} +2 -2
- package/.chunks/{notice-somyoQTl.es.js.map → notice-DNMb2ah9.es.js.map} +1 -1
- package/.chunks/{page.vue_vue_type_script_setup_true_lang-D8EtPAsl.amd.js → page.vue_vue_type_script_setup_true_lang-CpTBLsTO.amd.js} +2 -2
- package/.chunks/{page.vue_vue_type_script_setup_true_lang-D8EtPAsl.amd.js.map → page.vue_vue_type_script_setup_true_lang-CpTBLsTO.amd.js.map} +1 -1
- package/.chunks/{page.vue_vue_type_script_setup_true_lang-SJpF_87B.es.js → page.vue_vue_type_script_setup_true_lang-syEbR-ts.es.js} +4 -4
- package/.chunks/{page.vue_vue_type_script_setup_true_lang-SJpF_87B.es.js.map → page.vue_vue_type_script_setup_true_lang-syEbR-ts.es.js.map} +1 -1
- package/.chunks/{popup-NHfxJUAB.es.js → popup-B8NUff7S.es.js} +4 -4
- package/.chunks/popup-B8NUff7S.es.js.map +1 -0
- package/.chunks/popup-TDcAXCva.amd.js +2 -0
- package/.chunks/popup-TDcAXCva.amd.js.map +1 -0
- package/.chunks/{utils-BPFSJAiy.amd.js → utils-B0ZFaEX-.amd.js} +2 -2
- package/.chunks/{utils-BPFSJAiy.amd.js.map → utils-B0ZFaEX-.amd.js.map} +1 -1
- package/.chunks/utils-CW_aQoj6.es.js +220 -0
- package/.chunks/utils-CW_aQoj6.es.js.map +1 -0
- package/.chunks/utils-Cx-PLrV1.amd.js +2 -0
- package/.chunks/utils-Cx-PLrV1.amd.js.map +1 -0
- package/.chunks/{utils-B-1oTT6I.es.js → utils-hS40kghU.es.js} +2 -2
- package/.chunks/{utils-B-1oTT6I.es.js.map → utils-hS40kghU.es.js.map} +1 -1
- package/assets/core.css +1 -1
- package/assets/forms.css +1 -1
- package/assets/formsExt.css +1 -1
- package/assets/layout.css +1 -1
- package/assets/project.css +1 -1
- package/charts/charts.amd.js +1 -1
- package/charts/charts.amd.js.map +1 -1
- package/charts/charts.js +1 -1
- package/charts/charts.js.map +1 -1
- package/components/forms/avatar/avatar.d.ts +4 -10
- package/components/forms/button/button.vue.d.ts +2 -3
- package/components/forms/button/types.d.ts +5 -19
- package/components/forms/forms.d.ts +2 -0
- package/components/forms/helpers.d.ts +1 -10
- package/components/forms/input/input.d.ts +5 -16
- package/components/forms/input/input.vue.d.ts +2 -3
- package/components/forms/preloader/preloader.vue.d.ts +4 -0
- package/components/forms/preloader/types.d.ts +3 -0
- package/components/forms/select/select.d.ts +2 -2
- package/components/forms/select/select.vue.d.ts +1 -2
- package/components/formsExt/checkboxGroup/checkboxGroup.vue.d.ts +16 -0
- package/components/formsExt/checkboxGroup/stories/example.d.ts +15 -0
- package/components/formsExt/checkboxGroup/types.d.ts +2 -3
- package/components/formsExt/formsExt.d.ts +2 -0
- package/components/formsExt/radioGroup/radioGroup.d.ts +3 -3
- package/components/formsExt/radioGroup/radioGroup.vue.d.ts +4 -7
- package/components/formsExt/radioGroup/stories/example.d.ts +20 -0
- package/components/formsExt/selector2/selector2.d.ts +2 -2
- package/components/formsExt/selector2/selector2.vue.d.ts +1 -2
- package/components/project/selectorRegion/composables/selectRegion.d.ts +0 -1
- package/core/app.amd.js +1 -1
- package/core/app.js +5 -5
- package/core/directives/preloader.d.ts +8 -0
- package/dialog/dialog.amd.js +1 -1
- package/dialog/dialog.js +2 -2
- package/extra/extra.amd.js +1 -1
- package/extra/extra.amd.js.map +1 -1
- package/extra/extra.js +15 -16
- package/extra/extra.js.map +1 -1
- package/forms/forms.amd.js +1 -1
- package/forms/forms.js +6 -5
- package/forms/helpers.amd.js +1 -1
- package/forms/helpers.amd.js.map +1 -1
- package/forms/helpers.d.ts +0 -1
- package/forms/helpers.js +1 -9
- package/forms/helpers.js.map +1 -1
- package/formsExt/formsExt.amd.js +1 -1
- package/formsExt/formsExt.amd.js.map +1 -1
- package/formsExt/formsExt.js +349 -287
- package/formsExt/formsExt.js.map +1 -1
- package/layout/layout.amd.js +1 -1
- package/layout/layout.js +1 -1
- package/layout/layout.js.map +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.amd.js.map +1 -1
- package/project/project.js +175 -175
- package/project/project.js.map +1 -1
- package/tabsView/tabsView.amd.js +1 -1
- package/tabsView/tabsView.amd.js.map +1 -1
- package/tabsView/tabsView.js +1 -1
- package/tabsView/tabsView.js.map +1 -1
- package/utils/clipboard.amd.js +1 -1
- package/utils/clipboard.js +1 -1
- package/utils/date.amd.js +1 -1
- package/utils/date.js +1 -1
- package/utils/device.amd.js +1 -1
- package/utils/device.js +1 -1
- package/utils/lodash.amd.js +1 -1
- package/utils/lodash.js +1 -1
- package/utils/price.amd.js +1 -1
- package/utils/price.js +1 -1
- package/utils/searchers.amd.js +1 -1
- package/utils/searchers.js +3 -3
- package/utils/string.amd.js +1 -1
- package/utils/string.js +1 -1
- package/.chunks/core-CAMGByIQ.amd.js +0 -2
- package/.chunks/core-CAMGByIQ.amd.js.map +0 -1
- package/.chunks/core-asoGK-7D.es.js.map +0 -1
- package/.chunks/dialogs.vue_vue_type_script_setup_true_lang--09NOqOd.es.js.map +0 -1
- package/.chunks/dialogs.vue_vue_type_script_setup_true_lang-BCvCrDYf.amd.js +0 -2
- package/.chunks/dialogs.vue_vue_type_script_setup_true_lang-BCvCrDYf.amd.js.map +0 -1
- package/.chunks/popup-BpdlKk5T.amd.js +0 -2
- package/.chunks/popup-BpdlKk5T.amd.js.map +0 -1
- package/.chunks/popup-NHfxJUAB.es.js.map +0 -1
- package/.chunks/utils-CZwaa5j-.amd.js +0 -2
- package/.chunks/utils-CZwaa5j-.amd.js.map +0 -1
- package/.chunks/utils-DI9i3mGB.es.js +0 -225
- package/.chunks/utils-DI9i3mGB.es.js.map +0 -1
|
@@ -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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Size
|
|
1
|
+
import { Size } from '../../forms/helpers';
|
|
2
2
|
export interface Props {
|
|
3
|
-
modelValue: string;
|
|
3
|
+
modelValue: number | string;
|
|
4
4
|
/**
|
|
5
5
|
* Массив props для вставки radioGroupItem
|
|
6
6
|
*/
|
|
@@ -18,4 +18,4 @@ export interface ItemProps {
|
|
|
18
18
|
icon?: string;
|
|
19
19
|
disabled?: boolean;
|
|
20
20
|
}
|
|
21
|
-
export {
|
|
21
|
+
export type { Size };
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import { Props } from './radioGroup';
|
|
1
|
+
import { Props, Size } from './radioGroup';
|
|
2
2
|
import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
3
|
-
import { Size } from '../../forms/helpers';
|
|
4
3
|
type __VLS_Props = Props;
|
|
5
4
|
type __VLS_PublicProps = {
|
|
6
|
-
modelValue:
|
|
5
|
+
modelValue: Props['modelValue'];
|
|
7
6
|
} & __VLS_Props;
|
|
8
7
|
declare const _default: DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
9
|
-
"update:modelValue": (value: string) => any;
|
|
10
|
-
} & {
|
|
11
|
-
"update:modelValue": (value: string) => any;
|
|
8
|
+
"update:modelValue": (value: string | number) => any;
|
|
12
9
|
}, string, PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
13
|
-
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
10
|
+
"onUpdate:modelValue"?: ((value: string | number) => any) | undefined;
|
|
14
11
|
}>, {
|
|
15
12
|
size: Size;
|
|
16
13
|
}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const radiosProps1: ({
|
|
2
|
+
value: number;
|
|
3
|
+
title: string;
|
|
4
|
+
disabled?: undefined;
|
|
5
|
+
} | {
|
|
6
|
+
value: number;
|
|
7
|
+
title: string;
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
})[];
|
|
10
|
+
export declare const radiosProps2: ({
|
|
11
|
+
value: number;
|
|
12
|
+
title: string;
|
|
13
|
+
icon: string;
|
|
14
|
+
disabled?: undefined;
|
|
15
|
+
} | {
|
|
16
|
+
value: number;
|
|
17
|
+
title: string;
|
|
18
|
+
icon: string;
|
|
19
|
+
disabled: boolean;
|
|
20
|
+
})[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Size
|
|
1
|
+
import { Size } from '../../forms/helpers';
|
|
2
2
|
export interface Props {
|
|
3
3
|
/**
|
|
4
4
|
* Выбранный элемент
|
|
@@ -131,4 +131,4 @@ export interface Item {
|
|
|
131
131
|
name: string;
|
|
132
132
|
[propName: string]: any;
|
|
133
133
|
}
|
|
134
|
-
export {
|
|
134
|
+
export type { Size };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { TopLibPopup } from '../../popup/lib/popup';
|
|
2
|
-
import { Item, Props, Slots } from './selector2';
|
|
2
|
+
import { Item, Props, Slots, Size } from './selector2';
|
|
3
3
|
import { ComponentInternalInstance, VNodeProps, AllowedComponentProps, ComponentCustomProps, Slot, ComponentPublicInstance, ComponentOptionsBase, ComponentOptionsMixin, GlobalComponents, GlobalDirectives, ComponentProvideOptions, DebuggerEvent, nextTick, WatchOptions, WatchStopHandle, ShallowUnwrapRef, ComponentCustomProperties, DefineComponent, PublicProps } from 'vue';
|
|
4
4
|
import { PopupEvent, Props } from '../../popup/popup/popup';
|
|
5
5
|
import { OnCleanup } from '@vue/reactivity';
|
|
6
|
-
import { Size } from '../../forms/helpers';
|
|
7
6
|
type __VLS_Props = Props;
|
|
8
7
|
type __VLS_PublicProps = {
|
|
9
8
|
modelValue?: Props['modelValue'];
|
|
@@ -6,7 +6,6 @@ import { Props, SearcherIndexed } from '../selectorRegion';
|
|
|
6
6
|
*
|
|
7
7
|
* @param props - входные props компонента
|
|
8
8
|
* @param activeSearcherIndexed - объект активной поисковой системы (реактивная)
|
|
9
|
-
* @param regionsIndexes - входные индексы регионов/ПС
|
|
10
9
|
*/
|
|
11
10
|
export declare const useSelectRegion: (props: Props, activeSearcherIndexed: ComputedRef<SearcherIndexed>) => {
|
|
12
11
|
regionIndex: Ref<number, number>;
|
package/core/app.amd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
define(["require","exports","../.chunks/forms-
|
|
1
|
+
define(["require","exports","../.chunks/forms-BvGGRIzu.amd","../.chunks/core-tZjrVA9F.amd","vue","../utils/clipboard.amd","../utils/string.amd","../utils/route.amd","../.chunks/utils-B0ZFaEX-.amd","../.chunks/dialogs.vue_vue_type_script_setup_true_lang-DRXenVvu.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-DvSi_Mh8.es.js";
|
|
2
|
+
import { C as P, i as T, u as b, a as y } from "../.chunks/forms-DvSi_Mh8.es.js";
|
|
3
|
+
import { c as G } from "../.chunks/core-DerSGhnf.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-hS40kghU.es.js";
|
|
9
|
+
import { T as j } from "../.chunks/dialogs.vue_vue_type_script_setup_true_lang-BRv3Mpzj.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-CpTBLsTO.amd","vue","../.chunks/utils-B0ZFaEX-.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-syEbR-ts.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-hS40kghU.es.js";
|
|
4
4
|
const C = {
|
|
5
5
|
name: {
|
|
6
6
|
type: String,
|
package/extra/extra.amd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
define(["require","exports","vue","
|
|
1
|
+
define(["require","exports","vue","../require/css.amd!../assets/extra.css"],function(f,p,e){"use strict";if(typeof e>"u")var e=window.Vue;function y(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,o.get?o:{enumerable:!0,get:()=>t[n]})}}return r.default=t,Object.freeze(r)}const m=e.defineComponent({__name:"rive",props:{src:{},buffer:{},riveFile:{},artboard:{},animations:{},stateMachines:{},layout:{},autoplay:{type:Boolean,default:!0},useOffscreenRenderer:{type:Boolean},enableRiveAssetCDN:{type:Boolean},shouldDisableRiveListeners:{type:Boolean},isTouchScrollEnabled:{type:Boolean},automaticallyHandleEvents:{type:Boolean},onLoad:{},onLoadError:{},onPlay:{},onPause:{},onStop:{},onLoop:{},onStateChange:{},onAdvance:{},assetLoader:{},onload:{},onloaderror:{},onplay:{},onpause:{},onstop:{},onloop:{},onstatechange:{}},setup(t,{expose:r}){let n;const o=t,l=e.ref(),s={riveInstance:void 0};return e.watch([l,o],async()=>{var d;n||(n=await new Promise((u,i)=>f(["@rive-app/canvas-lite"],c=>u(y(c)),i)));const a=l.value;if(!a)return;(d=s.riveInstance)==null||d.cleanup();const v={...o,canvas:a,onLoad:u=>{var i,c;(i=o.onLoad)==null||i.call(o,u),(c=s.riveInstance)==null||c.resizeDrawingSurfaceToCanvas()}};s.riveInstance=new n.Rive(v)}),e.onUnmounted(()=>{var a;(a=s.riveInstance)==null||a.cleanup()}),r(s),(a,v)=>(e.openBlock(),e.createElementBlock("canvas",{ref_key:"el",ref:l,class:"top-rive"},null,512))}});p.TopRive=m,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
|
|
2
2
|
//# sourceMappingURL=extra.amd.js.map
|
package/extra/extra.amd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extra.amd.js","sources":["../../src/components/extra/extra.ts","../../src/components/extra/rive/rive.vue"],"sourcesContent":["import type { ComponentCustomProps } from 'vue';\n\nimport Rive from './rive/rive.vue';\n\nexport const TopRive = Rive as typeof Rive & ComponentCustomProps;\n","<script setup lang=\"ts\">\nimport {
|
|
1
|
+
{"version":3,"file":"extra.amd.js","sources":["../../src/components/extra/extra.ts","../../src/components/extra/rive/rive.vue"],"sourcesContent":["import type { ComponentCustomProps } from 'vue';\n\nimport Rive from './rive/rive.vue';\n\nexport const TopRive = Rive as typeof Rive & ComponentCustomProps;\n","<script setup lang=\"ts\">\nimport { onUnmounted, ref, watch } from 'vue';\nimport type { Rive, RiveParameters } from '@rive-app/canvas-lite';\nimport type { Props } from './types';\n\nlet rive: typeof import('@rive-app/canvas-lite');\n\nconst props = withDefaults(defineProps<Props>(), {\n\tautoplay: true,\n});\n\nconst el = ref<HTMLCanvasElement>();\n\nconst topRive = {\n\triveInstance: undefined as Rive | undefined,\n};\n\nwatch([el, props], async () => {\n\tif (!rive) rive = await import('@rive-app/canvas-lite');\n\n\tconst canvas = el.value;\n\tif (!canvas) return;\n\n\ttopRive.riveInstance?.cleanup();\n\n\tconst options: RiveParameters = {\n\t\t...props,\n\t\tcanvas,\n\t\tonLoad: (e) => {\n\t\t\tprops.onLoad?.(e);\n\n\t\t\ttopRive.riveInstance?.resizeDrawingSurfaceToCanvas();\n\t\t},\n\t};\n\n\ttopRive.riveInstance = new rive.Rive(options);\n});\n\nonUnmounted(() => {\n\ttopRive.riveInstance?.cleanup();\n});\n\ndefineExpose(topRive);\n</script>\n\n<template>\n\t<canvas ref=\"el\" class=\"top-rive\"></canvas>\n</template>\n\n<style>\n.top-rive {\n\twidth: 100%;\n\theight: 100%;\n\tflex-grow: 1;\n}\n</style>\n"],"names":["TopRive","rive","el","vue","canvas","_a","topRive","props","e","_b"],"mappings":"uZAIO,MAAAA,mjBCCP,IAAAC,YAMAC,EAAAC,EAAA,IAAA,KAEgB,aAAA,wHAOf,MAAAC,EAAAF,EAAA,oBAGAG,EAAAC,EAAA,eAAA,MAAAD,EAAA,mBAEgC,GAAAE,EAC5B,OAAAH,EACH,OAAAI,GAAA,UAECH,EAAAE,EAAA,SAAA,MAAAF,EAAA,KAAAE,EAAAC,IAEAC,EAAAH,EAAA,eAAA,MAAAG,EAAA,8BAAmD,+BAIT,CAAA,4BAI5CJ,EAAAC,EAAA,eAAA,MAAAD,EAAA,SAA8B,CAAA"}
|
package/extra/extra.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Core as v } from "../core/app.js";
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import "@rive-app/canvas-lite";
|
|
2
|
+
import { defineComponent as f, ref as m, watch as y, onUnmounted as B, createElementBlock as C, openBlock as L } from "vue";
|
|
4
3
|
const d = ["../assets/extra.css"].map((a) => import.meta.resolve(a));
|
|
5
4
|
v.insertCSSLinkToPage(d, !0);
|
|
6
|
-
const S = /* @__PURE__ */
|
|
5
|
+
const S = /* @__PURE__ */ f({
|
|
7
6
|
__name: "rive",
|
|
8
7
|
props: {
|
|
9
8
|
src: {},
|
|
@@ -38,35 +37,35 @@ const S = /* @__PURE__ */ m({
|
|
|
38
37
|
},
|
|
39
38
|
setup(a, { expose: p }) {
|
|
40
39
|
let t;
|
|
41
|
-
const o = a,
|
|
40
|
+
const o = a, s = m(), n = {
|
|
42
41
|
riveInstance: void 0
|
|
43
42
|
};
|
|
44
|
-
return y([
|
|
45
|
-
var
|
|
43
|
+
return y([s, o], async () => {
|
|
44
|
+
var l;
|
|
46
45
|
t || (t = await import("@rive-app/canvas-lite"));
|
|
47
|
-
const e =
|
|
46
|
+
const e = s.value;
|
|
48
47
|
if (!e) return;
|
|
49
|
-
(
|
|
50
|
-
const
|
|
48
|
+
(l = n.riveInstance) == null || l.cleanup();
|
|
49
|
+
const r = {
|
|
51
50
|
...o,
|
|
52
51
|
canvas: e,
|
|
53
52
|
onLoad: (u) => {
|
|
54
|
-
var
|
|
55
|
-
(
|
|
53
|
+
var i, c;
|
|
54
|
+
(i = o.onLoad) == null || i.call(o, u), (c = n.riveInstance) == null || c.resizeDrawingSurfaceToCanvas();
|
|
56
55
|
}
|
|
57
56
|
};
|
|
58
|
-
n.riveInstance = new t.Rive(
|
|
57
|
+
n.riveInstance = new t.Rive(r);
|
|
59
58
|
}), B(() => {
|
|
60
59
|
var e;
|
|
61
60
|
(e = n.riveInstance) == null || e.cleanup();
|
|
62
|
-
}), p(n), (e,
|
|
61
|
+
}), p(n), (e, r) => (L(), C("canvas", {
|
|
63
62
|
ref_key: "el",
|
|
64
|
-
ref:
|
|
63
|
+
ref: s,
|
|
65
64
|
class: "top-rive"
|
|
66
65
|
}, null, 512));
|
|
67
66
|
}
|
|
68
|
-
}),
|
|
67
|
+
}), R = S;
|
|
69
68
|
export {
|
|
70
|
-
|
|
69
|
+
R as TopRive
|
|
71
70
|
};
|
|
72
71
|
//# sourceMappingURL=extra.js.map
|
package/extra/extra.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extra.js","sources":["../../src/components/extra/rive/rive.vue","../../src/components/extra/extra.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport {
|
|
1
|
+
{"version":3,"file":"extra.js","sources":["../../src/components/extra/rive/rive.vue","../../src/components/extra/extra.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport { onUnmounted, ref, watch } from 'vue';\nimport type { Rive, RiveParameters } from '@rive-app/canvas-lite';\nimport type { Props } from './types';\n\nlet rive: typeof import('@rive-app/canvas-lite');\n\nconst props = withDefaults(defineProps<Props>(), {\n\tautoplay: true,\n});\n\nconst el = ref<HTMLCanvasElement>();\n\nconst topRive = {\n\triveInstance: undefined as Rive | undefined,\n};\n\nwatch([el, props], async () => {\n\tif (!rive) rive = await import('@rive-app/canvas-lite');\n\n\tconst canvas = el.value;\n\tif (!canvas) return;\n\n\ttopRive.riveInstance?.cleanup();\n\n\tconst options: RiveParameters = {\n\t\t...props,\n\t\tcanvas,\n\t\tonLoad: (e) => {\n\t\t\tprops.onLoad?.(e);\n\n\t\t\ttopRive.riveInstance?.resizeDrawingSurfaceToCanvas();\n\t\t},\n\t};\n\n\ttopRive.riveInstance = new rive.Rive(options);\n});\n\nonUnmounted(() => {\n\ttopRive.riveInstance?.cleanup();\n});\n\ndefineExpose(topRive);\n</script>\n\n<template>\n\t<canvas ref=\"el\" class=\"top-rive\"></canvas>\n</template>\n\n<style>\n.top-rive {\n\twidth: 100%;\n\theight: 100%;\n\tflex-grow: 1;\n}\n</style>\n","import type { ComponentCustomProps } from 'vue';\n\nimport Rive from './rive/rive.vue';\n\nexport const TopRive = Rive as typeof Rive & ComponentCustomProps;\n"],"names":["rive","props","__props","el","ref","topRive","watch","canvas","_a","options","e","_b","onUnmounted","__expose","TopRive","_sfc_main"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,QAAAA;AAEA,UAAAC,IAAAC,GAIAC,IAAAC,EAAA,GAEAC,IAAA;AAAA,MAAgB,cAAA;AAAA,IACD;AAGf,WAAAC,EAAA,CAAAH,GAAAF,CAAA,GAAA,YAAA;;AACC,MAAAD,MAAAA,IAAA,MAAA,OAAA,uBAAA;AAEA,YAAAO,IAAAJ,EAAA;AACA,UAAA,CAAAI,EAAA;AAEA,OAAAC,IAAAH,EAAA,iBAAA,QAAAG,EAAA;AAEA,YAAAC,IAAA;AAAA,QAAgC,GAAAR;AAAA,QAC5B,QAAAM;AAAA,QACH,QAAA,CAAAG,MAAA;;AAEC,WAAAF,IAAAP,EAAA,WAAA,QAAAO,EAAA,KAAAP,GAAAS,KAEAC,IAAAN,EAAA,iBAAA,QAAAM,EAAA;AAAA,QAAmD;AAAA,MACpD;AAGD,MAAAN,EAAA,eAAA,IAAAL,EAAA,KAAAS,CAAA;AAAA,IAA4C,CAAA,GAG7CG,EAAA,MAAA;;AACC,OAAAJ,IAAAH,EAAA,iBAAA,QAAAG,EAAA;AAAA,IAA8B,CAAA,GAG/BK,EAAAR,CAAA;;;;;;ICtCOS,IAAAC;"}
|
package/forms/forms.amd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
define(["require","exports","../.chunks/forms-
|
|
1
|
+
define(["require","exports","../.chunks/forms-BvGGRIzu.amd"],function(o,T,e){"use strict";if(typeof a>"u")var a=window.Vue;T.TopAvatar=e.TopAvatar,T.TopButton=e.TopButton,T.TopCheckbox=e.TopCheckbox,T.TopControlLabel=e.TopControlLabel,T.TopHint=e.TopHint,T.TopInput=e.TopInput,T.TopInputDate=e.TopInputDate,T.TopInputRange=e.TopInputRange,T.TopLoadbar=e.TopLoadbar,T.TopPreloader=e.TopPreloader,T.TopRadio=e.TopRadio,T.TopSelect=e.TopSelect,T.TopSwitcher=e.TopSwitcher,T.TopTextarea=e.TopTextarea,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})});
|
|
2
2
|
//# sourceMappingURL=forms.amd.js.map
|
package/forms/forms.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { T as p, g as T, h as s, j as t, k as e, l as
|
|
1
|
+
import { T as p, g as T, h as s, j as t, k as e, l as r, m as n, n as l, o as u, x, p as b, q as c, r as d, s as h } from "../.chunks/forms-DvSi_Mh8.es.js";
|
|
2
2
|
export {
|
|
3
3
|
p as TopAvatar,
|
|
4
4
|
T as TopButton,
|
|
5
5
|
s as TopCheckbox,
|
|
6
6
|
t as TopControlLabel,
|
|
7
7
|
e as TopHint,
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
r as TopInput,
|
|
9
|
+
n as TopInputDate,
|
|
10
10
|
l as TopInputRange,
|
|
11
11
|
u as TopLoadbar,
|
|
12
|
+
x as TopPreloader,
|
|
12
13
|
b as TopRadio,
|
|
13
14
|
c as TopSelect,
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
d as TopSwitcher,
|
|
16
|
+
h as TopTextarea
|
|
16
17
|
};
|
|
17
18
|
//# sourceMappingURL=forms.js.map
|
package/forms/helpers.amd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
define(
|
|
1
|
+
define(function(){"use strict";if(typeof e>"u")var e=window.Vue});
|
|
2
2
|
//# sourceMappingURL=helpers.amd.js.map
|
package/forms/helpers.amd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.amd.js","sources":[
|
|
1
|
+
{"version":3,"file":"helpers.amd.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/forms/helpers.d.ts
CHANGED
package/forms/helpers.js
CHANGED
package/forms/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sources":[
|
|
1
|
+
{"version":3,"file":"helpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/formsExt/formsExt.amd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
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(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-BvGGRIzu.amd","../utils/keyboard.amd","../popup/popup.amd","../.chunks/menu.vue_vue_type_style_index_0_lang-DdTdt1qa.amd","../require/css.amd!../assets/formsExt.css"],function(ae,g,e,B,S,V,A){"use strict";if(typeof e>"u")var e=window.Vue;const $={class:"top-editArea_footer"},N=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:l}){const t=i,n=l,d=e.ref(t.defaultValue),a=e.ref(t.isFocused),m=e.computed(()=>d.value!==t.defaultValue),p=s=>{n("submit",s),d.value=t.defaultValue},v=()=>{if(t.forceShowCloseBtn&&!m.value){n("close");return}d.value=t.defaultValue},h=()=>{t.attachToKeyboard&&n("clickOnTitle")};return(s,y)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"top-editArea":!0,"top-editArea-attachedToKeyboard":s.attachToKeyboard})},[s.title?(e.openBlock(),e.createElementBlock("div",{key:0,class:"top-editArea_title",onClick:y[0]||(y[0]=u=>h())},e.toDisplayString(s.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass({"top-editArea_form":!0,"top-error":s.isError,"top-focus":a.value})},[e.createVNode(B._sfc_main$3,{modelValue:d.value,"onUpdate:modelValue":y[1]||(y[1]=u=>d.value=u),name:s.name,placeholder:s.placeholder,rows:s.rows,minHeight:s.minHeight,expandable:s.expandable,disabled:s.disabled,readonly:s.readonly,isError:s.isError,hint:s.hint,class:"top-editArea_element",onFocus:y[2]||(y[2]=()=>a.value=!0),onBlur:y[3]||(y[3]=()=>a.value=!1),onKeyup:[e.withKeys(v,["esc"]),y[4]||(y[4]=e.withKeys(e.withModifiers(u=>p(d.value),["ctrl"]),["enter"]))]},null,8,["modelValue","name","placeholder","rows","minHeight","expandable","disabled","readonly","isError","hint"]),e.createElementVNode("div",$,[m.value||s.forceShowCloseBtn?(e.openBlock(),e.createBlock(B._sfc_main,{key:0,icon:s.$core.state.isMobile?"":"",class:"top-editArea_button",color:"theme",styling:"soft",onClick:v},e.createSlots({_:2},[s.$core.state.isMobile?void 0:{name:"default",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(s.cancelText),1)]),key:"0"}]),1032,["icon"])):e.createCommentVNode("",!0),m.value?(e.openBlock(),e.createBlock(B._sfc_main,{key:1,class:"top-editArea_button",icon:s.$core.state.isMobile?"":"",onClick:y[5]||(y[5]=u=>p(d.value))},e.createSlots({_:2},[s.$core.state.isMobile?void 0:{name:"default",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(s.submitText),1)]),key:"0"}]),1032,["icon"])):e.createCommentVNode("",!0)])],2)],2))}}),I={class:"top-editInput"},M=e.defineComponent({__name:"editInput",props:{modelValue:{},input:{},button:{}},emits:["update:modelValue"],setup(i,{emit:l}){const t=i,n=e.ref(t.modelValue);e.watch(e.toRef(t.modelValue),()=>{n.value=t.modelValue});const d=l,a=()=>{d("update:modelValue",n.value)};return(m,p)=>(e.openBlock(),e.createElementBlock("div",I,[e.createVNode(B._sfc_main$2,e.mergeProps(m.input,{onKeydownCapture:p[0]||(p[0]=e.withKeys(e.withModifiers(v=>n.value=m.modelValue,["stop"]),["esc"])),onKeydown:e.withKeys(e.withModifiers(a,["stop"]),["enter"]),modelValue:n.value,"onUpdate:modelValue":p[1]||(p[1]=v=>n.value=v)}),null,16,["onKeydown","modelValue"]),n.value!==m.modelValue?(e.openBlock(),e.createBlock(B._sfc_main,e.mergeProps({key:0,icon:"",styling:"soft"},m.button,{onClick:a}),null,16)):e.createCommentVNode("",!0)]))}}),L=["data-top-icon","onClick"],z={key:0,class:"top-radioGroup_circle"},_=["value","disabled"],P=e.defineComponent({__name:"radioGroup",props:e.mergeModels({modelValue:{},radiosProps:{},showIndicator:{type:Boolean},size:{default:"s"},isError:{type:Boolean}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(i){const l=e.useModel(i,"modelValue"),t=i,n=e.ref(null);e.watch(l,()=>{var a,m,p,v,h;(a=t.radiosProps)!=null&&a.some(s=>s.value===l.value)||(l.value=((p=(m=t.radiosProps)==null?void 0:m[0])==null?void 0:p.value)??""),(h=(v=n.value)==null?void 0:v.querySelector(".radioGroup_item-selected"))==null||h.scrollIntoView()},{immediate:!0});const d="radioGroup-"+Math.random();return(a,m)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"elRef",ref:n,class:e.normalizeClass({"top-radioGroup":!0,"top-scrollBarXHidding":!0,["top-size_"+a.size]:!!a.size,"top-error":a.isError})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.radiosProps,p=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass({"top-radioGroup_item-selected":p.value===l.value,"top-radioGroup_item":!0,"top-forms-focusable":!0,"top-disabled":p.disabled}),"data-top-icon":p.icon,onClick:v=>l.value=p.value},[e.createTextVNode(e.toDisplayString(p.title)+" ",1),a.showIndicator?(e.openBlock(),e.createElementBlock("span",z)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":m[0]||(m[0]=v=>l.value=v),name:d,type:"radio",class:e.normalizeClass({"top-unvisible":!0}),value:p.value,disabled:p.disabled},null,8,_),[[e.vModelRadio,l.value]])],10,L))),256))],2))}}),K=["data-top-icon"],D=["value","checked","disabled","onChange"],G=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(i){const l=e.useModel(i,"modelValue"),t=n=>{const d=[...l.value],a=d.indexOf(n);a===-1?d.push(n):d.splice(a,1),l.value=d};return(n,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"top-checkboxGroup":!0,["top-checkboxGroup-"+n.styling]:!0,"top-scrollBarXHidding":!0,["top-size_"+n.size]:!!n.size,"top-error":n.isError})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.items,a=>(e.openBlock(),e.createElementBlock("label",{key:a.id,class:e.normalizeClass({"top-checkboxGroup_item":!0,"top-checkboxGroup_item-selected":l.value.includes(a.id),"top-forms-focusable":!0,"top-disabled":a.disabled}),"data-top-icon":a.icon},[e.createElementVNode("input",{type:"checkbox",class:"top-unvisible",value:a.id,checked:l.value.includes(a.id),disabled:a.disabled,onChange:m=>t(a.id)},null,40,D),e.createTextVNode(" "+e.toDisplayString(a.title),1)],10,K))),128))],2))}}),O=(i,l,t)=>{const n=e.ref([]),d=e.ref(!1);let a="",m;i&&!i.params.limit&&(i.params.limit=100);const p=async()=>{if(!i)return;let u,C;if(t&&(i.cache??=new Map,C=JSON.stringify(i.params),u=i.cache.get(C),u))return u;if(d.value=!0,u=await i.call(),d.value=!1,u.errors)return;if(!Array.isArray(u.result)){console.warn("В result ожидался массив");return}const b=u.result.findIndex(w=>w.id===void 0||w.name===void 0);if(b!==-1){console.warn(`В result[${b}] нет id или name`);return}return t&&i.cache.set(C,u),u},v=async()=>{if(!i)return;i.params.offset=0,i.params.search=a;const u=await p();u&&(m=u.nextOffset,n.value=u.result)},h=async()=>{if(!i||!m||d.value)return;i.params.offset=m,i.params.search=a;const u=await p();u&&(m=u.nextOffset,n.value=n.value.concat(u.result))},s=B.debounce(()=>v(),200);return{items:n,isLoading:d,loadAppend:h,setSearchTextAndLoad:(u,C=!0)=>{i&&(u.length<l||u===a&&n.value.length||(a=u,C?s():v()))}}},F={class:"top-selector2_itemMulti top-ellipsis"},H=e.defineComponent({__name:"itemMulti",props:{id:{},name:{}},emits:["delete"],setup(i){return(l,t)=>(e.openBlock(),e.createElementBlock("div",F,[e.createTextVNode(e.toDisplayString(l.name)+" ",1),e.createElementVNode("span",{class:"top-selector2_itemMultiDelete","data-top-icon":"",onClick:t[0]||(t[0]=n=>l.$emit("delete",l.id)),onMousedown:t[1]||(t[1]=e.withModifiers(()=>{},["stop"]))},null,32)]))}}),R={key:0,class:"top-selector2_activeItems"},U={key:1,class:"top-selector2_activeName top-ellipsis"},W=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 l=i,t=e.useModel(i,"modelValue"),n=e.ref(""),d=()=>{n.value="",h.items.value=[]},a={id:0,name:B.useI18n().Common.All},m=e.ref(null),p=e.ref(null),v=()=>{var o;return(o=m.value)==null?void 0:o.popup};window.__STORYBOOK_PREVIEW__&&!l.modelValue&&e.watch(()=>l.multiselect,()=>{t.value=l.multiselect?[]:{id:null,name:""}},{immediate:!0});const h=O(l.apiRequest,l.minLength,l.useCache),s=e.computed(()=>{const o=[];return!l.multiselect&&l.appendAllValue&&o.push(a),l.items.forEach(r=>o.push({...r})),o}),y=(o,r=!0)=>r&&o.id===null?Array.isArray(t.value)?t.value.some(f=>f.id===o.id&&f.name===o.name):o.name===t.value.name:Array.isArray(t.value)?t.value.some(f=>f.id===o.id):o.id===t.value.id,u=e.computed(()=>{const o=n.value.toLowerCase(),r=S.invertKeyboardLayout(o);let f=[];return s.value.forEach(c=>{const k=c.name.toLowerCase();(c.id===Number(o)||k.includes(o)||k.includes(r))&&(k===o||k===r?f.unshift(c):f.push(c))}),f.push(...h.items.value),l.appendSearchToResult&&n.value&&(!f.length||f[0].name.toLowerCase()!==o)&&f.push({id:null,name:n.value}),l.multiselect&&(f=f.filter(c=>!y(c))),f}),C=async o=>{if(l.multiselect){if(!Array.isArray(t.value)||y(o))return;const r=[...t.value];r.push({...o}),t.value=r,B.Core.state.isMobile||setTimeout(()=>{var f,c,k,E;(f=v())==null||f.recalcPosition(),(E=(k=(c=v())==null?void 0:c.elPopupWidget)==null?void 0:k.querySelector("input"))==null||E.focus(),n.value&&d()})}else JSON.stringify(o)!==JSON.stringify(t.value)&&(t.value={...o})},b=()=>{if(!Array.isArray(t.value)){const r=(s.value.findIndex(f=>f.id===t.value.id)+1)%s.value.length;t.value={...s.value[r]}}},w=async o=>{Array.isArray(t.value)&&(t.value=t.value.filter(r=>r.id!==o),setTimeout(()=>{var r;(r=v())==null||r.recalcPosition()}))},T=e.ref(!1);l.apiRequest&&(e.watch(T,()=>{T.value&&h.setSearchTextAndLoad(n.value,!1)}),e.watch(n,()=>h.setSearchTextAndLoad(n.value)));const le=o=>{const r=o.target;r.scrollTop/(r.scrollHeight-r.offsetHeight)>.8&&h.loadAppend()},ne=()=>{var o;T.value=!1,(o=p.value)==null||o.focus(),n.value&&d()};return(o,r)=>{const f=e.resolveDirective("top-focus");return e.openBlock(),e.createBlock(e.unref(V.TopPopup),{ref_key:"popupRef",ref:m,onOpen:r[3]||(r[3]=c=>T.value=!0),onClose:r[4]||(r[4]=c=>ne()),onScrollContentList:r[5]||(r[5]=c=>o.apiRequest?le(c):void 0),notch:!1,transitionDuration:0},e.createSlots({opener:e.withCtx(()=>[e.withDirectives((e.openBlock(),e.createElementBlock("div",{ref_key:"elRef",ref:p,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:[r[0]||(r[0]=e.withKeys(e.withModifiers(c=>c.currentTarget.click(),["stop","prevent"]),["up","down","enter","space"])),r[1]||(r[1]=e.withKeys(c=>t.value=[],["delete"]))],tabindex:"0"},[o.multiselect?(e.openBlock(),e.createElementBlock("div",R,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.value,c=>(e.openBlock(),e.createBlock(H,{id:c.id,name:c.name,onDelete:w},null,8,["id","name"]))),256))])):e.createCommentVNode("",!0),o.multiselect?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",U,e.toDisplayString(Array.isArray(t.value)?"":t.value.name),1)),o.addChanger&&!o.multiselect&&s.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)),[[f,o.isError,void 0,{onupdate:!0}]])]),contentList:e.withCtx(()=>{var c;return[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,k=>(e.openBlock(),e.createBlock(e.unref(V.TopPopupListItem),{class:e.normalizeClass({"top-active":!Array.isArray(t.value)&&!o.multiselect&&t.value.name===k.name}),key:k.id??void 0,closeByClick:!o.multiselect||e.unref(B.Core).state.isMobile,onClick:E=>C(k)},{default:e.withCtx(()=>[o.$slots.item?e.renderSlot(o.$slots,"item",{key:0,item:k}):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(k.name),1)],64))]),_:2},1032,["class","closeByClick","onClick"]))),128)),!e.unref(h).isLoading.value&&!u.value.length?(e.openBlock(),e.createBlock(e.unref(V.TopPopupListItem),{key:0,type:"regular"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.$i18n.Common.No_results),1)]),_:1})):e.createCommentVNode("",!0),e.unref(h).isLoading.value&&(!o.showSearch||(c=o.apiRequest)!=null&&c.params.offset)?(e.openBlock(),e.createBlock(e.unref(V.TopPopupListItem),{key:1,type:"regular"},{default:e.withCtx(()=>[e.createVNode(e.unref(B.TopPreloader),{type:"circles"})]),_:1})):e.createCommentVNode("",!0)]}),_:2},[o.showSearch?{name:"widget",fn:e.withCtx(()=>{var c;return[e.createVNode(e.unref(V.TopPopupWidgetInput),{title:"Поиск",icon:"",modelValue:n.value,"onUpdate:modelValue":r[2]||(r[2]=k=>n.value=k),isLoading:e.unref(h).isLoading.value&&!((c=o.apiRequest)!=null&&c.params.offset),placeholder:!Array.isArray(t.value)&&!o.multiselect&&o.showSelectedInInput?t.value.name:o.placeholder},null,8,["modelValue","isLoading","placeholder"])]}),key:"0"}:void 0]),1536)}}}),J=["data-top-icon"],X={class:"top-info_text"},j={key:0,class:"top-info_value"},Y=e.defineComponent({__name:"info",props:{icon:{},styling:{default:"default"},size:{default:"default"}},setup(i){return(l,t)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"top-info":!0,["top-size_"+l.size]:!0,["top-info-styling_"+l.styling]:!0}),"data-top-icon":l.icon},[e.createElementVNode("div",X,[e.renderSlot(l.$slots,"default")]),l.$slots.additional?(e.openBlock(),e.createElementBlock("span",j,[e.renderSlot(l.$slots,"additional")])):e.createCommentVNode("",!0)],10,J))}}),Q=N,Z=M,q=P,x=G,ee=W,oe=A._sfc_main,te=Y;g.TopCheckboxGroup=x,g.TopEditArea=Q,g.TopEditInput=Z,g.TopInfo=te,g.TopMenu=oe,g.TopRadioGroup=q,g.TopSelector2=ee,Object.defineProperty(g,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.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 } from './radioGroup';\n\nconst model = defineModel<Props['modelValue']>({\n\trequired: true,\n});\n\nconst props = withDefaults(defineProps<Props>(), {\n\tsize: 's',\n});\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: Props['modelValue'][number]) => {\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\tvoid loadDebounce();\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 { TopPreloader } from '@/components/forms/forms';\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\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 * Управляет закрытием окна\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\tconst newModel = [...model.value];\n\t\tnewModel.push({ ...item });\n\t\tmodel.value = newModel;\n\n\t\tif (!Core.state.isMobile) {\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\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=\"API.isLoading.value && !apiRequest?.params.offset\"\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:closeByClick=\"!multiselect || Core.state.isMobile\"\n\t\t\t\t@click=\"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=\"!API.isLoading.value && !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\n\t\t\t<!-- Индикатор загрузки, первичная дозагрузка отображается в поле поиска, если оно отображено -->\n\t\t\t<TopPopupListItem\n\t\t\t\tv-if=\"API.isLoading.value && (!showSearch || apiRequest?.params.offset)\"\n\t\t\t\ttype=\"regular\"\n\t\t\t>\n\t\t\t\t<TopPreloader type=\"circles\"/>\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","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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"}
|