@topvisor/ui 1.4.1-projectSelector.1 → 1.4.1-projectSelector.3
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/{policy.vue_vue_type_style_index_0_lang-ClaW4X74.es.js → policy.vue_vue_type_style_index_0_lang-RJnqOsjD.es.js} +178 -167
- package/.chunks/{policy.vue_vue_type_style_index_0_lang-ClaW4X74.es.js.map → policy.vue_vue_type_style_index_0_lang-RJnqOsjD.es.js.map} +1 -1
- package/.chunks/policy.vue_vue_type_style_index_0_lang-dgZjCI-7.amd.js +2 -0
- package/.chunks/{policy.vue_vue_type_style_index_0_lang-CO-f4TwZ.amd.js.map → policy.vue_vue_type_style_index_0_lang-dgZjCI-7.amd.js.map} +1 -1
- package/formsExt/formsExt.amd.js +1 -1
- package/formsExt/formsExt.amd.js.map +1 -1
- package/formsExt/formsExt.js +33 -33
- package/formsExt/formsExt.js.map +1 -1
- package/icomoon/Read Me.txt +1 -1
- package/icomoon/Topvisor icons.json +361 -131
- package/icomoon/demo.html +141 -1
- package/icomoon/fonts/Topvisor-2.eot +0 -0
- package/icomoon/fonts/Topvisor-2.svg +11 -1
- package/icomoon/fonts/Topvisor-2.ttf +0 -0
- package/icomoon/fonts/Topvisor-2.woff +0 -0
- package/icomoon/selection.json +1 -1
- package/icomoon/style.css +35 -5
- package/package.json +1 -1
- package/project/project.amd.js +1 -1
- package/project/project.amd.js.map +1 -1
- package/project/project.js +778 -730
- package/project/project.js.map +1 -1
- package/src/components/formsExt/selector2/selector2.vue.d.ts +2 -0
- package/src/components/formsExt/selector2/types.d.ts +18 -4
- package/src/components/project/groupSelector/groups/groups.vue.d.ts +7 -1
- package/src/components/project/projectSelector/cache.d.ts +4 -0
- package/src/components/project/projectSelector/projectSelector.vue.d.ts +25 -16
- package/src/components/project/projectSelector/types.d.ts +3 -4
- package/src/components/project/projectSelector/utils.d.ts +7 -10
- package/.chunks/policy.vue_vue_type_style_index_0_lang-CO-f4TwZ.amd.js +0 -2
- package/src/components/project/projectSelector/stories/mocks/projects.d.ts +0 -10
|
@@ -25,9 +25,11 @@ declare const __VLS_component: DefineComponent<__VLS_PublicProps, {
|
|
|
25
25
|
*/
|
|
26
26
|
resetCache: (resetAPICache?: boolean) => void;
|
|
27
27
|
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
28
|
+
open: () => any;
|
|
28
29
|
"update:modelValue": (value: Item | Item[]) => any;
|
|
29
30
|
appendItem: (item: Item) => any;
|
|
30
31
|
}, string, PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
32
|
+
onOpen?: (() => any) | undefined;
|
|
31
33
|
"onUpdate:modelValue"?: ((value: Item | Item[]) => any) | undefined;
|
|
32
34
|
onAppendItem?: ((item: Item) => any) | undefined;
|
|
33
35
|
}>, {
|
|
@@ -47,6 +47,12 @@ export interface Props {
|
|
|
47
47
|
* Текст для placeholder поля поиска
|
|
48
48
|
*/
|
|
49
49
|
placeholder?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Добавить кнопку `Отменить` к виджету поиска. Клик по ней закрывает popup
|
|
52
|
+
*
|
|
53
|
+
* Только для `searchType` = `popup`
|
|
54
|
+
*/
|
|
55
|
+
hasCloserBtn?: boolean;
|
|
50
56
|
/**
|
|
51
57
|
* Если указан, будет выполнена загрузка результатов через API
|
|
52
58
|
*
|
|
@@ -93,6 +99,14 @@ export interface Props {
|
|
|
93
99
|
* Будет вызван только если `appendSearchToResult = true`
|
|
94
100
|
*/
|
|
95
101
|
appendSearchToResultCond?: (search: string) => boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Закрыть `popup` после добавления элемента
|
|
104
|
+
*
|
|
105
|
+
* По умолчанию, `popup` не закрывается на десктопе, если `multiselect` = `true`
|
|
106
|
+
*
|
|
107
|
+
* Будет вызван только если `appendSearchToResult = true`
|
|
108
|
+
*/
|
|
109
|
+
closeAfterAppend?: boolean;
|
|
96
110
|
/**
|
|
97
111
|
* Режим выбора нескольких вариантов
|
|
98
112
|
*
|
|
@@ -159,10 +173,6 @@ export interface Slots {
|
|
|
159
173
|
item?(props: {
|
|
160
174
|
item: Item;
|
|
161
175
|
}): any;
|
|
162
|
-
/**
|
|
163
|
-
* Слот для добавления элементов к виджету поиска
|
|
164
|
-
*/
|
|
165
|
-
widgetAction?(props: {}): any;
|
|
166
176
|
}
|
|
167
177
|
export type Emits = {
|
|
168
178
|
/**
|
|
@@ -171,6 +181,10 @@ export type Emits = {
|
|
|
171
181
|
* @see `props.appendSearchToResult`
|
|
172
182
|
*/
|
|
173
183
|
'appendItem': [item: Item];
|
|
184
|
+
/**
|
|
185
|
+
* Будет вызвано при открытии Popup
|
|
186
|
+
*/
|
|
187
|
+
open: [];
|
|
174
188
|
};
|
|
175
189
|
export interface PropsItemMulti {
|
|
176
190
|
id: Item['id'];
|
|
@@ -38,18 +38,21 @@ declare const _default: DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, Compo
|
|
|
38
38
|
readonly openByFocusInput?: boolean | undefined;
|
|
39
39
|
readonly searchType?: "none" | "inline" | "popup" | undefined;
|
|
40
40
|
readonly placeholder?: string | undefined;
|
|
41
|
+
readonly hasCloserBtn?: boolean | undefined;
|
|
41
42
|
readonly api?: (Api.ClientRequest<any> | Api.ClientRequestCustom<any, any, any>) | undefined;
|
|
42
43
|
readonly apiSetSearchParams?: ((api: NonNullable< Props["api"]>, search: string) => void) | undefined;
|
|
43
44
|
readonly minLength?: number | undefined;
|
|
44
45
|
readonly useCache?: boolean | undefined;
|
|
45
46
|
readonly appendSearchToResult?: boolean | undefined;
|
|
46
47
|
readonly appendSearchToResultCond?: ((search: string) => boolean) | undefined;
|
|
48
|
+
readonly closeAfterAppend?: boolean | undefined;
|
|
47
49
|
readonly multiselect?: boolean | undefined;
|
|
48
50
|
readonly useAllItem?: boolean | string | undefined;
|
|
49
51
|
readonly addChanger?: boolean | undefined;
|
|
50
52
|
readonly buttonProps?: Props | undefined;
|
|
51
53
|
readonly selectedAsPlaceholder?: boolean | undefined;
|
|
52
54
|
readonly openerShortcut?: string | undefined;
|
|
55
|
+
readonly onOpen?: (() => any) | undefined;
|
|
53
56
|
readonly "onUpdate:modelValue"?: ((value: SelectorItem | SelectorItem[]) => any) | undefined;
|
|
54
57
|
readonly onAppendItem?: ((item: SelectorItem) => any) | undefined;
|
|
55
58
|
} & VNodeProps & AllowedComponentProps & ComponentCustomProps;
|
|
@@ -70,16 +73,18 @@ declare const _default: DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, Compo
|
|
|
70
73
|
$root: ComponentPublicInstance | null;
|
|
71
74
|
$parent: ComponentPublicInstance | null;
|
|
72
75
|
$host: Element | null;
|
|
73
|
-
$emit: ((event: "update:modelValue", value: SelectorItem | SelectorItem[]) => void) & ((event: "appendItem", item: SelectorItem) => void);
|
|
76
|
+
$emit: ((event: "open") => void) & ((event: "update:modelValue", value: SelectorItem | SelectorItem[]) => void) & ((event: "appendItem", item: SelectorItem) => void);
|
|
74
77
|
$el: any;
|
|
75
78
|
$options: ComponentOptionsBase<Readonly<{
|
|
76
79
|
modelValue: Props["modelValue"];
|
|
77
80
|
} & Props> & Readonly<{
|
|
81
|
+
onOpen?: (() => any) | undefined;
|
|
78
82
|
"onUpdate:modelValue"?: ((value: SelectorItem | SelectorItem[]) => any) | undefined;
|
|
79
83
|
onAppendItem?: ((item: SelectorItem) => any) | undefined;
|
|
80
84
|
}>, {
|
|
81
85
|
resetCache: (resetAPICache?: boolean) => void;
|
|
82
86
|
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
87
|
+
open: () => any;
|
|
83
88
|
"update:modelValue": (value: SelectorItem | SelectorItem[]) => any;
|
|
84
89
|
appendItem: (item: SelectorItem) => any;
|
|
85
90
|
}, string, {
|
|
@@ -117,6 +122,7 @@ declare const _default: DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, Compo
|
|
|
117
122
|
}> & Omit<Readonly<{
|
|
118
123
|
modelValue: Props["modelValue"];
|
|
119
124
|
} & Props> & Readonly<{
|
|
125
|
+
onOpen?: (() => any) | undefined;
|
|
120
126
|
"onUpdate:modelValue"?: ((value: SelectorItem | SelectorItem[]) => any) | undefined;
|
|
121
127
|
onAppendItem?: ((item: SelectorItem) => any) | undefined;
|
|
122
128
|
}>, "resetCache" | ("size" | "openByFocusInput" | "items" | "searchType" | "minLength")> & ShallowUnwrapRef<{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Props } from './types';
|
|
2
|
-
import { Item
|
|
2
|
+
import { Item, Props, Size, Slots } from '../../formsExt/selector2/types';
|
|
3
3
|
import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions, ComponentInternalInstance, VNodeProps, AllowedComponentProps, ComponentCustomProps, ShallowUnwrapRef, Slot, ComponentPublicInstance, ComponentOptionsBase, GlobalComponents, GlobalDirectives, DebuggerEvent, nextTick, WatchOptions, WatchStopHandle, ComponentCustomProperties } from 'vue';
|
|
4
4
|
import { Props } from '../../forms/button/types';
|
|
5
5
|
import { TopLibPopup } from '../../popup/lib/popup';
|
|
@@ -8,19 +8,22 @@ type __VLS_Props = Props;
|
|
|
8
8
|
type __VLS_PublicProps = {
|
|
9
9
|
'project'?: NonNullable<Props['project']>;
|
|
10
10
|
} & __VLS_Props;
|
|
11
|
-
declare const _default: DefineComponent<__VLS_PublicProps, {
|
|
12
|
-
|
|
11
|
+
declare const _default: DefineComponent<__VLS_PublicProps, {
|
|
12
|
+
resetCache: () => void;
|
|
13
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
14
|
+
"update:project": (value: Item) => any;
|
|
13
15
|
}, string, PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
14
|
-
"onUpdate:project"?: ((value:
|
|
16
|
+
"onUpdate:project"?: ((value: Item) => any) | undefined;
|
|
15
17
|
}>, {
|
|
16
18
|
userId: number;
|
|
19
|
+
addLinksToProjects: boolean;
|
|
17
20
|
}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
18
21
|
refSelector: ({
|
|
19
22
|
$: ComponentInternalInstance;
|
|
20
23
|
$data: {};
|
|
21
24
|
$props: {
|
|
22
25
|
readonly modelValue: Props["modelValue"];
|
|
23
|
-
readonly items?:
|
|
26
|
+
readonly items?: Item[] | undefined;
|
|
24
27
|
readonly title?: string | undefined;
|
|
25
28
|
readonly disabled?: boolean | undefined;
|
|
26
29
|
readonly icon?: string | undefined;
|
|
@@ -30,20 +33,23 @@ declare const _default: DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, Compo
|
|
|
30
33
|
readonly openByFocusInput?: boolean | undefined;
|
|
31
34
|
readonly searchType?: "none" | "inline" | "popup" | undefined;
|
|
32
35
|
readonly placeholder?: string | undefined;
|
|
36
|
+
readonly hasCloserBtn?: boolean | undefined;
|
|
33
37
|
readonly api?: (Api.ClientRequest<any> | Api.ClientRequestCustom<any, any, any>) | undefined;
|
|
34
38
|
readonly apiSetSearchParams?: ((api: NonNullable< Props["api"]>, search: string) => void) | undefined;
|
|
35
39
|
readonly minLength?: number | undefined;
|
|
36
40
|
readonly useCache?: boolean | undefined;
|
|
37
41
|
readonly appendSearchToResult?: boolean | undefined;
|
|
38
42
|
readonly appendSearchToResultCond?: ((search: string) => boolean) | undefined;
|
|
43
|
+
readonly closeAfterAppend?: boolean | undefined;
|
|
39
44
|
readonly multiselect?: boolean | undefined;
|
|
40
45
|
readonly useAllItem?: boolean | string | undefined;
|
|
41
46
|
readonly addChanger?: boolean | undefined;
|
|
42
47
|
readonly buttonProps?: Props | undefined;
|
|
43
48
|
readonly selectedAsPlaceholder?: boolean | undefined;
|
|
44
49
|
readonly openerShortcut?: string | undefined;
|
|
45
|
-
readonly
|
|
46
|
-
readonly
|
|
50
|
+
readonly onOpen?: (() => any) | undefined;
|
|
51
|
+
readonly "onUpdate:modelValue"?: ((value: Item | Item[]) => any) | undefined;
|
|
52
|
+
readonly onAppendItem?: ((item: Item) => any) | undefined;
|
|
47
53
|
} & VNodeProps & AllowedComponentProps & ComponentCustomProps;
|
|
48
54
|
$attrs: {
|
|
49
55
|
[x: string]: unknown;
|
|
@@ -62,22 +68,24 @@ declare const _default: DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, Compo
|
|
|
62
68
|
$root: ComponentPublicInstance | null;
|
|
63
69
|
$parent: ComponentPublicInstance | null;
|
|
64
70
|
$host: Element | null;
|
|
65
|
-
$emit: ((event: "update:modelValue", value:
|
|
71
|
+
$emit: ((event: "open") => void) & ((event: "update:modelValue", value: Item | Item[]) => void) & ((event: "appendItem", item: Item) => void);
|
|
66
72
|
$el: any;
|
|
67
73
|
$options: ComponentOptionsBase<Readonly<{
|
|
68
74
|
modelValue: Props["modelValue"];
|
|
69
75
|
} & Props> & Readonly<{
|
|
70
|
-
|
|
71
|
-
|
|
76
|
+
onOpen?: (() => any) | undefined;
|
|
77
|
+
"onUpdate:modelValue"?: ((value: Item | Item[]) => any) | undefined;
|
|
78
|
+
onAppendItem?: ((item: Item) => any) | undefined;
|
|
72
79
|
}>, {
|
|
73
80
|
resetCache: (resetAPICache?: boolean) => void;
|
|
74
81
|
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
75
|
-
|
|
76
|
-
|
|
82
|
+
open: () => any;
|
|
83
|
+
"update:modelValue": (value: Item | Item[]) => any;
|
|
84
|
+
appendItem: (item: Item) => any;
|
|
77
85
|
}, string, {
|
|
78
86
|
size: Size;
|
|
79
87
|
openByFocusInput: boolean;
|
|
80
|
-
items:
|
|
88
|
+
items: Item[];
|
|
81
89
|
searchType: "none" | "inline" | "popup";
|
|
82
90
|
minLength: number;
|
|
83
91
|
}, {}, string, {}, GlobalComponents, GlobalDirectives, string, ComponentProvideOptions> & {
|
|
@@ -103,14 +111,15 @@ declare const _default: DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, Compo
|
|
|
103
111
|
} & Readonly<{
|
|
104
112
|
size: Size;
|
|
105
113
|
openByFocusInput: boolean;
|
|
106
|
-
items:
|
|
114
|
+
items: Item[];
|
|
107
115
|
searchType: "none" | "inline" | "popup";
|
|
108
116
|
minLength: number;
|
|
109
117
|
}> & Omit<Readonly<{
|
|
110
118
|
modelValue: Props["modelValue"];
|
|
111
119
|
} & Props> & Readonly<{
|
|
112
|
-
|
|
113
|
-
|
|
120
|
+
onOpen?: (() => any) | undefined;
|
|
121
|
+
"onUpdate:modelValue"?: ((value: Item | Item[]) => any) | undefined;
|
|
122
|
+
onAppendItem?: ((item: Item) => any) | undefined;
|
|
114
123
|
}>, "resetCache" | ("size" | "openByFocusInput" | "items" | "searchType" | "minLength")> & ShallowUnwrapRef<{
|
|
115
124
|
resetCache: (resetAPICache?: boolean) => void;
|
|
116
125
|
}> & {} & ComponentCustomProperties & {} & {
|
|
@@ -6,14 +6,13 @@ export interface Props {
|
|
|
6
6
|
*/
|
|
7
7
|
project?: Item;
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Нужно ли добавлять ссылки к проектам
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
addLinksToProjects?: boolean;
|
|
12
12
|
/**
|
|
13
13
|
* id пользователя
|
|
14
14
|
*/
|
|
15
15
|
userId: number;
|
|
16
|
-
icon?: string;
|
|
17
16
|
/**
|
|
18
17
|
* Не отображать проект с этим id в списке
|
|
19
18
|
*/
|
|
@@ -47,5 +46,5 @@ export interface Props {
|
|
|
47
46
|
*
|
|
48
47
|
* @const
|
|
49
48
|
*/
|
|
50
|
-
client
|
|
49
|
+
client: Api.Client<Api.TV.Paths, true>;
|
|
51
50
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Item } from '../../formsExt/selector2/types';
|
|
2
1
|
import { paths } from 'topvisor-openapi/src/ts/Topvisor';
|
|
3
2
|
import { components } from 'topvisor-openapi/src/ts/TV/API/Params/FieldsTrait';
|
|
4
3
|
import { components } from 'topvisor-openapi/src/ts/TV/API/Params/OrdersTrait';
|
|
@@ -6,12 +5,6 @@ import { components } from 'topvisor-openapi/src/ts/TV/API/Params/FiltersTrait';
|
|
|
6
5
|
import { components } from 'topvisor-openapi/src/ts/TV/API/Params/LimitTrait';
|
|
7
6
|
import { components } from 'topvisor-openapi/src/ts/TV/API/Params/OffsetTrait';
|
|
8
7
|
import { components } from 'topvisor-openapi/src/ts/TV/API/Types/UrlShort';
|
|
9
|
-
/**
|
|
10
|
-
* Подготавливает данные проектов для отображения:
|
|
11
|
-
* - добавляет listItemProps
|
|
12
|
-
* - сортирует по категориям с заголовками
|
|
13
|
-
*/
|
|
14
|
-
export declare const prepareProjects: (projects: Item[] | undefined, excludeProjectId?: number) => Item[] | undefined;
|
|
15
8
|
/**
|
|
16
9
|
* Сгенерировать ссылку на проект
|
|
17
10
|
*/
|
|
@@ -23,11 +16,11 @@ export declare const genProjectExternalLink: (url: string) => string;
|
|
|
23
16
|
/**
|
|
24
17
|
* Создать API запрос на получение списка проектов
|
|
25
18
|
*
|
|
26
|
-
* Данные после загрузки преобразуются
|
|
19
|
+
* Данные после загрузки преобразуются с помощью `prepareProjects()`
|
|
27
20
|
*
|
|
28
21
|
* @see prepareProjects
|
|
29
22
|
*/
|
|
30
|
-
export declare const genApiGetProjects: (client: Api.Client<Api.TV.Paths, true>, excludeProjectId?: number) => Api.ClientRequest<Api.ClientRequestContext< paths, "/get/projects_2/projects/", true>, ("name" | "id" | "on" | "right" | "url" | "user_id")[], Api.Params<Api.ClientRequestContext< paths, "/get/projects_2/projects/", true>, undefined, {
|
|
23
|
+
export declare const genApiGetProjects: (client: Api.Client<Api.TV.Paths, true>, excludeProjectId?: number, userId?: number, addLinksToProjects?: boolean, params?: Record<string, number>) => Api.ClientRequest<Api.ClientRequestContext< paths, "/get/projects_2/projects/", true>, ("name" | "id" | "on" | "right" | "url" | "user_id")[], Api.Params<Api.ClientRequestContext< paths, "/get/projects_2/projects/", true>, undefined, {
|
|
31
24
|
"COUNT(*)"?: any;
|
|
32
25
|
"IS_YOUTUBE()"?: any;
|
|
33
26
|
"IS_APP_STORE()"?: any;
|
|
@@ -115,7 +108,11 @@ export declare const genApiGetProjects: (client: Api.Client<Api.TV.Paths, true>,
|
|
|
115
108
|
filters?: components["schemas"]["TV.API.Params.FiltersTrait"]["filters"];
|
|
116
109
|
id?: components["schemas"]["TV.API.Params.FiltersTrait"]["id"];
|
|
117
110
|
limit?: components["schemas"]["TV.API.Params.LimitTrait"]["limit"];
|
|
118
|
-
offset?: components["schemas"]["TV.API.Params.OffsetTrait"]
|
|
111
|
+
offset?: components["schemas"]["TV.API.Params.OffsetTrait"] /**
|
|
112
|
+
* Добавить к данным проектов `listItemProps`
|
|
113
|
+
*
|
|
114
|
+
* @see Item
|
|
115
|
+
*/["offset"];
|
|
119
116
|
}>, Api.ModelFields<{
|
|
120
117
|
"COUNT(*)"?: any;
|
|
121
118
|
"IS_YOUTUBE()"?: any;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
define(["require","exports","vue","./forms-B_v2vU59.amd","./popupHint.vue_vue_type_style_index_0_lang-CdIajfDS.amd","./widgetInput.vue_vue_type_script_setup_true_lang-C4wFo0AR.amd","../utils/keyboard.amd","./field-Cvv0SRcJ.amd","../require/css.amd!../assets/policy.css"],(function(re,L,e,T,P,q,K,W){"use strict";if(typeof e>"u")var e=window.Vue;const O={key:0,class:"top-menu_selectAll"},z=e.defineComponent({__name:"menu",props:e.mergeModels({modelValue:{},items:{},isMultiple:{type:Boolean},canBeEmptyMultiple:{type:Boolean},styling:{default:"default"},selectAllItem:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const r=t,n=e.useModel(t,"modelValue"),l=e.ref();!r.isMultiple&&typeof n.value!="string"&&typeof n.value!="number"&&console.warn('Type check failed for prop "modelValue". Expected String: '+typeof n.value),r.isMultiple&&!Array.isArray(n.value)&&console.warn('Type check failed for prop "modelValue". Expected Array: '+typeof n.value),r.isMultiple&&!r.canBeEmptyMultiple&&Array.isArray(n.value)&&!n.value.length&&r.items[0]&&(n.value=[r.items[0]?.href??r.items[0]?.value]);const u=s=>Array.isArray(n.value)?n.value.includes(s.value):s.value===n.value,C=(s,d=!1)=>{if(Array.isArray(n.value)){let i=n.value.slice();if(d){i.length||(i=r.items.map(h=>h.value));const g=i.indexOf(s.value);g===-1?i.push(s.value):i.splice(g,1)}else i.length===1&&i[0]===s.value?i=[]:i=[s.value];!r.canBeEmptyMultiple&&!i.length&&(i=[s.value]),n.value=i;return}n.value=s.value},p=s=>{if(l.value.scrollWidth<=l.value.offsetWidth||s.shiftKey||Math.abs(s.deltaY)<50)return;s.preventDefault();const d=s.deltaY>0?30:-30;l.value.scrollLeft=l.value.scrollLeft+d},c=(s=!0)=>{const d=l.value.querySelector(".top-active");if(!d)return;const i=24,g=d.offsetLeft-l.value.offsetLeft-i,h=d.offsetLeft-l.value.offsetLeft+d.clientWidth+i,y=l.value.scrollLeft,w=l.value.clientWidth+l.value.scrollLeft;let k;g<y&&(k=g),h>w&&(k=h-l.value.clientWidth),k!==void 0&&(T.isSafari()?T.Core.$?.(l.value).animate({scrollLeft:k},s?200:0):l.value.scrollTo({left:k,behavior:s?"smooth":"auto"}))},o=()=>{if(Array.isArray(n.value)){if(n.value.length===r.items.length){n.value=[r.items[0].href??r.items[0].value];return}n.value=r.items.map(s=>s.href??s.value)}};return e.onMounted(()=>c(!1)),e.onUpdated(()=>c(!0)),(s,d)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"el",ref:l,class:e.normalizeClass({"top-menu":!0,["top-style_"+t.styling]:!0}),onWheel:p},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.items,i=>(e.openBlock(),e.createBlock(T._sfc_main$1,e.mergeProps({ref_for:!0},i,{class:"top-menu_item",color:"theme",onClick:g=>C(i,g.ctrlKey||g.metaKey),isActive:u(i)}),e.createSlots({_:2},[i.content?{name:"default",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.content),1)]),key:"0"}:void 0]),1040,["onClick","isActive"]))),256)),Array.isArray(n.value)&&t.selectAllItem?(e.openBlock(),e.createElementBlock("div",O,[e.createVNode(T._sfc_main$1,e.mergeProps(t.selectAllItem,{class:"top-menu_item",color:"theme",styling:"",onClick:d[0]||(d[0]=i=>o()),isActive:n.value.length===t.items.length}),e.createSlots({_:2},[t.selectAllItem.content?{name:"default",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.selectAllItem.content),1)]),key:"0"}:void 0]),1040,["isActive"])])):e.createCommentVNode("",!0)],34))}}),U={class:"top-selector2_itemMulti top-ellipsis"},Y=e.defineComponent({__name:"itemMulti",props:{id:{},name:{}},emits:["delete"],setup(t){return(r,n)=>(e.openBlock(),e.createElementBlock("div",U,[e.createTextVNode(e.toDisplayString(t.name)+" ",1),e.createElementVNode("span",{class:"top-selector2_itemMultiDelete","data-top-icon":"",onClick:n[0]||(n[0]=l=>r.$emit("delete",{id:t.id,name:t.name})),onMousedown:n[1]||(n[1]=e.withModifiers(()=>{},["stop"]))},null,32)]))}}),x=new Map,H=t=>{x.get(t)?.clear()},J=t=>{const r=window.mo?.user?.id;return JSON.stringify(t.params)+":"+t.url+":"+r},j=(t,r)=>x.get(r)?.get(t),G=(t,r,n)=>{x.has(r)||x.set(r,new Map),x.get(r)?.set(t,n)},Q=(t,r,n,l)=>{const u=e.ref([]),C=e.ref(!1),p=e.ref(0);let c="",o;t&&!t.params.limit&&(t.params.limit=100);const s=async()=>{if(!t)return;const h=l?J(t):void 0;if(h){const k=j(h,t.path);if(k)return t.abortByFingerprint(),k}const y=await t.call();if(y.errors)return;if(!Array.isArray(y.result)){console.warn("Array expected in `res.result`");return}const w=y.result.findIndex(k=>k.id===void 0||k.name===void 0);if(w!==-1){console.warn(`В result[${w}] нет id или name`);return}return h&&G(h,t.path,y),y},d=async h=>{if(!t)return;if(h){if(!o||C.value)return;t.params.offset=o}else t.params.offset=0;r?.(t,c),C.value=!0;const y=await s();C.value=!1,p.value++,y&&(o=y.nextOffset,h?u.value=u.value.concat(y.result):u.value=y.result)},i=T.debounce(()=>d(!1),200);return{apiRequest:t,items:u,isLoading:C,countLoading:p,load:d,setSearchTextAndLoad:(h,y=!0)=>{if(t){if(h.length<n){t.abortByFingerprint(),u.value=[];return}h===c&&u.value.length||(c=h,y?i():d(!1))}}}},V=0,b=null,F=(t,r,n=!0)=>n&&r.id===b?Array.isArray(t)?t.some(l=>l.id===r.id&&l.name===r.name):r.name===t.name:Array.isArray(t)?t.some(l=>l.id===r.id):r.id===t.id,X=(t,r,n)=>{let l=t.params.filters??[];l=l.filter(u=>u.name!==n),r&&l.push(W.genFieldFilter(n,"CONTAINS",[r])),t.changeParams({filters:l})},Z=(t,r,n,l,u,C,p,c,o,s)=>{const d=e.ref(""),i={id:V,name:T.useI18n().Common.All},g=()=>{d.value=""},h=()=>!(!s.apiRequest||d.value.length>=o),y=e.computed(()=>{const a=[];return!l&&u.value&&(typeof u.value=="string"&&(i.name=u.value),a.push(i)),n.value?.forEach(S=>a.push({...S})),a}),w=e.ref([]),k=()=>{w.value=N()},N=()=>{const a=d.value.toLowerCase(),S=K.invertKeyboardLayout(a),f=a.replace(/^https?:\/\/(www\.)?|\/$/g,"");let B=[],D;const I=[],$=()=>{I.at(-1)?.listItemProps?.type==="delimiter"&&I.pop(),I.length&&(D&&B.push(D),B.push(...I),I.length=0)};for(const A of y.value)switch(A.listItemProps?.type){case"title":$(),D=A;break;case"delimiter":if(I.length){let R=I.length;I.at(-1)?.listItemProps?.type==="delimiter"&&R--,I[R]=A}break;default:const E=A.name.toLowerCase();(String(A.id).includes(a)||E.includes(a)||E.includes(S)||E.includes(f))&&(E===a||E===S?I.unshift(A):I.push(A))}if($(),B.push(...s.items.value),C.value&&d.value&&(!p.value||p.value(a))&&!B.find(A=>A.name.toLowerCase()===a)){const A={id:b,name:d.value};B.push(A)}return l&&(B=B.filter(A=>!F(t.value,A))),B},m=a=>{a.listItemProps?.type==="title"||a.listItemProps?.type==="delimiter"||(l&&Array.isArray(t.value)?F(t.value,a)||(t.value=[...t.value,a]):t.value=a,a.id===b&&r("appendItem",a),setTimeout(()=>{g()}))};if(s.apiRequest){const a=[n,s.items];l&&a.push(t),e.watch(a,()=>{k()})}else e.watch([t,n,d],()=>{k()},{immediate:!0,deep:2});return{searchText:d,resetSearch:g,genIsShort:h,itemsForShow:w,selectItem:m,selectNextItem:()=>{if(Array.isArray(t.value))return;const a=w.value.filter(B=>!["title","delimiter"].includes(B.listItemProps?.type??"")),f=(a.findIndex(B=>B.id===t.value.id)+1)%a.length;t.value={...a[f]}},deleteItemByItem:async a=>{Array.isArray(t.value)&&(t.value=t.value.filter(S=>S.id!==a.id||S.name!==a.name))}}},_={key:0,class:"top-selector2_activeItems"},ee={key:1,class:"top-selector2_activeName top-ellipsis"},te={key:2,class:"top-selector2_placeholder top-ellipsis"},le={class:"top-selector2_searchWidget"},ne=e.defineComponent({__name:"selector2",props:e.mergeModels({modelValue:{},items:{default:()=>[]},title:{},disabled:{type:Boolean},icon:{},modificator:{},size:{default:"s"},isError:{type:Boolean},openByFocusInput:{type:Boolean,default:void 0},searchType:{default:"popup"},placeholder:{},api:{},apiSetSearchParams:{},minLength:{default:0},useCache:{type:Boolean},appendSearchToResult:{type:Boolean},appendSearchToResultCond:{},multiselect:{type:Boolean},useAllItem:{type:[Boolean,String]},addChanger:{type:Boolean},buttonProps:{},selectedAsPlaceholder:{type:Boolean},openerShortcut:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:e.mergeModels(["appendItem"],["update:modelValue"]),setup(t,{expose:r,emit:n}){const l=t,u=e.useModel(t,"modelValue"),C=n;r({resetCache:(m=!1)=>{c.apiRequest&&(m&&H(c.apiRequest.path),c.items.value=[],c.countLoading.value=0,c.apiRequest.params.offset=0,requestAnimationFrame(()=>{o.itemsForShow.value=[]}),i()?.elPopup&&c.setSearchTextAndLoad(o.searchText.value))}});const p=e.computed(()=>l.searchType==="inline"&&l.multiselect||l.searchType==="inline"&&T.Core.state.isMobile?"popup":l.searchType),c=Q(l.api,l.apiSetSearchParams,l.minLength,l.useCache),o=Z(u,C,e.toRef(l,"items"),l.multiselect,e.toRef(l,"useAllItem"),e.toRef(l,"appendSearchToResult"),e.toRef(l,"appendSearchToResultCond"),p,l.minLength,c),s=e.computed(()=>l.buttonProps?"TopButton":p.value==="inline"?"TopInput":"div"),d=e.ref(null),i=()=>d.value?.popup;c.apiRequest&&e.watch(o.searchText,()=>{c.setSearchTextAndLoad(o.searchText.value)});const g=e.computed(()=>Array.isArray(u.value)||l.multiselect||!l.selectedAsPlaceholder&&p.value!=="inline"?l.placeholder:u.value?.name||l.placeholder),h=m=>{let v=!1;switch(m.key){case"Delete":case"Backspace":Array.isArray(u.value)&&(m.preventDefault(),m.stopPropagation(),u.value.pop());break;case"ArrowUp":case"ArrowRight":case"ArrowDown":case"ArrowLeft":case"Enter":case" ":v=!0;break;case"Escape":p.value==="inline"&&o.resetSearch();break}const M=m.key.length===1&&!m.ctrlKey&&!m.metaKey;(p.value==="popup"||p.value==="inline")&&M&&(v=!0),i()?.elPopup&&(v=!1),v&&(p.value==="popup"&&(m.preventDefault(),m.stopPropagation(),M&&(o.searchText.value||(o.searchText.value=m.key))),m.currentTarget?.click())},y=m=>{m.preventDefault(),o.selectNextItem()},w=()=>{c.apiRequest&&c.setSearchTextAndLoad(o.searchText.value,!1)},k=()=>{p.value==="popup"&&o.searchText.value&&o.resetSearch()},N=m=>{const v=m.target;v.scrollTop/(v.scrollHeight-v.offsetHeight)>.8&&c.load(!0)};return(m,v)=>{const M=e.resolveComponent("TopLoadbar"),a=e.resolveDirective("top-focus"),S=e.resolveDirective("top-shortcut");return e.openBlock(),e.createBlock(e.unref(P._sfc_main),{ref_key:"popupRef",ref:d,onOpen:v[3]||(v[3]=f=>w()),onClose:v[4]||(v[4]=f=>k()),onScrollContentList:v[5]||(v[5]=f=>e.unref(c)?N(f):void 0),notch:!1,transitionDuration:0,openByFocusInput:p.value==="inline"&&(t.openByFocusInput??!0),disabled:p.value==="inline"&&e.unref(o).genIsShort()},e.createSlots({opener:e.withCtx(()=>[e.withDirectives((e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value),e.mergeProps(t.buttonProps,{class:{"top-selector2":!0,"top-selector2-multiselect":t.multiselect,["top-selector2-"+t.modificator]:!!t.modificator,"top-as-input":!t.buttonProps&&p.value!=="inline","top-as-selector":!0,["top-size_"+t.size]:!0,"top-disabled":t.disabled,"top-forms-focusable":!t.disabled,"top-error":t.isError},icon:t.icon,tabindex:"0",onKeydown:h,onBlur:v[0]||(v[0]=f=>p.value==="inline"&&e.unref(o).resetSearch()),placeholder:g.value,title:t.title,captionType:p.value==="inline"&&t.title!==void 0?"top":void 0,modelValue:e.unref(o).searchText.value,"onUpdate:modelValue":v[1]||(v[1]=f=>e.unref(o).searchText.value=f)}),{default:e.withCtx(()=>[t.multiselect?(e.openBlock(),e.createElementBlock("div",_,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,f=>(e.openBlock(),e.createBlock(Y,{id:f.id,name:f.name,onDelete:e.unref(o).deleteItemByItem},null,8,["id","name","onDelete"]))),256))])):e.createCommentVNode("",!0),p.value!=="inline"&&!t.multiselect?(e.openBlock(),e.createElementBlock("span",ee,e.toDisplayString(Array.isArray(u.value)?"":u.value.name),1)):e.createCommentVNode("",!0),t.multiselect&&!u.value.length?(e.openBlock(),e.createElementBlock("span",te,e.toDisplayString(g.value),1)):e.createCommentVNode("",!0),t.addChanger&&!t.buttonProps&&!t.multiselect&&e.unref(o).itemsForShow.value.length>1&&!t.disabled?(e.openBlock(),e.createElementBlock("span",{key:3,class:"top-changer top-changer-selector","data-top-popup-disabled":"true",onClick:y})):e.createCommentVNode("",!0)]),_:1},16,["class","icon","placeholder","title","captionType","modelValue"])),[[a,t.isError,void 0,{onupdate:!0}],[S,t.openerShortcut]])]),contentList:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(o).itemsForShow.value,f=>(e.openBlock(),e.createBlock(e.unref(P._sfc_main$2),e.mergeProps({key:f.id??void 0,class:{"top-active":!Array.isArray(u.value)&&!t.multiselect&&u.value.id===f.id&&u.value.name===f.name,"top-selector2_item-all":f.id===e.unref(V),"top-selector2_item-new":f.id===e.unref(b)}},{ref_for:!0},f.listItemProps,{closeByClick:!t.multiselect||e.unref(T.Core).state.isMobile,onClick:B=>e.unref(o).selectItem(f)}),{default:e.withCtx(()=>[m.$slots.item?e.renderSlot(m.$slots,"item",{key:0,item:f}):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(f.name),1)],64))]),_:2},1040,["class","closeByClick","onClick"]))),128)),!e.unref(o).itemsForShow.value.length&&!e.unref(o).genIsShort()?(e.openBlock(),e.createBlock(e.unref(P._sfc_main$2),{key:0,type:"regular"},{default:e.withCtx(()=>[!e.unref(c).isLoading.value||e.unref(c).countLoading.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(m.$i18n.Common.No_results),1)],64)):(e.openBlock(),e.createBlock(e.unref(T._sfc_main$12),{key:1,type:"circles"}))]),_:1})):e.createCommentVNode("",!0),e.unref(c).countLoading.value&&e.unref(c).isLoading.value&&p.value==="inline"?(e.openBlock(),e.createBlock(M,{key:1})):e.createCommentVNode("",!0)]),_:2},[p.value==="popup"?{name:"widget",fn:e.withCtx(()=>[e.createElementVNode("div",le,[e.withDirectives(e.createVNode(e.unref(q._sfc_main),{title:"Поиск",icon:"",modelValue:e.unref(o).searchText.value,"onUpdate:modelValue":v[2]||(v[2]=f=>e.unref(o).searchText.value=f),isLoading:!!e.unref(c).countLoading.value&&e.unref(c).isLoading.value,placeholder:g.value},null,8,["modelValue","isLoading","placeholder"]),[[a,u.value,void 0,{onupdate:!0}]]),e.renderSlot(m.$slots,"widgetAction")])]),key:"0"}:void 0]),1032,["openByFocusInput","disabled"])}}});L.ITEM_ID_ALL=V,L.ITEM_ID_NEW=b,L._sfc_main=ne,L._sfc_main$1=z,L.apiSetSearchParamsFilter=X}));
|
|
2
|
-
//# sourceMappingURL=policy.vue_vue_type_style_index_0_lang-CO-f4TwZ.amd.js.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Item } from '../../../../formsExt/selector2/types';
|
|
2
|
-
export declare const mockProjects: Item[];
|
|
3
|
-
export declare const generateProjects: (count: number) => {
|
|
4
|
-
id: number;
|
|
5
|
-
user_id: number;
|
|
6
|
-
name: string;
|
|
7
|
-
url: string;
|
|
8
|
-
on: 0 | 1 | -1;
|
|
9
|
-
right: string;
|
|
10
|
-
}[];
|