@topvisor/ui 1.0.18-ux-5 → 1.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.chunks/{datepicker-C-QFv8Wm.es.js → datepicker-B8O5mg_G.es.js} +2 -2
- package/.chunks/{datepicker-C-QFv8Wm.es.js.map → datepicker-B8O5mg_G.es.js.map} +1 -1
- package/.chunks/{datepicker-QG5NqyHa.amd.js → datepicker-CFiizYlZ.amd.js} +2 -2
- package/.chunks/{datepicker-QG5NqyHa.amd.js.map → datepicker-CFiizYlZ.amd.js.map} +1 -1
- package/.chunks/{utils-BBVRN-KU.amd.js → dialogs.vue_vue_type_script_setup_true_lang-B55gllXV.amd.js} +2 -2
- package/.chunks/dialogs.vue_vue_type_script_setup_true_lang-B55gllXV.amd.js.map +1 -0
- package/.chunks/dialogs.vue_vue_type_script_setup_true_lang-BkBYW0yR.es.js +266 -0
- package/.chunks/dialogs.vue_vue_type_script_setup_true_lang-BkBYW0yR.es.js.map +1 -0
- package/.chunks/forms-BWc2kMFD.amd.js +3 -0
- package/.chunks/forms-BWc2kMFD.amd.js.map +1 -0
- package/.chunks/{forms-BeCSWhdZ.es.js → forms-DW_XLzg8.es.js} +264 -241
- package/.chunks/forms-DW_XLzg8.es.js.map +1 -0
- package/.chunks/{listItem.vue_vue_type_script_setup_true_lang-BC88J71B.amd.js → listItem.vue_vue_type_script_setup_true_lang-naMiJruI.amd.js} +2 -2
- package/.chunks/{listItem.vue_vue_type_script_setup_true_lang-BC88J71B.amd.js.map → listItem.vue_vue_type_script_setup_true_lang-naMiJruI.amd.js.map} +1 -1
- package/.chunks/{listItem.vue_vue_type_script_setup_true_lang-DN-pHrhc.es.js → listItem.vue_vue_type_script_setup_true_lang-saYIC17M.es.js} +2 -2
- package/.chunks/{listItem.vue_vue_type_script_setup_true_lang-DN-pHrhc.es.js.map → listItem.vue_vue_type_script_setup_true_lang-saYIC17M.es.js.map} +1 -1
- package/.chunks/{menu.vue_vue_type_style_index_0_lang-RE6Dl4Gd.amd.js → menu.vue_vue_type_style_index_0_lang-06YUloqb.amd.js} +2 -2
- package/.chunks/{menu.vue_vue_type_style_index_0_lang-RE6Dl4Gd.amd.js.map → menu.vue_vue_type_style_index_0_lang-06YUloqb.amd.js.map} +1 -1
- package/.chunks/{menu.vue_vue_type_style_index_0_lang-BNzX8C8v.es.js → menu.vue_vue_type_style_index_0_lang-CcspstQc.es.js} +2 -2
- package/.chunks/{menu.vue_vue_type_style_index_0_lang-BNzX8C8v.es.js.map → menu.vue_vue_type_style_index_0_lang-CcspstQc.es.js.map} +1 -1
- package/.chunks/{notice-zqNsNusv.es.js → notice-BQyuy4nF.es.js} +2 -2
- package/.chunks/{notice-zqNsNusv.es.js.map → notice-BQyuy4nF.es.js.map} +1 -1
- package/.chunks/{notice-D41sY-7B.amd.js → notice-zADfJ5TR.amd.js} +2 -2
- package/.chunks/{notice-D41sY-7B.amd.js.map → notice-zADfJ5TR.amd.js.map} +1 -1
- package/.chunks/{popup-CnEewIWQ.amd.js → popup-CPS-7fSX.amd.js} +2 -2
- package/.chunks/popup-CPS-7fSX.amd.js.map +1 -0
- package/.chunks/{popup-CYjUUTBV.es.js → popup-DsVptZvL.es.js} +6 -7
- package/.chunks/popup-DsVptZvL.es.js.map +1 -0
- package/.chunks/utils-B75aamxF.amd.js +2 -0
- package/.chunks/utils-B75aamxF.amd.js.map +1 -0
- package/.chunks/utils-DIP-BdDy.es.js +225 -0
- package/.chunks/utils-DIP-BdDy.es.js.map +1 -0
- package/.chunks/utils-DfYj3r9i.amd.js +2 -0
- package/.chunks/utils-DfYj3r9i.amd.js.map +1 -0
- package/.chunks/utils-h5v4GPgp.es.js +79 -0
- package/.chunks/utils-h5v4GPgp.es.js.map +1 -0
- package/assets/charts.css +1 -1
- package/assets/core.css +1 -1
- package/assets/formsExt.css +1 -1
- package/assets/notice.css +1 -1
- package/charts/charts.amd.js +1 -1
- package/charts/charts.js +1 -1
- package/components/dialog/dialog/dialog.vue.d.ts +1 -1
- package/components/dialog/dialog/page/types.d.ts +7 -0
- package/components/popup/lib/popup.d.ts +2 -3
- package/components/popup/lib/worker.d.ts +7 -7
- package/components/project/selectorRegion/utils/consts.d.ts +0 -2
- package/components/project/tagSelector/tagSelector.vue.d.ts +2 -2
- package/core/app.amd.js +1 -1
- package/core/app.amd.js.map +1 -1
- package/core/app.js +5 -5
- package/core/core/core.d.ts +2 -0
- package/core/core/preloaders.d.ts +19 -0
- package/core/plugins/i18n.d.ts +13 -3
- package/core/utils/searchers.d.ts +0 -2
- package/dialog/dialog.amd.js +1 -1
- package/dialog/dialog.amd.js.map +1 -1
- package/dialog/dialog.js +61 -55
- package/dialog/dialog.js.map +1 -1
- package/forms/forms.amd.js +1 -1
- package/forms/forms.js +1 -1
- package/formsExt/formsExt.amd.js +1 -1
- package/formsExt/formsExt.amd.js.map +1 -1
- package/formsExt/formsExt.js +81 -78
- package/formsExt/formsExt.js.map +1 -1
- package/layout/layout.amd.js +1 -1
- package/layout/layout.amd.js.map +1 -1
- package/layout/layout.js +1 -1
- package/layout/layout.js.map +1 -1
- package/package.json +2 -1
- package/popup/popup.amd.js +1 -1
- package/popup/popup.js +2 -2
- package/popup/worker.amd.js +1 -1
- package/popup/worker.amd.js.map +1 -1
- package/popup/worker.js +3 -3
- package/popup/worker.js.map +1 -1
- package/project/project.amd.js +1 -1
- package/project/project.amd.js.map +1 -1
- package/project/project.js +19 -21
- package/project/project.js.map +1 -1
- package/tabsView/tabsView.amd.js +1 -1
- package/tabsView/tabsView.js +1 -1
- package/utils/clipboard.amd.js +1 -1
- package/utils/clipboard.js +1 -1
- package/utils/date.amd.js +1 -1
- package/utils/date.js +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.amd.js.map +1 -1
- package/utils/searchers.js +0 -2
- package/utils/searchers.js.map +1 -1
- package/utils/string.amd.js +1 -1
- package/utils/string.js +1 -1
- package/.chunks/forms-BeCSWhdZ.es.js.map +0 -1
- package/.chunks/forms-DYuU936i.amd.js +0 -3
- package/.chunks/forms-DYuU936i.amd.js.map +0 -1
- package/.chunks/popup-CYjUUTBV.es.js.map +0 -1
- package/.chunks/popup-CnEewIWQ.amd.js.map +0 -1
- package/.chunks/utils-BBVRN-KU.amd.js.map +0 -1
- package/.chunks/utils-ByeZ1FPX.amd.js +0 -2
- package/.chunks/utils-ByeZ1FPX.amd.js.map +0 -1
- package/.chunks/utils-Cbdb1gth.es.js +0 -223
- package/.chunks/utils-Cbdb1gth.es.js.map +0 -1
- package/.chunks/utils-DFkcW3nI.es.js +0 -338
- package/.chunks/utils-DFkcW3nI.es.js.map +0 -1
package/core/app.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { C as r, E as N, T as M, f as H, g as C, h as F, j as R, k as V, l as G, m as j, n as x, o as B, p as J, q as W, r as Y, s as q } from "../.chunks/forms-
|
|
2
|
-
import { v as Ut, a as It, u as Pt, t as At } from "../.chunks/forms-
|
|
1
|
+
import { C as r, E as N, T as M, f as H, g as C, h as F, j as R, k as V, l as G, m as j, n as x, o as B, p as J, q as W, r as Y, s as q } from "../.chunks/forms-DW_XLzg8.es.js";
|
|
2
|
+
import { v as Ut, a as It, u as Pt, t as At } from "../.chunks/forms-DW_XLzg8.es.js";
|
|
3
3
|
import { defineAsyncComponent as z, watch as k } from "vue";
|
|
4
4
|
import { TopPopupWorker as d } from "../popup/worker.js";
|
|
5
|
-
import { T as Q, _ as K } from "../.chunks/
|
|
6
|
-
import { a as Nt, b as Mt } from "../.chunks/utils-DFkcW3nI.es.js";
|
|
5
|
+
import { T as Q, _ as K } from "../.chunks/dialogs.vue_vue_type_script_setup_true_lang-BkBYW0yR.es.js";
|
|
7
6
|
import { isVisible as A } from "../utils/dom.js";
|
|
8
7
|
import { guestLinkToClipboard as X } from "../utils/clipboard.js";
|
|
9
8
|
import { camelToSnakeCase as Z } from "../utils/string.js";
|
|
10
9
|
import { getHash as tt, setHash as et } from "../utils/route.js";
|
|
10
|
+
import { a as Nt, b as Mt } from "../.chunks/utils-h5v4GPgp.es.js";
|
|
11
11
|
class ot {
|
|
12
12
|
static isInited = !1;
|
|
13
13
|
/**
|
|
@@ -184,7 +184,7 @@ const T = /* @__PURE__ */ new Map(), pt = (o, t) => {
|
|
|
184
184
|
var s;
|
|
185
185
|
(s = y(o)) == null || s.tooltip("destroy");
|
|
186
186
|
}
|
|
187
|
-
}, ht = z(() => import("../.chunks/notice-
|
|
187
|
+
}, ht = z(() => import("../.chunks/notice-BQyuy4nF.es.js"));
|
|
188
188
|
window.vd = console.log;
|
|
189
189
|
const yt = {
|
|
190
190
|
install: (o, t) => {
|
package/core/core/core.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { default as preloaders } from './preloaders';
|
|
1
2
|
import { Options as TopNoticeOptions } from '../../components/core/notice/utils';
|
|
2
3
|
import { Style as TopNoticeStyle } from '../../components/core/notice/item/types';
|
|
3
4
|
/**
|
|
@@ -20,6 +21,7 @@ export default class Core {
|
|
|
20
21
|
size: number;
|
|
21
22
|
isHidden: boolean;
|
|
22
23
|
};
|
|
24
|
+
static preloaders: typeof preloaders;
|
|
23
25
|
static widthForMobile: number;
|
|
24
26
|
static themeName: string;
|
|
25
27
|
static matchMediaIsMobile?: MediaQueryList;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Набор функцией, реализующих загрузку модулей системы, которые рекомендуется загружать в отложенном режиме
|
|
3
|
+
*
|
|
4
|
+
* Функции выполняют загрузку в память полный код модулей и компонентов
|
|
5
|
+
*/
|
|
6
|
+
export default class {
|
|
7
|
+
/**
|
|
8
|
+
* Загрузить в память полный функционал TopNotice
|
|
9
|
+
*/
|
|
10
|
+
static TopNotice(): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* Загрузить в память полный функционал TopPopup
|
|
13
|
+
*/
|
|
14
|
+
static TopPopup(): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Загрузить в память полный функционал TopDialog
|
|
17
|
+
*/
|
|
18
|
+
static TopDialog(): Promise<void>;
|
|
19
|
+
}
|
package/core/plugins/i18n.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Reactive, Ref, App } from 'vue';
|
|
1
|
+
import { ComponentCustomProperties, Reactive, Ref, App } from 'vue';
|
|
2
2
|
import { components as I18nComponents } from 'topvisor-openapi/src/ts/I18n';
|
|
3
3
|
export type Lang = 'ru' | 'en';
|
|
4
4
|
type Options = {
|
|
@@ -27,15 +27,19 @@ type Options = {
|
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
29
|
type I18n = Reactive<Options['i18n']>;
|
|
30
|
+
type i18nRender = <T extends keyof I18n>(categoryName: T, key: keyof I18n[T], props: Record<string, number | string>) => string;
|
|
30
31
|
type i18nSetLang = (lang: Lang, forceReload?: boolean) => void;
|
|
31
32
|
declare module 'vue' {
|
|
32
33
|
interface ComponentCustomProperties {
|
|
33
34
|
/**
|
|
34
35
|
* Загруженные словари
|
|
35
36
|
*
|
|
37
|
+
* Можно использовать как функцию для подстановки значений в формате: `Текст {{ propName }}`
|
|
38
|
+
*
|
|
36
39
|
* @see I18n
|
|
40
|
+
* @see i18nRender
|
|
37
41
|
*/
|
|
38
|
-
$i18n: I18n;
|
|
42
|
+
$i18n: I18n & i18nRender;
|
|
39
43
|
/**
|
|
40
44
|
* Текущий язык
|
|
41
45
|
*/
|
|
@@ -58,6 +62,7 @@ declare module 'vue' {
|
|
|
58
62
|
* - \$i18n
|
|
59
63
|
* - \$i18nLang
|
|
60
64
|
* - \$i18nSetLang
|
|
65
|
+
* - \$i18nL
|
|
61
66
|
*
|
|
62
67
|
* Для загрузки необходимого словаря указывайте его в зависимостях компонента:
|
|
63
68
|
*
|
|
@@ -76,6 +81,11 @@ declare module 'vue' {
|
|
|
76
81
|
* ```html
|
|
77
82
|
* {{ $i18n.Projects.Site }}
|
|
78
83
|
* ```
|
|
84
|
+
*
|
|
85
|
+
* С подстановкой значений:
|
|
86
|
+
* ```html
|
|
87
|
+
* {{ $i18n('Projects', 'Site', {name: value}) }}
|
|
88
|
+
* ```
|
|
79
89
|
*/
|
|
80
90
|
declare const _default: {
|
|
81
91
|
install: (app: App<any>, options: Options) => void;
|
|
@@ -86,7 +96,7 @@ export default _default;
|
|
|
86
96
|
*
|
|
87
97
|
* @see I18n
|
|
88
98
|
*/
|
|
89
|
-
export declare const useI18n: () =>
|
|
99
|
+
export declare const useI18n: () => ComponentCustomProperties["$i18n"];
|
|
90
100
|
/**
|
|
91
101
|
* Текущий язык
|
|
92
102
|
*/
|
package/dialog/dialog.amd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
define(["require","exports","vue","../.chunks/
|
|
1
|
+
define(["require","exports","vue","../.chunks/dialogs.vue_vue_type_script_setup_true_lang-B55gllXV.amd","../.chunks/forms-BWc2kMFD.amd","../.chunks/utils-DfYj3r9i.amd"],function(b,r,e,d,p,s){"use strict";if(typeof e>"u")var e=window.Vue;const u=["id","data-view-page-active","data-modal","data-position"],c=e.defineComponent({__name:"dialog",props:{id:{},pageActive:{},width:{default:"600px"},height:{default:"auto"},modal:{type:Boolean,default:!0},position:{},historyType:{default:"push"},classes:{}},emits:["open","close"],setup(i){const l=i,a=d.getDialogWorker(l.id);if(!a)throw new Error("TopDialog cannot be used in a template, use useTopDialog() / useAsyncTopDialog()");return e.provide("dialogWorker",a),e.onMounted(()=>{var n;const t=e.getCurrentInstance(),o=t.parent;if(((n=o==null?void 0:o.parent)==null?void 0:n.type.name)!=="DialogWrapper")throw new Error("TopDialog cannot be used in a template, use useTopDialog()");if(Array.isArray(o.subTree.children)&&o.subTree.children.length!==1)throw new Error("TopDialog can has only one root element");a.onMounted(o,t)}),e.watch(a.isOpened,()=>{a.isReady.value=!0},{flush:"post",once:!0}),(t,o)=>(e.openBlock(),e.createElementBlock("div",{id:e.unref(a).idAttr,class:e.normalizeClass(["top-dialog",t.classes]),style:e.normalizeStyle({"--top-dialog-width":t.width,"--top-dialog-height":t.height}),tabindex:"-1","data-view-page-active":e.unref(a).pageActive.value,"data-modal":t.modal,"data-position":t.position},[o[0]||(o[0]=e.createElementVNode("div",{class:"modal-layer modal-layer-header"},null,-1)),e.createElementVNode("div",{class:"modal-layer modal-layer-body",style:e.normalizeStyle({"min-height":t.height+"px"})},null,4),e.renderSlot(t.$slots,"default")],14,u))}}),m={key:0,style:{display:"none"}},g=["data-order","data-view-page"],v={class:"modal-header"},f={class:"top-title"},h={class:"buttons"},y=["title"],k=["title"],B=["data-order","data-view-page"],w={class:"modal-body"},C=e.defineComponent({__name:"page",props:{isLoading:{type:Boolean},name:{},order:{default:0},prevName:{},footerFullWith:{type:Boolean}},setup(i){const l=i,a=s.useTopDialogSelf(),t=e.computed(()=>{var o;return{active:((o=a.pageActive)==null?void 0:o.value)===l.name,"i-load-data":l.isLoading||a.isLoadingPage.value}});return(o,n)=>{const T=e.resolveDirective("top-scroll-shadow");return e.unref(a).isReady.value?(e.openBlock(),e.createElementBlock("div",m,[(e.openBlock(),e.createBlock(e.Teleport,{to:"#"+e.unref(a).idAttr+" .modal-layer-header",disabled:!e.unref(a).needShowPage(o.name)},[e.createElementVNode("div",{"data-order":o.order,"data-view-page":o.name,class:e.normalizeClass(t.value)},[e.createElementVNode("div",v,[e.createElementVNode("div",f,[e.renderSlot(o.$slots,"header")]),e.createElementVNode("div",h,[e.renderSlot(o.$slots,"headerButtons")]),e.unref(p.Core).state.isMobile&&o.prevName?(e.openBlock(),e.createElementBlock("div",{key:0,class:"close",title:o.$i18n.Common.Back,"data-top-icon":"",onClick:n[0]||(n[0]=D=>e.unref(a).open(o.prevName))},null,8,y)):(e.openBlock(),e.createElementBlock("div",{key:1,class:"close",title:o.$i18n.Common.Close,"data-top-icon":"","data-action":"top-dialog-close"},null,8,k))])],10,g)],8,["to","disabled"])),(e.openBlock(),e.createBlock(e.Teleport,{to:"#"+e.unref(a).idAttr+" .modal-layer-body",disabled:!e.unref(a).needShowPage(o.name)},[e.createElementVNode("div",{"data-order":o.order,"data-view-page":o.name,class:e.normalizeClass(["has_scroll_container",t.value]),style:e.normalizeStyle({"--top-dialog-footer-height":o.$slots.footer?void 0:"0px"})},[e.withDirectives((e.openBlock(),e.createElementBlock("div",w,[e.renderSlot(o.$slots,"body")])),[[T]]),o.$slots.footer?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["modal-footer",{"modal-footer-fullWith":o.footerFullWith}])},[e.renderSlot(o.$slots,"footer")],2)):e.createCommentVNode("",!0)],14,B)],8,["to","disabled"]))])):e.createCommentVNode("",!0)}}}),S={name:{type:String,required:!0},order:{type:Number,required:!0},prevName:String,footerFullWith:Boolean},N=e.defineComponent({__name:"pageComponent",props:{component:{},keepAlive:{type:Boolean,default:!0},props:{},name:{},order:{},prevName:{},footerFullWith:{type:Boolean}},setup(i){const l=i,a=s.useTopDialogSelf(),t=(o,n)=>{if(!n.value){if(o.name!=="AsyncComponentWrapper"){n.value=!0;return}a.needShowPage(l.name)&&(a.isLoadingPage.value=!0,o.__asyncResolved&&(n.value=!0,a.isLoadingPage.value=!1))}};if(l.component.name==="AsyncComponentWrapper"){const o=e.ref(!1);e.onUpdated(()=>{t(l.component,o)})}return(o,n)=>(e.openBlock(),e.createBlock(e.KeepAlive,{include:o.keepAlive?"":"none"},[e.unref(a).needShowPage(o.name)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.component),e.mergeProps({key:0},l,{name:o.name,order:o.order,prevName:o.prevName}),null,16,["name","order","prevName"])):e.createCommentVNode("",!0)],1032,["include"]))}});r.useTopDialogSelf=s.useTopDialogSelf,r.TopDialog=c,r.TopDialogPage=C,r.TopDialogPageComponent=N,r.propsPageCommon=S,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})});
|
|
2
2
|
//# sourceMappingURL=dialog.amd.js.map
|
package/dialog/dialog.amd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.amd.js","sources":["../../src/components/dialog/dialog/dialog.vue","../../src/components/dialog/dialog/page/page.vue","../../src/components/dialog/dialog/page/types.ts","../../src/components/dialog/dialog/pageComponent/pageComponent.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { ComponentInternalInstance } from 'vue';\nimport { getCurrentInstance, onMounted, provide, watch } from 'vue';\nimport { getDialogWorker } from './dialogs/dialogs.vue';\nimport type { Emits, Props, Slots } from './types';\n\nconst props = withDefaults(defineProps<Props>(), {\n\twidth: '600px',\n\theight: 'auto',\n\tmodal: true,\n\thistoryType: 'push',\n});\n\ndefineEmits<Emits>();\n\ndefineSlots<Slots>();\n\nconst dialog = getDialogWorker(props.id);\nif (!dialog) {\n\tthrow new Error('TopDialog cannot be used in a template, use useTopDialog() / useAsyncTopDialog()');\n}\n\n/**\n * Для useTopDialogSelf()\n */\nprovide('dialogWorker', dialog);\n\n/**\n * Инициализация начального состояния TopDialogHandle\n */\nonMounted(() => {\n\tconst topDialogBaseComponent = getCurrentInstance() as ComponentInternalInstance;\n\tconst topDialogComponent = topDialogBaseComponent.parent;\n\n\tif (topDialogComponent?.parent?.type.name !== 'DialogWrapper') {\n\t\tthrow new Error('TopDialog cannot be used in a template, use useTopDialog()');\n\t}\n\n\tif (Array.isArray(topDialogComponent.subTree.children) && topDialogComponent.subTree.children.length !== 1) {\n\t\tthrow new Error('TopDialog can has only one root element');\n\t}\n\n\tdialog.onMounted(topDialogComponent, topDialogBaseComponent);\n});\n\nwatch(dialog.isOpened, () => {\n\tdialog.isReady.value = true;\n}, {\n\tflush: 'post',\n\tonce: true,\n});\n</script>\n\n<template>\n\t<div\n\t\t:id=\"dialog.idAttr\"\n\t\tclass=\"top-dialog\"\n\t\t:class=\"classes\"\n\t\t:style=\"{\n\t\t\t\t'--top-dialog-width': width,\n\t\t\t\t'--top-dialog-height': height,\n\t\t\t}\"\n\t\ttabindex=\"-1\"\n\t\t:data-view-page-active=\"dialog.pageActive.value\"\n\t\t:data-modal=\"modal\"\n\t\t:data-position=\"position\"\n\t>\n\t\t<div class=\"modal-layer modal-layer-header\"></div>\n\n\t\t<div class=\"modal-layer modal-layer-body\" :style=\"{'min-height': height + 'px'}\"></div>\n\n\t\t<slot name=\"default\"></slot>\n\t</div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport Core from '@/core/core/core';\nimport { useTopDialogSelf } from '@/components/dialog/dialog/composables/utils';\nimport type { Props, Slots } from './types';\n\nconst props = withDefaults(defineProps<Props>(), {\n\torder: 0,\n});\n\ndefineSlots<Slots>();\n\nconst dialog = useTopDialogSelf();\n\nconst classes = computed(() => {\n\treturn {\n\t\tactive: dialog.pageActive?.value === props.name,\n\t\t'i-load-data': props.isLoading || dialog.isLoadingPage.value,\n\t};\n});\n</script>\n\n<template>\n\t<div\n\t\tstyle=\"display: none\"\n\t\tv-if=\"dialog.isReady.value\"\n\t>\n\t\t<Teleport :to=\"'#' + dialog.idAttr + ' .modal-layer-header'\" :disabled=\"!dialog.needShowPage(name)\">\n\t\t\t<div\n\t\t\t\t:data-order=\"order\"\n\t\t\t\t:data-view-page=\"name\"\n\t\t\t\t:class=\"classes\"\n\t\t\t>\n\t\t\t\t<div class=\"modal-header\">\n\t\t\t\t\t<div class=\"top-title\">\n\t\t\t\t\t\t<slot name=\"header\"></slot>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div class=\"buttons\">\n\t\t\t\t\t\t<slot name=\"headerButtons\"></slot>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div\n\t\t\t\t\t\tv-if=\"Core.state.isMobile && prevName\"\n\t\t\t\t\t\tclass=\"close\"\n\t\t\t\t\t\t:title=\"$i18n.Common.Back\"\n\t\t\t\t\t\tdata-top-icon=\"\"\n\t\t\t\t\t\t@click=\"dialog.open(prevName)\"\n\t\t\t\t\t></div>\n\n\t\t\t\t\t<div\n\t\t\t\t\t\tv-else\n\t\t\t\t\t\tclass=\"close\"\n\t\t\t\t\t\t:title=\"$i18n.Common.Close\"\n\t\t\t\t\t\tdata-top-icon=\"\"\n\t\t\t\t\t\tdata-action=\"top-dialog-close\"\n\t\t\t\t\t></div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</Teleport>\n\n\t\t<Teleport :to=\"'#' + dialog.idAttr + ' .modal-layer-body'\" :disabled=\"!dialog.needShowPage(name)\">\n\t\t\t<div\n\t\t\t\t:data-order=\"order\"\n\t\t\t\t:data-view-page=\"name\"\n\t\t\t\tclass=\"has_scroll_container\"\n\t\t\t\t:class=\"classes\"\n\t\t\t\t:style=\"{'--top-dialog-footer-height': $slots.footer ? undefined : '0px'}\"\n\t\t\t>\n\t\t\t\t<div class=\"modal-body\" v-top-scroll-shadow>\n\t\t\t\t\t<slot name=\"body\"></slot>\n\t\t\t\t</div>\n\n\t\t\t\t<div
|
|
1
|
+
{"version":3,"file":"dialog.amd.js","sources":["../../src/components/dialog/dialog/dialog.vue","../../src/components/dialog/dialog/page/page.vue","../../src/components/dialog/dialog/page/types.ts","../../src/components/dialog/dialog/pageComponent/pageComponent.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { ComponentInternalInstance } from 'vue';\nimport { getCurrentInstance, onMounted, provide, watch } from 'vue';\nimport { getDialogWorker } from './dialogs/dialogs.vue';\nimport type { Emits, Props, Slots } from './types';\n\nconst props = withDefaults(defineProps<Props>(), {\n\twidth: '600px',\n\theight: 'auto',\n\tmodal: true,\n\thistoryType: 'push',\n});\n\ndefineEmits<Emits>();\n\ndefineSlots<Slots>();\n\nconst dialog = getDialogWorker(props.id);\nif (!dialog) {\n\tthrow new Error('TopDialog cannot be used in a template, use useTopDialog() / useAsyncTopDialog()');\n}\n\n/**\n * Для useTopDialogSelf()\n */\nprovide('dialogWorker', dialog);\n\n/**\n * Инициализация начального состояния TopDialogHandle\n */\nonMounted(() => {\n\tconst topDialogBaseComponent = getCurrentInstance() as ComponentInternalInstance;\n\tconst topDialogComponent = topDialogBaseComponent.parent;\n\n\tif (topDialogComponent?.parent?.type.name !== 'DialogWrapper') {\n\t\tthrow new Error('TopDialog cannot be used in a template, use useTopDialog()');\n\t}\n\n\tif (Array.isArray(topDialogComponent.subTree.children) && topDialogComponent.subTree.children.length !== 1) {\n\t\tthrow new Error('TopDialog can has only one root element');\n\t}\n\n\tdialog.onMounted(topDialogComponent, topDialogBaseComponent);\n});\n\nwatch(dialog.isOpened, () => {\n\tdialog.isReady.value = true;\n}, {\n\tflush: 'post',\n\tonce: true,\n});\n</script>\n\n<template>\n\t<div\n\t\t:id=\"dialog.idAttr\"\n\t\tclass=\"top-dialog\"\n\t\t:class=\"classes\"\n\t\t:style=\"{\n\t\t\t\t'--top-dialog-width': width,\n\t\t\t\t'--top-dialog-height': height,\n\t\t\t}\"\n\t\ttabindex=\"-1\"\n\t\t:data-view-page-active=\"dialog.pageActive.value\"\n\t\t:data-modal=\"modal\"\n\t\t:data-position=\"position\"\n\t>\n\t\t<div class=\"modal-layer modal-layer-header\"></div>\n\n\t\t<div class=\"modal-layer modal-layer-body\" :style=\"{'min-height': height + 'px'}\"></div>\n\n\t\t<slot name=\"default\"></slot>\n\t</div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport Core from '@/core/core/core';\nimport { useTopDialogSelf } from '@/components/dialog/dialog/composables/utils';\nimport type { Props, Slots } from './types';\n\nconst props = withDefaults(defineProps<Props>(), {\n\torder: 0,\n});\n\ndefineSlots<Slots>();\n\nconst dialog = useTopDialogSelf();\n\nconst classes = computed(() => {\n\treturn {\n\t\tactive: dialog.pageActive?.value === props.name,\n\t\t'i-load-data': props.isLoading || dialog.isLoadingPage.value,\n\t};\n});\n</script>\n\n<template>\n\t<div\n\t\tstyle=\"display: none\"\n\t\tv-if=\"dialog.isReady.value\"\n\t>\n\t\t<Teleport :to=\"'#' + dialog.idAttr + ' .modal-layer-header'\" :disabled=\"!dialog.needShowPage(name)\">\n\t\t\t<div\n\t\t\t\t:data-order=\"order\"\n\t\t\t\t:data-view-page=\"name\"\n\t\t\t\t:class=\"classes\"\n\t\t\t>\n\t\t\t\t<div class=\"modal-header\">\n\t\t\t\t\t<div class=\"top-title\">\n\t\t\t\t\t\t<slot name=\"header\"></slot>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div class=\"buttons\">\n\t\t\t\t\t\t<slot name=\"headerButtons\"></slot>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div\n\t\t\t\t\t\tv-if=\"Core.state.isMobile && prevName\"\n\t\t\t\t\t\tclass=\"close\"\n\t\t\t\t\t\t:title=\"$i18n.Common.Back\"\n\t\t\t\t\t\tdata-top-icon=\"\"\n\t\t\t\t\t\t@click=\"dialog.open(prevName)\"\n\t\t\t\t\t></div>\n\n\t\t\t\t\t<div\n\t\t\t\t\t\tv-else\n\t\t\t\t\t\tclass=\"close\"\n\t\t\t\t\t\t:title=\"$i18n.Common.Close\"\n\t\t\t\t\t\tdata-top-icon=\"\"\n\t\t\t\t\t\tdata-action=\"top-dialog-close\"\n\t\t\t\t\t></div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</Teleport>\n\n\t\t<Teleport :to=\"'#' + dialog.idAttr + ' .modal-layer-body'\" :disabled=\"!dialog.needShowPage(name)\">\n\t\t\t<div\n\t\t\t\t:data-order=\"order\"\n\t\t\t\t:data-view-page=\"name\"\n\t\t\t\tclass=\"has_scroll_container\"\n\t\t\t\t:class=\"classes\"\n\t\t\t\t:style=\"{'--top-dialog-footer-height': $slots.footer ? undefined : '0px'}\"\n\t\t\t>\n\t\t\t\t<div class=\"modal-body\" v-top-scroll-shadow>\n\t\t\t\t\t<slot name=\"body\"></slot>\n\t\t\t\t</div>\n\n\t\t\t\t<div\n\t\t\t\t\tclass=\"modal-footer\"\n\t\t\t\t\t:class=\"{\n\t\t\t\t\t\t'modal-footer-fullWith': footerFullWith\n\t\t\t\t\t}\"\n\t\t\t\t\tv-if=\"$slots.footer\"\n\t\t\t\t>\n\t\t\t\t\t<slot name=\"footer\"></slot>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</Teleport>\n\t</div>\n</template>\n","export interface Props extends PropsCommon {\n\t/**\n\t * Статус загрузки страницы диалогового окна\n\t *\n\t * При включении взаимодействие со страницей блокируется, отображается анимация загрузки\n\t */\n\tisLoading?: boolean;\n}\n\n/**\n * Общие props для компонентов реализуюущих TopDialogPage\n */\nexport interface PropsCommon {\n\t/**\n\t * Имя страницы для диалогового окна\n\t *\n\t * Имя страницы нужно для навигации между страницами в одном диалоговом окне\n\t */\n\tname: string,\n\n\t/**\n\t * Порядкой номер страницы в диалоговом окне\n\t *\n\t * Одна и та же страница может быть подключена в разные диалоговые окна и иметь разный порядковый номер\n\t */\n\torder: number,\n\n\t/**\n\t * Имя предыдущей страницы\n\t *\n\t * Для кнопки Назад / Закрыть в мобильной версии\n\t */\n\tprevName?: string,\n\n\t/**\n\t * Стиль отображения футера, при котороым элементы растягиваются на всю ширину\n\t *\n\t * Разрешены переносы\n\t */\n\tfooterFullWith?: boolean,\n}\n\n/**\n * Общие props для компонентов реализуюущих TopDialogPage\n *\n * Для не SFC компонентов\n */\nexport const propsPageCommon = {\n\tname: {\n\t\ttype: String,\n\t\trequired: true,\n\t},\n\n\torder: {\n\t\ttype: Number,\n\t\trequired: true,\n\t},\n\n\tprevName: String,\n\n\tfooterFullWith: Boolean,\n};\n\nexport interface Slots {\n\t/**\n\t * Шапка страницы\n\t */\n\theader(props: {}): any;\n\n\t/**\n\t * Кнопки для шапки страницы\n\t */\n\theaderButtons(props: {}): any;\n\n\t/**\n\t * Контент страницы\n\t */\n\tbody(props: {}): any;\n\n\t/**\n\t * Футер страницы\n\t */\n\tfooter(props: {}): any;\n}\n","<script setup lang=\"ts\">\nimport { type Component, onUpdated, ref, type Ref } from 'vue';\nimport { useTopDialogSelf } from '@/components/dialog/dialog/composables/utils';\nimport type { Props } from './types';\n\nconst props = withDefaults(defineProps<Props>(), {\n\tkeepAlive: true,\n});\n\nconst dialog = useTopDialogSelf();\n\n/**\n * Статус загрузи асинхронного компонента страницы диалогового окна\n */\nconst updateIsLoadingAsyncPage = (component: Component, isLoaded: Ref) => {\n\tif (isLoaded.value) return;\n\n\tif (component.name !== 'AsyncComponentWrapper') {\n\t\tisLoaded.value = true;\n\n\t\treturn;\n\t}\n\n\tif (!dialog.needShowPage(props.name as string)) return;\n\n\tdialog.isLoadingPage.value = true;\n\n\t// @ts-ignore\n\tif (component.__asyncResolved) {\n\t\tisLoaded.value = true;\n\n\t\tdialog.isLoadingPage.value = false;\n\t}\n};\n\nif (props.component.name === 'AsyncComponentWrapper') {\n\tconst isLoaded = ref(false);\n\n\tonUpdated(() => {\n\t\tupdateIsLoadingAsyncPage(props.component, isLoaded);\n\t});\n}\n</script>\n\n<template>\n\t<!-- Teleport внутри при keepAlive размонитроваться не будет, см. TopDialogPage -->\n\t<KeepAlive :include=\"keepAlive ? '' : 'none'\">\n\t\t<Component\n\t\t\t:is=\"component\"\n\t\t\tv-if=\"dialog.needShowPage(name)\"\n\t\t\t:=\"props\"\n\t\t\t:name=\"name\"\n\t\t\t:order=\"order\"\n\t\t\t:prevName=\"prevName\"\n\t\t/>\n\t</KeepAlive>\n</template>\n"],"names":["vue","dialog","topDialogBaseComponent","topDialogComponent","utils","classes","propsPageCommon","updateIsLoadingAsyncPage","component","isLoaded","props"],"mappings":"gkBAmBC,MAAA,IAAA,MAAA,kFAAA,EAMD,OAAAA,EAAA,QAAA,eAAAC,CAAA,yBAMC,MAAAC,EAAAF,EAAA,mBAAA,EACAG,EAAAD,EAAA,mFAGC,MAAA,IAAA,MAAA,4DAAA,sEAIA,MAAA,IAAA,MAAA,yCAAA,EAGDD,EAAA,UAAAE,EAAAD,CAAA,CAA2D,CAAA,EAG5DF,EAAA,MAAAC,EAAA,SAAA,IAAA,CACCA,EAAA,QAAA,MAAA,EAAuB,EAAA,cAEhB,KAAA,EACD,CAAA,27BCrCPA,EAAAG,EAAA,iBAAA,EAEAC,EAAAL,EAAA,SAAA,IAAA,OACC,MAAA,0GAGA,CAAA,+oDC6BMM,EAAA,CAAwB,KAAA,aAEvB,SAAA,IAEP,MAAA,aAGO,SAAA,oBAIG,eAAA,OAGX,8LCpDAL,EAAAG,EAAA,iBAAA,EAKAG,EAAA,CAAAC,EAAAC,IAAA,CACC,GAAA,CAAAA,EAAA,MAEA,IAAAD,EAAA,OAAA,wBAAA,CACCC,EAAA,MAAA,SAEA,0BAKDR,EAAA,cAAA,MAAA,GAGAO,EAAA,kBACCC,EAAA,MAAA,GAEAR,EAAA,cAAA,MAAA,sDAKD,MAAAQ,EAAAT,EAAA,IAAA,EAAA,mBAGCO,EAAAG,EAAA,UAAAD,CAAA,CAAkD,CAAA,CAClD"}
|
package/dialog/dialog.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { defineComponent as v, provide as w, onMounted as b, getCurrentInstance as C, watch as A, openBlock as
|
|
2
|
-
import { g as
|
|
3
|
-
import { C as
|
|
4
|
-
|
|
1
|
+
import { defineComponent as v, provide as w, onMounted as b, getCurrentInstance as C, watch as A, openBlock as r, createElementBlock as i, unref as s, normalizeClass as m, normalizeStyle as c, createElementVNode as l, renderSlot as p, computed as D, resolveDirective as k, createBlock as u, Teleport as h, withDirectives as T, createCommentVNode as g, ref as $, onUpdated as B, KeepAlive as P, resolveDynamicComponent as _, mergeProps as N } from "vue";
|
|
2
|
+
import { g as W } from "../.chunks/dialogs.vue_vue_type_script_setup_true_lang-BkBYW0yR.es.js";
|
|
3
|
+
import { C as S } from "../.chunks/forms-DW_XLzg8.es.js";
|
|
4
|
+
import { u as y } from "../.chunks/utils-h5v4GPgp.es.js";
|
|
5
|
+
const E = ["id", "data-view-page-active", "data-modal", "data-position"], J = /* @__PURE__ */ v({
|
|
5
6
|
__name: "dialog",
|
|
6
7
|
props: {
|
|
7
8
|
id: {},
|
|
@@ -15,7 +16,7 @@ const L = ["id", "data-view-page-active", "data-modal", "data-position"], J = /*
|
|
|
15
16
|
},
|
|
16
17
|
emits: ["open", "close"],
|
|
17
18
|
setup(d) {
|
|
18
|
-
const o =
|
|
19
|
+
const o = W(d.id);
|
|
19
20
|
if (!o)
|
|
20
21
|
throw new Error("TopDialog cannot be used in a template, use useTopDialog() / useAsyncTopDialog()");
|
|
21
22
|
return w("dialogWorker", o), b(() => {
|
|
@@ -31,102 +32,105 @@ const L = ["id", "data-view-page-active", "data-modal", "data-position"], J = /*
|
|
|
31
32
|
}, {
|
|
32
33
|
flush: "post",
|
|
33
34
|
once: !0
|
|
34
|
-
}), (a, e) => (
|
|
35
|
-
id:
|
|
36
|
-
class:
|
|
35
|
+
}), (a, e) => (r(), i("div", {
|
|
36
|
+
id: s(o).idAttr,
|
|
37
|
+
class: m(["top-dialog", a.classes]),
|
|
37
38
|
style: c({
|
|
38
39
|
"--top-dialog-width": a.width,
|
|
39
40
|
"--top-dialog-height": a.height
|
|
40
41
|
}),
|
|
41
42
|
tabindex: "-1",
|
|
42
|
-
"data-view-page-active":
|
|
43
|
+
"data-view-page-active": s(o).pageActive.value,
|
|
43
44
|
"data-modal": a.modal,
|
|
44
45
|
"data-position": a.position
|
|
45
46
|
}, [
|
|
46
|
-
e[0] || (e[0] =
|
|
47
|
-
|
|
47
|
+
e[0] || (e[0] = l("div", { class: "modal-layer modal-layer-header" }, null, -1)),
|
|
48
|
+
l("div", {
|
|
48
49
|
class: "modal-layer modal-layer-body",
|
|
49
50
|
style: c({ "min-height": a.height + "px" })
|
|
50
51
|
}, null, 4),
|
|
51
52
|
p(a.$slots, "default")
|
|
52
|
-
], 14,
|
|
53
|
+
], 14, E));
|
|
53
54
|
}
|
|
54
|
-
}),
|
|
55
|
+
}), L = {
|
|
55
56
|
key: 0,
|
|
56
57
|
style: { display: "none" }
|
|
57
|
-
},
|
|
58
|
-
key: 0,
|
|
59
|
-
class: "modal-footer"
|
|
60
|
-
}, Q = /* @__PURE__ */ v({
|
|
58
|
+
}, F = ["data-order", "data-view-page"], M = { class: "modal-header" }, R = { class: "top-title" }, q = { class: "buttons" }, z = ["title"], I = ["title"], V = ["data-order", "data-view-page"], K = { class: "modal-body" }, Q = /* @__PURE__ */ v({
|
|
61
59
|
__name: "page",
|
|
62
60
|
props: {
|
|
63
61
|
isLoading: { type: Boolean },
|
|
64
62
|
name: {},
|
|
65
63
|
order: { default: 0 },
|
|
66
|
-
prevName: {}
|
|
64
|
+
prevName: {},
|
|
65
|
+
footerFullWith: { type: Boolean }
|
|
67
66
|
},
|
|
68
67
|
setup(d) {
|
|
69
|
-
const
|
|
68
|
+
const n = d, o = y(), a = D(() => {
|
|
70
69
|
var e;
|
|
71
70
|
return {
|
|
72
|
-
active: ((e = o.pageActive) == null ? void 0 : e.value) ===
|
|
73
|
-
"i-load-data":
|
|
71
|
+
active: ((e = o.pageActive) == null ? void 0 : e.value) === n.name,
|
|
72
|
+
"i-load-data": n.isLoading || o.isLoadingPage.value
|
|
74
73
|
};
|
|
75
74
|
});
|
|
76
75
|
return (e, t) => {
|
|
77
|
-
const f =
|
|
78
|
-
return
|
|
79
|
-
(
|
|
80
|
-
to: "#" +
|
|
81
|
-
disabled: !
|
|
76
|
+
const f = k("top-scroll-shadow");
|
|
77
|
+
return s(o).isReady.value ? (r(), i("div", L, [
|
|
78
|
+
(r(), u(h, {
|
|
79
|
+
to: "#" + s(o).idAttr + " .modal-layer-header",
|
|
80
|
+
disabled: !s(o).needShowPage(e.name)
|
|
82
81
|
}, [
|
|
83
|
-
|
|
82
|
+
l("div", {
|
|
84
83
|
"data-order": e.order,
|
|
85
84
|
"data-view-page": e.name,
|
|
86
|
-
class:
|
|
85
|
+
class: m(a.value)
|
|
87
86
|
}, [
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
l("div", M, [
|
|
88
|
+
l("div", R, [
|
|
90
89
|
p(e.$slots, "header")
|
|
91
90
|
]),
|
|
92
|
-
|
|
91
|
+
l("div", q, [
|
|
93
92
|
p(e.$slots, "headerButtons")
|
|
94
93
|
]),
|
|
95
|
-
|
|
94
|
+
s(S).state.isMobile && e.prevName ? (r(), i("div", {
|
|
96
95
|
key: 0,
|
|
97
96
|
class: "close",
|
|
98
97
|
title: e.$i18n.Common.Back,
|
|
99
98
|
"data-top-icon": "",
|
|
100
|
-
onClick: t[0] || (t[0] = (
|
|
101
|
-
}, null, 8,
|
|
99
|
+
onClick: t[0] || (t[0] = (O) => s(o).open(e.prevName))
|
|
100
|
+
}, null, 8, z)) : (r(), i("div", {
|
|
102
101
|
key: 1,
|
|
103
102
|
class: "close",
|
|
104
103
|
title: e.$i18n.Common.Close,
|
|
105
104
|
"data-top-icon": "",
|
|
106
105
|
"data-action": "top-dialog-close"
|
|
107
|
-
}, null, 8,
|
|
106
|
+
}, null, 8, I))
|
|
108
107
|
])
|
|
109
|
-
], 10,
|
|
108
|
+
], 10, F)
|
|
110
109
|
], 8, ["to", "disabled"])),
|
|
111
|
-
(
|
|
112
|
-
to: "#" +
|
|
113
|
-
disabled: !
|
|
110
|
+
(r(), u(h, {
|
|
111
|
+
to: "#" + s(o).idAttr + " .modal-layer-body",
|
|
112
|
+
disabled: !s(o).needShowPage(e.name)
|
|
114
113
|
}, [
|
|
115
|
-
|
|
114
|
+
l("div", {
|
|
116
115
|
"data-order": e.order,
|
|
117
116
|
"data-view-page": e.name,
|
|
118
|
-
class:
|
|
117
|
+
class: m(["has_scroll_container", a.value]),
|
|
119
118
|
style: c({ "--top-dialog-footer-height": e.$slots.footer ? void 0 : "0px" })
|
|
120
119
|
}, [
|
|
121
|
-
|
|
120
|
+
T((r(), i("div", K, [
|
|
122
121
|
p(e.$slots, "body")
|
|
123
122
|
])), [
|
|
124
123
|
[f]
|
|
125
124
|
]),
|
|
126
|
-
e.$slots.footer ? (
|
|
125
|
+
e.$slots.footer ? (r(), i("div", {
|
|
126
|
+
key: 0,
|
|
127
|
+
class: m(["modal-footer", {
|
|
128
|
+
"modal-footer-fullWith": e.footerFullWith
|
|
129
|
+
}])
|
|
130
|
+
}, [
|
|
127
131
|
p(e.$slots, "footer")
|
|
128
|
-
])) : g("", !0)
|
|
129
|
-
], 14,
|
|
132
|
+
], 2)) : g("", !0)
|
|
133
|
+
], 14, V)
|
|
130
134
|
], 8, ["to", "disabled"]))
|
|
131
135
|
])) : g("", !0);
|
|
132
136
|
};
|
|
@@ -140,7 +144,8 @@ const L = ["id", "data-view-page-active", "data-modal", "data-position"], J = /*
|
|
|
140
144
|
type: Number,
|
|
141
145
|
required: !0
|
|
142
146
|
},
|
|
143
|
-
prevName: String
|
|
147
|
+
prevName: String,
|
|
148
|
+
footerFullWith: Boolean
|
|
144
149
|
}, Y = /* @__PURE__ */ v({
|
|
145
150
|
__name: "pageComponent",
|
|
146
151
|
props: {
|
|
@@ -149,28 +154,29 @@ const L = ["id", "data-view-page-active", "data-modal", "data-position"], J = /*
|
|
|
149
154
|
props: {},
|
|
150
155
|
name: {},
|
|
151
156
|
order: {},
|
|
152
|
-
prevName: {}
|
|
157
|
+
prevName: {},
|
|
158
|
+
footerFullWith: { type: Boolean }
|
|
153
159
|
},
|
|
154
160
|
setup(d) {
|
|
155
|
-
const
|
|
161
|
+
const n = d, o = y(), a = (e, t) => {
|
|
156
162
|
if (!t.value) {
|
|
157
163
|
if (e.name !== "AsyncComponentWrapper") {
|
|
158
164
|
t.value = !0;
|
|
159
165
|
return;
|
|
160
166
|
}
|
|
161
|
-
o.needShowPage(
|
|
167
|
+
o.needShowPage(n.name) && (o.isLoadingPage.value = !0, e.__asyncResolved && (t.value = !0, o.isLoadingPage.value = !1));
|
|
162
168
|
}
|
|
163
169
|
};
|
|
164
|
-
if (
|
|
165
|
-
const e =
|
|
166
|
-
|
|
167
|
-
a(
|
|
170
|
+
if (n.component.name === "AsyncComponentWrapper") {
|
|
171
|
+
const e = $(!1);
|
|
172
|
+
B(() => {
|
|
173
|
+
a(n.component, e);
|
|
168
174
|
});
|
|
169
175
|
}
|
|
170
|
-
return (e, t) => (
|
|
176
|
+
return (e, t) => (r(), u(P, {
|
|
171
177
|
include: e.keepAlive ? "" : "none"
|
|
172
178
|
}, [
|
|
173
|
-
|
|
179
|
+
s(o).needShowPage(e.name) ? (r(), u(_(e.component), N({ key: 0 }, n, {
|
|
174
180
|
name: e.name,
|
|
175
181
|
order: e.order,
|
|
176
182
|
prevName: e.prevName
|
package/dialog/dialog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.js","sources":["../../src/components/dialog/dialog/dialog.vue","../../src/components/dialog/dialog/page/page.vue","../../src/components/dialog/dialog/page/types.ts","../../src/components/dialog/dialog/pageComponent/pageComponent.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { ComponentInternalInstance } from 'vue';\nimport { getCurrentInstance, onMounted, provide, watch } from 'vue';\nimport { getDialogWorker } from './dialogs/dialogs.vue';\nimport type { Emits, Props, Slots } from './types';\n\nconst props = withDefaults(defineProps<Props>(), {\n\twidth: '600px',\n\theight: 'auto',\n\tmodal: true,\n\thistoryType: 'push',\n});\n\ndefineEmits<Emits>();\n\ndefineSlots<Slots>();\n\nconst dialog = getDialogWorker(props.id);\nif (!dialog) {\n\tthrow new Error('TopDialog cannot be used in a template, use useTopDialog() / useAsyncTopDialog()');\n}\n\n/**\n * Для useTopDialogSelf()\n */\nprovide('dialogWorker', dialog);\n\n/**\n * Инициализация начального состояния TopDialogHandle\n */\nonMounted(() => {\n\tconst topDialogBaseComponent = getCurrentInstance() as ComponentInternalInstance;\n\tconst topDialogComponent = topDialogBaseComponent.parent;\n\n\tif (topDialogComponent?.parent?.type.name !== 'DialogWrapper') {\n\t\tthrow new Error('TopDialog cannot be used in a template, use useTopDialog()');\n\t}\n\n\tif (Array.isArray(topDialogComponent.subTree.children) && topDialogComponent.subTree.children.length !== 1) {\n\t\tthrow new Error('TopDialog can has only one root element');\n\t}\n\n\tdialog.onMounted(topDialogComponent, topDialogBaseComponent);\n});\n\nwatch(dialog.isOpened, () => {\n\tdialog.isReady.value = true;\n}, {\n\tflush: 'post',\n\tonce: true,\n});\n</script>\n\n<template>\n\t<div\n\t\t:id=\"dialog.idAttr\"\n\t\tclass=\"top-dialog\"\n\t\t:class=\"classes\"\n\t\t:style=\"{\n\t\t\t\t'--top-dialog-width': width,\n\t\t\t\t'--top-dialog-height': height,\n\t\t\t}\"\n\t\ttabindex=\"-1\"\n\t\t:data-view-page-active=\"dialog.pageActive.value\"\n\t\t:data-modal=\"modal\"\n\t\t:data-position=\"position\"\n\t>\n\t\t<div class=\"modal-layer modal-layer-header\"></div>\n\n\t\t<div class=\"modal-layer modal-layer-body\" :style=\"{'min-height': height + 'px'}\"></div>\n\n\t\t<slot name=\"default\"></slot>\n\t</div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport Core from '@/core/core/core';\nimport { useTopDialogSelf } from '@/components/dialog/dialog/composables/utils';\nimport type { Props, Slots } from './types';\n\nconst props = withDefaults(defineProps<Props>(), {\n\torder: 0,\n});\n\ndefineSlots<Slots>();\n\nconst dialog = useTopDialogSelf();\n\nconst classes = computed(() => {\n\treturn {\n\t\tactive: dialog.pageActive?.value === props.name,\n\t\t'i-load-data': props.isLoading || dialog.isLoadingPage.value,\n\t};\n});\n</script>\n\n<template>\n\t<div\n\t\tstyle=\"display: none\"\n\t\tv-if=\"dialog.isReady.value\"\n\t>\n\t\t<Teleport :to=\"'#' + dialog.idAttr + ' .modal-layer-header'\" :disabled=\"!dialog.needShowPage(name)\">\n\t\t\t<div\n\t\t\t\t:data-order=\"order\"\n\t\t\t\t:data-view-page=\"name\"\n\t\t\t\t:class=\"classes\"\n\t\t\t>\n\t\t\t\t<div class=\"modal-header\">\n\t\t\t\t\t<div class=\"top-title\">\n\t\t\t\t\t\t<slot name=\"header\"></slot>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div class=\"buttons\">\n\t\t\t\t\t\t<slot name=\"headerButtons\"></slot>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div\n\t\t\t\t\t\tv-if=\"Core.state.isMobile && prevName\"\n\t\t\t\t\t\tclass=\"close\"\n\t\t\t\t\t\t:title=\"$i18n.Common.Back\"\n\t\t\t\t\t\tdata-top-icon=\"\"\n\t\t\t\t\t\t@click=\"dialog.open(prevName)\"\n\t\t\t\t\t></div>\n\n\t\t\t\t\t<div\n\t\t\t\t\t\tv-else\n\t\t\t\t\t\tclass=\"close\"\n\t\t\t\t\t\t:title=\"$i18n.Common.Close\"\n\t\t\t\t\t\tdata-top-icon=\"\"\n\t\t\t\t\t\tdata-action=\"top-dialog-close\"\n\t\t\t\t\t></div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</Teleport>\n\n\t\t<Teleport :to=\"'#' + dialog.idAttr + ' .modal-layer-body'\" :disabled=\"!dialog.needShowPage(name)\">\n\t\t\t<div\n\t\t\t\t:data-order=\"order\"\n\t\t\t\t:data-view-page=\"name\"\n\t\t\t\tclass=\"has_scroll_container\"\n\t\t\t\t:class=\"classes\"\n\t\t\t\t:style=\"{'--top-dialog-footer-height': $slots.footer ? undefined : '0px'}\"\n\t\t\t>\n\t\t\t\t<div class=\"modal-body\" v-top-scroll-shadow>\n\t\t\t\t\t<slot name=\"body\"></slot>\n\t\t\t\t</div>\n\n\t\t\t\t<div
|
|
1
|
+
{"version":3,"file":"dialog.js","sources":["../../src/components/dialog/dialog/dialog.vue","../../src/components/dialog/dialog/page/page.vue","../../src/components/dialog/dialog/page/types.ts","../../src/components/dialog/dialog/pageComponent/pageComponent.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { ComponentInternalInstance } from 'vue';\nimport { getCurrentInstance, onMounted, provide, watch } from 'vue';\nimport { getDialogWorker } from './dialogs/dialogs.vue';\nimport type { Emits, Props, Slots } from './types';\n\nconst props = withDefaults(defineProps<Props>(), {\n\twidth: '600px',\n\theight: 'auto',\n\tmodal: true,\n\thistoryType: 'push',\n});\n\ndefineEmits<Emits>();\n\ndefineSlots<Slots>();\n\nconst dialog = getDialogWorker(props.id);\nif (!dialog) {\n\tthrow new Error('TopDialog cannot be used in a template, use useTopDialog() / useAsyncTopDialog()');\n}\n\n/**\n * Для useTopDialogSelf()\n */\nprovide('dialogWorker', dialog);\n\n/**\n * Инициализация начального состояния TopDialogHandle\n */\nonMounted(() => {\n\tconst topDialogBaseComponent = getCurrentInstance() as ComponentInternalInstance;\n\tconst topDialogComponent = topDialogBaseComponent.parent;\n\n\tif (topDialogComponent?.parent?.type.name !== 'DialogWrapper') {\n\t\tthrow new Error('TopDialog cannot be used in a template, use useTopDialog()');\n\t}\n\n\tif (Array.isArray(topDialogComponent.subTree.children) && topDialogComponent.subTree.children.length !== 1) {\n\t\tthrow new Error('TopDialog can has only one root element');\n\t}\n\n\tdialog.onMounted(topDialogComponent, topDialogBaseComponent);\n});\n\nwatch(dialog.isOpened, () => {\n\tdialog.isReady.value = true;\n}, {\n\tflush: 'post',\n\tonce: true,\n});\n</script>\n\n<template>\n\t<div\n\t\t:id=\"dialog.idAttr\"\n\t\tclass=\"top-dialog\"\n\t\t:class=\"classes\"\n\t\t:style=\"{\n\t\t\t\t'--top-dialog-width': width,\n\t\t\t\t'--top-dialog-height': height,\n\t\t\t}\"\n\t\ttabindex=\"-1\"\n\t\t:data-view-page-active=\"dialog.pageActive.value\"\n\t\t:data-modal=\"modal\"\n\t\t:data-position=\"position\"\n\t>\n\t\t<div class=\"modal-layer modal-layer-header\"></div>\n\n\t\t<div class=\"modal-layer modal-layer-body\" :style=\"{'min-height': height + 'px'}\"></div>\n\n\t\t<slot name=\"default\"></slot>\n\t</div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport Core from '@/core/core/core';\nimport { useTopDialogSelf } from '@/components/dialog/dialog/composables/utils';\nimport type { Props, Slots } from './types';\n\nconst props = withDefaults(defineProps<Props>(), {\n\torder: 0,\n});\n\ndefineSlots<Slots>();\n\nconst dialog = useTopDialogSelf();\n\nconst classes = computed(() => {\n\treturn {\n\t\tactive: dialog.pageActive?.value === props.name,\n\t\t'i-load-data': props.isLoading || dialog.isLoadingPage.value,\n\t};\n});\n</script>\n\n<template>\n\t<div\n\t\tstyle=\"display: none\"\n\t\tv-if=\"dialog.isReady.value\"\n\t>\n\t\t<Teleport :to=\"'#' + dialog.idAttr + ' .modal-layer-header'\" :disabled=\"!dialog.needShowPage(name)\">\n\t\t\t<div\n\t\t\t\t:data-order=\"order\"\n\t\t\t\t:data-view-page=\"name\"\n\t\t\t\t:class=\"classes\"\n\t\t\t>\n\t\t\t\t<div class=\"modal-header\">\n\t\t\t\t\t<div class=\"top-title\">\n\t\t\t\t\t\t<slot name=\"header\"></slot>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div class=\"buttons\">\n\t\t\t\t\t\t<slot name=\"headerButtons\"></slot>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div\n\t\t\t\t\t\tv-if=\"Core.state.isMobile && prevName\"\n\t\t\t\t\t\tclass=\"close\"\n\t\t\t\t\t\t:title=\"$i18n.Common.Back\"\n\t\t\t\t\t\tdata-top-icon=\"\"\n\t\t\t\t\t\t@click=\"dialog.open(prevName)\"\n\t\t\t\t\t></div>\n\n\t\t\t\t\t<div\n\t\t\t\t\t\tv-else\n\t\t\t\t\t\tclass=\"close\"\n\t\t\t\t\t\t:title=\"$i18n.Common.Close\"\n\t\t\t\t\t\tdata-top-icon=\"\"\n\t\t\t\t\t\tdata-action=\"top-dialog-close\"\n\t\t\t\t\t></div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</Teleport>\n\n\t\t<Teleport :to=\"'#' + dialog.idAttr + ' .modal-layer-body'\" :disabled=\"!dialog.needShowPage(name)\">\n\t\t\t<div\n\t\t\t\t:data-order=\"order\"\n\t\t\t\t:data-view-page=\"name\"\n\t\t\t\tclass=\"has_scroll_container\"\n\t\t\t\t:class=\"classes\"\n\t\t\t\t:style=\"{'--top-dialog-footer-height': $slots.footer ? undefined : '0px'}\"\n\t\t\t>\n\t\t\t\t<div class=\"modal-body\" v-top-scroll-shadow>\n\t\t\t\t\t<slot name=\"body\"></slot>\n\t\t\t\t</div>\n\n\t\t\t\t<div\n\t\t\t\t\tclass=\"modal-footer\"\n\t\t\t\t\t:class=\"{\n\t\t\t\t\t\t'modal-footer-fullWith': footerFullWith\n\t\t\t\t\t}\"\n\t\t\t\t\tv-if=\"$slots.footer\"\n\t\t\t\t>\n\t\t\t\t\t<slot name=\"footer\"></slot>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</Teleport>\n\t</div>\n</template>\n","export interface Props extends PropsCommon {\n\t/**\n\t * Статус загрузки страницы диалогового окна\n\t *\n\t * При включении взаимодействие со страницей блокируется, отображается анимация загрузки\n\t */\n\tisLoading?: boolean;\n}\n\n/**\n * Общие props для компонентов реализуюущих TopDialogPage\n */\nexport interface PropsCommon {\n\t/**\n\t * Имя страницы для диалогового окна\n\t *\n\t * Имя страницы нужно для навигации между страницами в одном диалоговом окне\n\t */\n\tname: string,\n\n\t/**\n\t * Порядкой номер страницы в диалоговом окне\n\t *\n\t * Одна и та же страница может быть подключена в разные диалоговые окна и иметь разный порядковый номер\n\t */\n\torder: number,\n\n\t/**\n\t * Имя предыдущей страницы\n\t *\n\t * Для кнопки Назад / Закрыть в мобильной версии\n\t */\n\tprevName?: string,\n\n\t/**\n\t * Стиль отображения футера, при котороым элементы растягиваются на всю ширину\n\t *\n\t * Разрешены переносы\n\t */\n\tfooterFullWith?: boolean,\n}\n\n/**\n * Общие props для компонентов реализуюущих TopDialogPage\n *\n * Для не SFC компонентов\n */\nexport const propsPageCommon = {\n\tname: {\n\t\ttype: String,\n\t\trequired: true,\n\t},\n\n\torder: {\n\t\ttype: Number,\n\t\trequired: true,\n\t},\n\n\tprevName: String,\n\n\tfooterFullWith: Boolean,\n};\n\nexport interface Slots {\n\t/**\n\t * Шапка страницы\n\t */\n\theader(props: {}): any;\n\n\t/**\n\t * Кнопки для шапки страницы\n\t */\n\theaderButtons(props: {}): any;\n\n\t/**\n\t * Контент страницы\n\t */\n\tbody(props: {}): any;\n\n\t/**\n\t * Футер страницы\n\t */\n\tfooter(props: {}): any;\n}\n","<script setup lang=\"ts\">\nimport { type Component, onUpdated, ref, type Ref } from 'vue';\nimport { useTopDialogSelf } from '@/components/dialog/dialog/composables/utils';\nimport type { Props } from './types';\n\nconst props = withDefaults(defineProps<Props>(), {\n\tkeepAlive: true,\n});\n\nconst dialog = useTopDialogSelf();\n\n/**\n * Статус загрузи асинхронного компонента страницы диалогового окна\n */\nconst updateIsLoadingAsyncPage = (component: Component, isLoaded: Ref) => {\n\tif (isLoaded.value) return;\n\n\tif (component.name !== 'AsyncComponentWrapper') {\n\t\tisLoaded.value = true;\n\n\t\treturn;\n\t}\n\n\tif (!dialog.needShowPage(props.name as string)) return;\n\n\tdialog.isLoadingPage.value = true;\n\n\t// @ts-ignore\n\tif (component.__asyncResolved) {\n\t\tisLoaded.value = true;\n\n\t\tdialog.isLoadingPage.value = false;\n\t}\n};\n\nif (props.component.name === 'AsyncComponentWrapper') {\n\tconst isLoaded = ref(false);\n\n\tonUpdated(() => {\n\t\tupdateIsLoadingAsyncPage(props.component, isLoaded);\n\t});\n}\n</script>\n\n<template>\n\t<!-- Teleport внутри при keepAlive размонитроваться не будет, см. TopDialogPage -->\n\t<KeepAlive :include=\"keepAlive ? '' : 'none'\">\n\t\t<Component\n\t\t\t:is=\"component\"\n\t\t\tv-if=\"dialog.needShowPage(name)\"\n\t\t\t:=\"props\"\n\t\t\t:name=\"name\"\n\t\t\t:order=\"order\"\n\t\t\t:prevName=\"prevName\"\n\t\t/>\n\t</KeepAlive>\n</template>\n"],"names":["dialog","getDialogWorker","__props","provide","onMounted","topDialogBaseComponent","getCurrentInstance","topDialogComponent","_a","watch","props","useTopDialogSelf","classes","computed","propsPageCommon","updateIsLoadingAsyncPage","component","isLoaded","ref","onUpdated"],"mappings":";;;;;;;;;;;;;;;;;;AAiBM,UAAAA,IAASC,EAXDC,EAWuB,EAAE;AACvC,QAAI,CAACF;AACE,YAAA,IAAI,MAAM,kFAAkF;AAMnG,WAAAG,EAAQ,gBAAgBH,CAAM,GAK9BI,EAAU,MAAM;;AACf,YAAMC,IAAyBC,EAAmB,GAC5CC,IAAqBF,EAAuB;AAElD,YAAIG,IAAAD,KAAA,gBAAAA,EAAoB,WAApB,gBAAAC,EAA4B,KAAK,UAAS;AACvC,cAAA,IAAI,MAAM,4DAA4D;AAGzE,UAAA,MAAM,QAAQD,EAAmB,QAAQ,QAAQ,KAAKA,EAAmB,QAAQ,SAAS,WAAW;AAClG,cAAA,IAAI,MAAM,yCAAyC;AAGnD,MAAAP,EAAA,UAAUO,GAAoBF,CAAsB;AAAA,IAAA,CAC3D,GAEKI,EAAAT,EAAO,UAAU,MAAM;AAC5B,MAAAA,EAAO,QAAQ,QAAQ;AAAA,IAAA,GACrB;AAAA,MACF,OAAO;AAAA,MACP,MAAM;AAAA,IAAA,CACN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC5CD,UAAMU,IAAQR,GAMRF,IAASW,EAAiB,GAE1BC,IAAUC,EAAS,MAAM;;AACvB,aAAA;AAAA,QACN,UAAQL,IAAAR,EAAO,eAAP,gBAAAQ,EAAmB,WAAUE,EAAM;AAAA,QAC3C,eAAeA,EAAM,aAAaV,EAAO,cAAc;AAAA,MACxD;AAAA,IAAA,CACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IC4BYc,IAAkB;AAAA,EAC9B,MAAM;AAAA,IACL,MAAM;AAAA,IACN,UAAU;AAAA,EACX;AAAA,EAEA,OAAO;AAAA,IACN,MAAM;AAAA,IACN,UAAU;AAAA,EACX;AAAA,EAEA,UAAU;AAAA,EAEV,gBAAgB;AACjB;;;;;;;;;;;;ACxDA,UAAMJ,IAAQR,GAIRF,IAASW,EAAiB,GAK1BI,IAA2B,CAACC,GAAsBC,MAAkB;AACzE,UAAI,CAAAA,EAAS,OAET;AAAA,YAAAD,EAAU,SAAS,yBAAyB;AAC/C,UAAAC,EAAS,QAAQ;AAEjB;AAAA,QAAA;AAGD,QAAKjB,EAAO,aAAaU,EAAM,IAAc,MAE7CV,EAAO,cAAc,QAAQ,IAGzBgB,EAAU,oBACbC,EAAS,QAAQ,IAEjBjB,EAAO,cAAc,QAAQ;AAAA;AAAA,IAE/B;AAEI,QAAAU,EAAM,UAAU,SAAS,yBAAyB;AAC/C,YAAAO,IAAWC,EAAI,EAAK;AAE1B,MAAAC,EAAU,MAAM;AACU,QAAAJ,EAAAL,EAAM,WAAWO,CAAQ;AAAA,MAAA,CAClD;AAAA,IAAA;;;;;;;;;;;;"}
|
package/forms/forms.amd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
define(["require","exports","../.chunks/forms-
|
|
1
|
+
define(["require","exports","../.chunks/forms-BWc2kMFD.amd"],function(n,T,a){"use strict";if(typeof e>"u")var e=window.Vue;T.TopAvatar=a.TopAvatar,T.TopButton=a.TopButton,T.TopCheckbox=a.TopCheckbox,T.TopControlLabel=a.TopControlLabel,T.TopHint=a.TopHint,T.TopInput=a.TopInput,T.TopInputDate=a.TopInputDate,T.TopInputRange=a.TopInputRange,T.TopLoadbar=a.TopLoadbar,T.TopRadio=a.TopRadio,T.TopSelect=a.TopSelect,T.TopSwitcher=a.TopSwitcher,T.TopTextarea=a.TopTextarea,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})});
|
|
2
2
|
//# sourceMappingURL=forms.amd.js.map
|
package/forms/forms.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as p, f as T, g as s, h as t, j as e, k as n, l as r, m as l, n as u, o as b, p as c, q as h, r as i } from "../.chunks/forms-
|
|
1
|
+
import { T as p, f as T, g as s, h as t, j as e, k as n, l as r, m as l, n as u, o as b, p as c, q as h, r as i } from "../.chunks/forms-DW_XLzg8.es.js";
|
|
2
2
|
export {
|
|
3
3
|
p as TopAvatar,
|
|
4
4
|
T as TopButton,
|
package/formsExt/formsExt.amd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
define(["require","exports","vue","../.chunks/forms-DYuU936i.amd","../utils/keyboard.amd","../popup/popup.amd","../.chunks/menu.vue_vue_type_style_index_0_lang-RE6Dl4Gd.amd","../require/css.amd!../assets/formsExt.css"],function(oe,V,e,g,I,w,N){"use strict";if(typeof e>"u")var e=window.Vue;const $={class:"top-editArea_footer"},_=e.defineComponent({__name:"editArea",props:{defaultValue:{default:""},title:{},cancelText:{default:"Cancel"},submitText:{default:"Send"},closeText:{default:"Close"},isFocused:{type:Boolean},forceShowCloseBtn:{type:Boolean},attachToKeyboard:{type:Boolean},modelValue:{},name:{},placeholder:{},rows:{},minHeight:{},expandable:{type:Boolean,default:!0},disabled:{type:Boolean},readonly:{type:Boolean},isError:{type:Boolean},hint:{}},emits:["submit","close","clickOnTitle"],setup(i,{emit:n}){const t=i,a=n,f=e.ref(t.defaultValue),v=e.ref(t.isFocused),d=e.computed(()=>f.value!==t.defaultValue),p=e.computed(()=>t.attachToKeyboard?"":t.forceShowCloseBtn&&!d.value?t.closeText:t.cancelText),s=u=>{a("submit",u),f.value=t.defaultValue},y=()=>{if(t.forceShowCloseBtn&&!d.value){a("close");return}f.value=t.defaultValue},B=()=>{t.attachToKeyboard&&a("clickOnTitle")};return(u,l)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"top-editArea":!0,"top-editArea-attachedToKeyboard":u.attachToKeyboard})},[u.title?(e.openBlock(),e.createElementBlock("div",{key:0,class:"top-editArea_title",onClick:l[0]||(l[0]=h=>B())},e.toDisplayString(u.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass({"top-editArea_form":!0,"top-error":u.isError,"top-focus":v.value})},[e.createVNode(g._sfc_main$3,{modelValue:f.value,"onUpdate:modelValue":l[1]||(l[1]=h=>f.value=h),name:u.name,placeholder:u.placeholder,rows:u.rows,minHeight:u.minHeight,expandable:u.expandable,disabled:u.disabled,readonly:u.readonly,isError:u.isError,hint:u.hint,class:"top-editArea_element",onFocus:l[2]||(l[2]=()=>v.value=!0),onBlur:l[3]||(l[3]=()=>v.value=!1),onKeyup:[e.withKeys(y,["esc"]),l[4]||(l[4]=e.withKeys(e.withModifiers(h=>s(f.value),["ctrl"]),["enter"]))]},null,8,["modelValue","name","placeholder","rows","minHeight","expandable","disabled","readonly","isError","hint"]),e.createElementVNode("div",$,[!u.attachToKeyboard&&(d.value||u.forceShowCloseBtn)?(e.openBlock(),e.createBlock(g._sfc_main,{key:0,class:"top-editArea_button",color:"theme",styling:"soft",onClick:y},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(p.value),1)]),_:1})):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createBlock(g._sfc_main,{key:1,class:"top-editArea_button",icon:u.attachToKeyboard?"":"",onClick:l[5]||(l[5]=h=>s(f.value))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.attachToKeyboard?"":u.submitText),1)]),_:1},8,["icon"])):e.createCommentVNode("",!0)])],2)],2))}}),M={class:"top-editInput"},L=e.defineComponent({__name:"editInput",props:{modelValue:{},input:{},button:{}},emits:["update:modelValue"],setup(i,{emit:n}){const t=i,a=e.ref(t.modelValue);e.watch(e.toRef(t.modelValue),()=>{a.value=t.modelValue});const f=n,v=()=>{f("update:modelValue",a.value)};return(d,p)=>(e.openBlock(),e.createElementBlock("div",M,[e.createVNode(g._sfc_main$2,e.mergeProps(d.input,{onKeydownCapture:p[0]||(p[0]=e.withKeys(e.withModifiers(s=>a.value=d.modelValue,["stop"]),["esc"])),onKeydown:e.withKeys(e.withModifiers(v,["stop"]),["enter"]),modelValue:a.value,"onUpdate:modelValue":p[1]||(p[1]=s=>a.value=s)}),null,16,["onKeydown","modelValue"]),a.value!==d.modelValue?(e.openBlock(),e.createBlock(g._sfc_main,e.mergeProps({key:0,icon:"",styling:"soft"},d.button,{onClick:v}),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:n}){const t=e.useModel(i,"modelValue"),a=i,f=e.ref(null);e.watch(t,()=>{var d,p,s,y,B;(d=a.radiosProps)!=null&&d.some(u=>u.value===t.value)||(t.value=((s=(p=a.radiosProps)==null?void 0:p[0])==null?void 0:s.value)??""),(B=(y=f.value)==null?void 0:y.querySelector(".radioGroup_item-selected"))==null||B.scrollIntoView()},{immediate:!0});const v="radioGroup-"+Math.random();return(d,p)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"elRef",ref:f,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,s=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass({"top-radioGroup_item-selected":s.value===t.value,"top-radioGroup_item":!0,"top-forms-focusable":!0,"top-disabled":s.disabled}),"data-top-icon":s.icon,onClick:y=>t.value=s.value},[e.createTextVNode(e.toDisplayString(s.title)+" ",1),d.showIndicator?(e.openBlock(),e.createElementBlock("span",P)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":p[0]||(p[0]=y=>t.value=y),name:v,type:"radio",class:e.normalizeClass({"top-unvisible":!0}),value:s.value,disabled:s.disabled},null,8,z),[[e.vModelRadio,t.value]])],10,K))),256))],2))}}),O=(i,n,t)=>{const a=e.ref([]),f=e.ref(!1);let v="",d;i&&!i.params.limit&&(i.params.limit=100);const p=async()=>{if(!i)return;let l,h;if(t&&(i.cache??=new Map,h=JSON.stringify(i.params),l=i.cache.get(h),l))return l;if(f.value=!0,l=await i.call(),f.value=!1,l.errors)return;if(!Array.isArray(l.result)){console.warn("В result ожидался массив");return}const C=l.result.findIndex(T=>T.id===void 0||T.name===void 0);if(C!==-1){console.warn(`В result[${C}] нет id или name`);return}return t&&i.cache.set(h,l),l},s=async()=>{if(!i)return;i.params.offset=0,i.params.search=v;const l=await p();l&&(d=l.nextOffset,a.value=l.result)},y=async()=>{if(!i||!d||f.value)return;i.params.offset=d,i.params.search=v;const l=await p();l&&(d=l.nextOffset,a.value=a.value.concat(l.result))},B=g.debounce(()=>s(),200);return{items:a,isLoading:f,loadAppend:y,setSearchTextAndLoad:(l,h=!0)=>{i&&(l.length<n||l===v&&a.value.length||(v=l,h?B():s()))}}},F={class:"top-selector2_itemMulti top-ellipsis"},G=e.defineComponent({__name:"itemMulti",props:{id:{},name:{}},emits:["delete"],setup(i){return(n,t)=>(e.openBlock(),e.createElementBlock("div",F,[e.createTextVNode(e.toDisplayString(n.name)+" ",1),e.createElementVNode("span",{class:"top-selector2_itemMultiDelete","data-top-icon":"",onClick:t[0]||(t[0]=a=>n.$emit("delete",n.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}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(i){const n=i,t=e.useModel(i,"modelValue"),a=e.ref(""),f={id:0,name:g.useI18n().Common.All},v=e.ref(null),d=e.ref(null),p=()=>{var o;return(o=v.value)==null?void 0:o.popup};window.__STORYBOOK_PREVIEW__&&!n.modelValue&&e.watch(()=>n.multiselect,()=>{t.value=n.multiselect?[]:{id:null,name:""}},{immediate:!0});const s=O(n.apiRequest,n.minLength,n.useCache),y=e.computed(()=>{const o=[];return!n.multiselect&&n.appendAllValue&&o.push(f),n.items.forEach(r=>o.push({...r})),o}),B=(o,r=!0)=>r&&o.id===null?Array.isArray(t.value)?t.value.some(m=>m.id===o.id&&m.name===o.name):o.name===t.value.name:Array.isArray(t.value)?t.value.some(m=>m.id===o.id):o.id===t.value.id,u=e.computed(()=>{const o=a.value.toLowerCase(),r=I.invertKeyboardLayout(o);let m=[];return y.value.forEach(c=>{const k=c.name.toLowerCase();(c.id===Number(o)||k.includes(o)||k.includes(r))&&(k===o||k===r?m.unshift(c):m.push(c))}),m.push(...s.items.value),n.appendSearchToResult&&a.value&&(!m.length||m[0].name.toLowerCase()!==o)&&m.push({id:null,name:a.value}),n.multiselect&&(m=m.filter(c=>!B(c))),m}),l=e.ref(s.isLoading.value);e.watch(s.isLoading,()=>{l.value=s.isLoading.value});const h=async o=>{var r,m;if(n.multiselect){if(!Array.isArray(t.value)||B(o))return;n.apiRequest&&a.value&&(l.value=!0);const c=[...t.value];c.push({...o}),t.value=c,g.Core.state.isMobile?((r=p())==null||r.close(),a.value&&(a.value="",s.items.value=[])):setTimeout(()=>{var k,A,E,S;(k=p())==null||k.recalcPosition(),(S=(E=(A=p())==null?void 0:A.elPopupWidget)==null?void 0:E.querySelector("input"))==null||S.focus(),a.value&&(u.value.length?n.apiRequest&&(l.value=!1):(a.value="",s.items.value=[]))})}else a.value&&(a.value="",s.items.value=[]),JSON.stringify(o)!==JSON.stringify(t.value)&&(t.value={...o}),(m=p())==null||m.close()},C=()=>{if(!Array.isArray(t.value)){const r=(y.value.findIndex(m=>m.id===t.value.id)+1)%y.value.length;t.value={...y.value[r]}}},T=async o=>{Array.isArray(t.value)&&(t.value=t.value.filter(r=>r.id!==o),setTimeout(()=>{var r;(r=p())==null||r.recalcPosition()}))},b=e.ref(!1);n.apiRequest&&(e.watch(b,()=>{b.value&&s.setSearchTextAndLoad(a.value,!1)}),e.watch(a,()=>s.setSearchTextAndLoad(a.value)));const te=o=>{const r=o.target;r.scrollTop/(r.scrollHeight-r.offsetHeight)>.8&&s.loadAppend()};return(o,r)=>{const m=e.resolveDirective("top-focus");return e.openBlock(),e.createBlock(e.unref(w.TopPopup),{ref_key:"popupRef",ref:v,onOpen:r[2]||(r[2]=c=>b.value=!0),onClose:r[3]||(r[3]=c=>{var k;return b.value=!1,(k=d.value)==null?void 0:k.focus()}),onScrollContentList:r[4]||(r[4]=c=>o.apiRequest?te(c):void 0),notch:!1,transitionDuration:0},{opener:e.withCtx(()=>[e.withDirectives((e.openBlock(),e.createElementBlock("div",{ref_key:"elRef",ref:d,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"]),["enter","space"])),tabindex:"0"},[o.multiselect?(e.openBlock(),e.createElementBlock("div",H,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.value,c=>(e.openBlock(),e.createBlock(G,{id:c.id,name:c.name,onDelete:T},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&&y.value.length>1&&!o.disabled?(e.openBlock(),e.createElementBlock("span",{key:2,class:"top-changer top-changer-selector",onClick:e.withModifiers(C,["stop"])})):e.createCommentVNode("",!0)],34)),[[m,o.isError,void 0,{onupdate:!0}]])]),widget:e.withCtx(()=>[e.createVNode(e.unref(w.TopPopupWidgetInput),{title:"Поиск",icon:"",modelValue:a.value,"onUpdate:modelValue":r[1]||(r[1]=c=>a.value=c),isLoading:l.value,placeholder:!Array.isArray(t.value)&&!o.multiselect&&o.showSelectedInInput?t.value.name:o.placeholder},null,8,["modelValue","isLoading","placeholder"])]),contentList:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,c=>(e.openBlock(),e.createBlock(e.unref(w.TopPopupListItem),{class:e.normalizeClass({"top-active":!Array.isArray(t.value)&&!o.multiselect&&t.value.name===c.name}),key:c.id??void 0,onClick:e.withModifiers(k=>h(c),["stop"])},{default:e.withCtx(()=>[o.$slots.item?e.renderSlot(o.$slots,"item",{key:0,item:c}):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(c.name),1)],64))]),_:2},1032,["class","onClick"]))),128)),!l.value&&!u.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)]),_:3},512)}}}),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(n,t)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"top-info":!0,["top-size_"+n.size]:!0,["top-info-styling_"+n.styling]:!0}),"data-top-icon":n.icon},[e.createElementVNode("div",J,[e.renderSlot(n.$slots,"default")]),n.$slots.additional?(e.openBlock(),e.createElementBlock("span",j,[e.renderSlot(n.$slots,"additional")])):e.createCommentVNode("",!0)],10,W))}}),Y=_,Q=L,Z=D,q=U,x=N._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-BWc2kMFD.amd","../utils/keyboard.amd","../popup/popup.amd","../.chunks/menu.vue_vue_type_style_index_0_lang-06YUloqb.amd","../require/css.amd!../assets/formsExt.css"],function(oe,V,e,g,I,w,$){"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:{},rows:{},minHeight:{},expandable:{type:Boolean,default:!0},disabled:{type:Boolean},readonly:{type:Boolean},isError:{type:Boolean},hint:{}},emits:["submit","close","clickOnTitle"],setup(i,{emit:n}){const t=i,a=n,f=e.ref(t.defaultValue),v=e.ref(t.isFocused),c=e.computed(()=>f.value!==t.defaultValue),p=e.computed(()=>t.attachToKeyboard?"":t.forceShowCloseBtn&&!c.value?t.closeText:t.cancelText),s=u=>{a("submit",u),f.value=t.defaultValue},y=()=>{if(t.forceShowCloseBtn&&!c.value){a("close");return}f.value=t.defaultValue},B=()=>{t.attachToKeyboard&&a("clickOnTitle")};return(u,l)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"top-editArea":!0,"top-editArea-attachedToKeyboard":u.attachToKeyboard})},[u.title?(e.openBlock(),e.createElementBlock("div",{key:0,class:"top-editArea_title",onClick:l[0]||(l[0]=h=>B())},e.toDisplayString(u.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass({"top-editArea_form":!0,"top-error":u.isError,"top-focus":v.value})},[e.createVNode(g._sfc_main$3,{modelValue:f.value,"onUpdate:modelValue":l[1]||(l[1]=h=>f.value=h),name:u.name,placeholder:u.placeholder,rows:u.rows,minHeight:u.minHeight,expandable:u.expandable,disabled:u.disabled,readonly:u.readonly,isError:u.isError,hint:u.hint,class:"top-editArea_element",onFocus:l[2]||(l[2]=()=>v.value=!0),onBlur:l[3]||(l[3]=()=>v.value=!1),onKeyup:[e.withKeys(y,["esc"]),l[4]||(l[4]=e.withKeys(e.withModifiers(h=>s(f.value),["ctrl"]),["enter"]))]},null,8,["modelValue","name","placeholder","rows","minHeight","expandable","disabled","readonly","isError","hint"]),e.createElementVNode("div",N,[!u.attachToKeyboard&&(c.value||u.forceShowCloseBtn)?(e.openBlock(),e.createBlock(g._sfc_main,{key:0,class:"top-editArea_button",color:"theme",styling:"soft",onClick:y},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(p.value),1)]),_:1})):e.createCommentVNode("",!0),c.value?(e.openBlock(),e.createBlock(g._sfc_main,{key:1,class:"top-editArea_button",icon:u.attachToKeyboard?"":"",onClick:l[5]||(l[5]=h=>s(f.value))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.attachToKeyboard?"":u.submitText),1)]),_:1},8,["icon"])):e.createCommentVNode("",!0)])],2)],2))}}),L={class:"top-editInput"},_=e.defineComponent({__name:"editInput",props:{modelValue:{},input:{},button:{}},emits:["update:modelValue"],setup(i,{emit:n}){const t=i,a=e.ref(t.modelValue);e.watch(e.toRef(t.modelValue),()=>{a.value=t.modelValue});const f=n,v=()=>{f("update:modelValue",a.value)};return(c,p)=>(e.openBlock(),e.createElementBlock("div",L,[e.createVNode(g._sfc_main$2,e.mergeProps(c.input,{onKeydownCapture:p[0]||(p[0]=e.withKeys(e.withModifiers(s=>a.value=c.modelValue,["stop"]),["esc"])),onKeydown:e.withKeys(e.withModifiers(v,["stop"]),["enter"]),modelValue:a.value,"onUpdate:modelValue":p[1]||(p[1]=s=>a.value=s)}),null,16,["onKeydown","modelValue"]),a.value!==c.modelValue?(e.openBlock(),e.createBlock(g._sfc_main,e.mergeProps({key:0,icon:"",styling:"soft"},c.button,{onClick:v}),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:n}){const t=e.useModel(i,"modelValue"),a=i,f=e.ref(null);e.watch(t,()=>{var c,p,s,y,B;(c=a.radiosProps)!=null&&c.some(u=>u.value===t.value)||(t.value=((s=(p=a.radiosProps)==null?void 0:p[0])==null?void 0:s.value)??""),(B=(y=f.value)==null?void 0:y.querySelector(".radioGroup_item-selected"))==null||B.scrollIntoView()},{immediate:!0});const v="radioGroup-"+Math.random();return(c,p)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"elRef",ref:f,class:e.normalizeClass({"top-radioGroup":!0,"top-scrollBarXHidding":!0,["top-size_"+c.size]:!!c.size,"top-error":c.isError})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.radiosProps,s=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass({"top-radioGroup_item-selected":s.value===t.value,"top-radioGroup_item":!0,"top-forms-focusable":!0,"top-disabled":s.disabled}),"data-top-icon":s.icon,onClick:y=>t.value=s.value},[e.createTextVNode(e.toDisplayString(s.title)+" ",1),c.showIndicator?(e.openBlock(),e.createElementBlock("span",P)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":p[0]||(p[0]=y=>t.value=y),name:v,type:"radio",class:e.normalizeClass({"top-unvisible":!0}),value:s.value,disabled:s.disabled},null,8,z),[[e.vModelRadio,t.value]])],10,K))),256))],2))}}),O=(i,n,t)=>{const a=e.ref([]),f=e.ref(!1);let v="",c;i&&!i.params.limit&&(i.params.limit=100);const p=async()=>{if(!i)return;let l,h;if(t&&(i.cache??=new Map,h=JSON.stringify(i.params),l=i.cache.get(h),l))return l;if(f.value=!0,l=await i.call(),f.value=!1,l.errors)return;if(!Array.isArray(l.result)){console.warn("В result ожидался массив");return}const C=l.result.findIndex(T=>T.id===void 0||T.name===void 0);if(C!==-1){console.warn(`В result[${C}] нет id или name`);return}return t&&i.cache.set(h,l),l},s=async()=>{if(!i)return;i.params.offset=0,i.params.search=v;const l=await p();l&&(c=l.nextOffset,a.value=l.result)},y=async()=>{if(!i||!c||f.value)return;i.params.offset=c,i.params.search=v;const l=await p();l&&(c=l.nextOffset,a.value=a.value.concat(l.result))},B=g.debounce(()=>s(),200);return{items:a,isLoading:f,loadAppend:y,setSearchTextAndLoad:(l,h=!0)=>{i&&(l.length<n||l===v&&a.value.length||(v=l,h?B():s()))}}},F={class:"top-selector2_itemMulti top-ellipsis"},G=e.defineComponent({__name:"itemMulti",props:{id:{},name:{}},emits:["delete"],setup(i){return(n,t)=>(e.openBlock(),e.createElementBlock("div",F,[e.createTextVNode(e.toDisplayString(n.name)+" ",1),e.createElementVNode("span",{class:"top-selector2_itemMultiDelete","data-top-icon":"",onClick:t[0]||(t[0]=a=>n.$emit("delete",n.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}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(i){const n=i,t=e.useModel(i,"modelValue"),a=e.ref(""),f={id:0,name:g.useI18n().Common.All},v=e.ref(null),c=e.ref(null),p=()=>{var o;return(o=v.value)==null?void 0:o.popup};window.__STORYBOOK_PREVIEW__&&!n.modelValue&&e.watch(()=>n.multiselect,()=>{t.value=n.multiselect?[]:{id:null,name:""}},{immediate:!0});const s=O(n.apiRequest,n.minLength,n.useCache),y=e.computed(()=>{const o=[];return!n.multiselect&&n.appendAllValue&&o.push(f),n.items.forEach(r=>o.push({...r})),o}),B=(o,r=!0)=>r&&o.id===null?Array.isArray(t.value)?t.value.some(m=>m.id===o.id&&m.name===o.name):o.name===t.value.name:Array.isArray(t.value)?t.value.some(m=>m.id===o.id):o.id===t.value.id,u=e.computed(()=>{const o=a.value.toLowerCase(),r=I.invertKeyboardLayout(o);let m=[];return y.value.forEach(d=>{const k=d.name.toLowerCase();(d.id===Number(o)||k.includes(o)||k.includes(r))&&(k===o||k===r?m.unshift(d):m.push(d))}),m.push(...s.items.value),n.appendSearchToResult&&a.value&&(!m.length||m[0].name.toLowerCase()!==o)&&m.push({id:null,name:a.value}),n.multiselect&&(m=m.filter(d=>!B(d))),m}),l=e.ref(s.isLoading.value);e.watch(s.isLoading,()=>{l.value=s.isLoading.value});const h=async o=>{var r,m;if(n.multiselect){if(!Array.isArray(t.value)||B(o))return;n.apiRequest&&a.value&&(l.value=!0);const d=[...t.value];d.push({...o}),t.value=d,g.Core.state.isMobile?((r=p())==null||r.close(),a.value&&(a.value="",s.items.value=[])):setTimeout(()=>{var k,A,E,S;(k=p())==null||k.recalcPosition(),(S=(E=(A=p())==null?void 0:A.elPopupWidget)==null?void 0:E.querySelector("input"))==null||S.focus(),a.value&&(u.value.length?n.apiRequest&&(l.value=!1):(a.value="",s.items.value=[]))})}else a.value&&(a.value="",s.items.value=[]),JSON.stringify(o)!==JSON.stringify(t.value)&&(t.value={...o}),(m=p())==null||m.close()},C=()=>{if(!Array.isArray(t.value)){const r=(y.value.findIndex(m=>m.id===t.value.id)+1)%y.value.length;t.value={...y.value[r]}}},T=async o=>{Array.isArray(t.value)&&(t.value=t.value.filter(r=>r.id!==o),setTimeout(()=>{var r;(r=p())==null||r.recalcPosition()}))},b=e.ref(!1);n.apiRequest&&(e.watch(b,()=>{b.value&&s.setSearchTextAndLoad(a.value,!1)}),e.watch(a,()=>s.setSearchTextAndLoad(a.value)));const te=o=>{const r=o.target;r.scrollTop/(r.scrollHeight-r.offsetHeight)>.8&&s.loadAppend()};return(o,r)=>{const m=e.resolveDirective("top-focus");return e.openBlock(),e.createBlock(e.unref(w.TopPopup),{ref_key:"popupRef",ref:v,onOpen:r[3]||(r[3]=d=>b.value=!0),onClose:r[4]||(r[4]=d=>{var k;return b.value=!1,(k=c.value)==null?void 0:k.focus()}),onScrollContentList:r[5]||(r[5]=d=>o.apiRequest?te(d):void 0),notch:!1,transitionDuration:0},{opener:e.withCtx(()=>[e.withDirectives((e.openBlock(),e.createElementBlock("div",{ref_key:"elRef",ref:c,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(d=>d.currentTarget.click(),["stop","prevent"]),["up","down","enter","space"])),r[1]||(r[1]=e.withKeys(d=>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,d=>(e.openBlock(),e.createBlock(G,{id:d.id,name:d.name,onDelete:T},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&&y.value.length>1&&!o.disabled?(e.openBlock(),e.createElementBlock("span",{key:2,class:"top-changer top-changer-selector",onClick:e.withModifiers(C,["stop"])})):e.createCommentVNode("",!0)],34)),[[m,o.isError,void 0,{onupdate:!0}]])]),widget:e.withCtx(()=>[e.createVNode(e.unref(w.TopPopupWidgetInput),{title:"Поиск",icon:"",modelValue:a.value,"onUpdate:modelValue":r[2]||(r[2]=d=>a.value=d),isLoading:l.value,placeholder:!Array.isArray(t.value)&&!o.multiselect&&o.showSelectedInInput?t.value.name:o.placeholder},null,8,["modelValue","isLoading","placeholder"])]),contentList:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,d=>(e.openBlock(),e.createBlock(e.unref(w.TopPopupListItem),{class:e.normalizeClass({"top-active":!Array.isArray(t.value)&&!o.multiselect&&t.value.name===d.name}),key:d.id??void 0,onClick:e.withModifiers(k=>h(d),["stop"])},{default:e.withCtx(()=>[o.$slots.item?e.renderSlot(o.$slots,"item",{key:0,item:d}):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(d.name),1)],64))]),_:2},1032,["class","onClick"]))),128)),!l.value&&!u.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)]),_:3},512)}}}),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(n,t)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"top-info":!0,["top-size_"+n.size]:!0,["top-info-styling_"+n.styling]:!0}),"data-top-icon":n.icon},[e.createElementVNode("div",J,[e.renderSlot(n.$slots,"default")]),n.$slots.additional?(e.openBlock(),e.createElementBlock("span",j,[e.renderSlot(n.$slots,"additional")])):e.createCommentVNode("",!0)],10,W))}}),Y=M,Q=_,Z=D,q=U,x=$._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"})});
|
|
2
2
|
//# sourceMappingURL=formsExt.amd.js.map
|