@scvzerng/element-plus-search-vue2 0.0.2 → 0.0.4
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/dist/ElementPlusSearch.es.js +413 -251
- package/dist/ElementPlusSearch.umd.js +1 -1
- package/dist/element-plus-search.css +1 -0
- package/dist/stats.html +4949 -0
- package/dist/types/SearchBar.vue.d.ts +14 -31
- package/dist/types/SearchBarState.d.ts +4 -1
- package/dist/types/SearchItemRender.d.ts +6 -16
- package/dist/types/SearchTagsRender.vue.d.ts +4 -17
- package/dist/types/index.d.ts +1 -1
- package/dist/types/model/SearchItem.d.ts +6 -1
- package/dist/types/setting/SearchSettingsDrawer.vue.d.ts +3 -2
- package/dist/types/setting/SettingButton.vue.d.ts +2 -10
- package/dist/types/setting/use-setting.d.ts +16 -4
- package/dist/types/types/Searchable.d.ts +7 -0
- package/package.json +2 -2
- package/dist/style.css +0 -1
- package/dist/types/helper/vModel.d.ts +0 -14
@@ -1,3 +1,4 @@
|
|
1
|
+
import { SearchBarState } from './SearchBarState';
|
1
2
|
import { Searchable } from './types/Searchable';
|
2
3
|
type __VLS_Props = {
|
3
4
|
searches: Searchable[];
|
@@ -8,12 +9,7 @@ type __VLS_Props = {
|
|
8
9
|
itemHeight?: number;
|
9
10
|
resetAutoSearch?: boolean;
|
10
11
|
};
|
11
|
-
declare const
|
12
|
-
defaultSpan: number;
|
13
|
-
maxRows: number;
|
14
|
-
itemHeight: number;
|
15
|
-
resetAutoSearch: boolean;
|
16
|
-
}>, {
|
12
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
17
13
|
getSearchItems: () => {
|
18
14
|
field: string;
|
19
15
|
label: string;
|
@@ -21,40 +17,27 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
21
17
|
required?: boolean | undefined;
|
22
18
|
index: number;
|
23
19
|
visible: boolean;
|
20
|
+
disabled: boolean | import("./index.js").PredicateCallback;
|
24
21
|
span: number;
|
25
22
|
initValue?: any;
|
23
|
+
enable: boolean | import("./index.js").PredicateCallback;
|
26
24
|
tagFilter?: ((value: any) => boolean) | undefined;
|
27
25
|
render: import("./model/SearchItem").SearchItemRender;
|
28
|
-
transform?: import("./
|
26
|
+
transform?: import("./index.js").TransformCallback<any> | undefined;
|
29
27
|
clean: () => void;
|
30
28
|
reset: () => void;
|
29
|
+
isEnable: (state: SearchBarState) => boolean;
|
30
|
+
isDisabled: (state: SearchBarState) => boolean;
|
31
31
|
}[];
|
32
|
-
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
}>>>, {
|
32
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
33
|
+
change: (...args: any[]) => void;
|
34
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
35
|
+
onChange?: ((...args: any[]) => any) | undefined;
|
36
|
+
}>, {
|
38
37
|
defaultSpan: number;
|
39
38
|
maxRows: number;
|
40
39
|
itemHeight: number;
|
41
40
|
resetAutoSearch: boolean;
|
42
|
-
}>;
|
41
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
42
|
+
declare const _default: typeof __VLS_export;
|
43
43
|
export default _default;
|
44
|
-
type __VLS_WithDefaults<P, D> = {
|
45
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
|
46
|
-
default: D[K];
|
47
|
-
}> : P[K];
|
48
|
-
};
|
49
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
50
|
-
type __VLS_TypePropsToOption<T> = {
|
51
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
52
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
53
|
-
} : {
|
54
|
-
type: import('vue').PropType<T[K]>;
|
55
|
-
required: true;
|
56
|
-
};
|
57
|
-
};
|
58
|
-
type __VLS_PrettifyLocal<T> = {
|
59
|
-
[K in keyof T]: T[K];
|
60
|
-
} & {};
|
@@ -1,18 +1,21 @@
|
|
1
1
|
import { SearchItem } from './model/SearchItem';
|
2
2
|
import { SearchConfig } from './model/SearchConfig';
|
3
3
|
import { SearchTag } from './model/SearchTag';
|
4
|
+
import { Reactive } from 'vue';
|
4
5
|
import { Searchable } from './types/Searchable';
|
5
6
|
export declare class SearchBarState {
|
6
7
|
id: string;
|
7
8
|
items: SearchItem[];
|
8
|
-
config: SearchConfig
|
9
|
+
config: Reactive<SearchConfig>;
|
9
10
|
searching: boolean;
|
10
11
|
tags: SearchTag[];
|
11
12
|
searchCallback: <T>(params: T) => Promise<void>;
|
12
13
|
sourceSearchable: Searchable[];
|
14
|
+
private _lastSearchObject;
|
13
15
|
constructor(id: string, searches: Searchable[], onSearch: (params: any) => Promise<void>);
|
14
16
|
updateTags(): void;
|
15
17
|
getSearchObject<T>(ext?: any): T;
|
16
18
|
doSearch(): Promise<void>;
|
17
19
|
reset(search?: boolean): Promise<void>;
|
20
|
+
setSearchValue(field: string, value: any): void;
|
18
21
|
}
|
@@ -1,17 +1,7 @@
|
|
1
|
+
import type { FunctionalComponent } from 'vue';
|
1
2
|
import type { SearchItem } from './model/SearchItem';
|
2
|
-
import {
|
3
|
-
declare const
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
type: PropType<SearchItem>;
|
8
|
-
required: boolean;
|
9
|
-
};
|
10
|
-
};
|
11
|
-
render(h: any, context: {
|
12
|
-
props: {
|
13
|
-
search: SearchItem;
|
14
|
-
};
|
15
|
-
}): import("vue").VNode | undefined;
|
16
|
-
};
|
17
|
-
export default _default;
|
3
|
+
import { SearchBarState } from './SearchBarState';
|
4
|
+
export declare const SearchItemRender: FunctionalComponent<{
|
5
|
+
search: SearchItem;
|
6
|
+
api: SearchBarState;
|
7
|
+
}>;
|
@@ -1,20 +1,7 @@
|
|
1
|
+
import type { SearchTag } from './model/SearchTag';
|
1
2
|
type __VLS_Props = {
|
2
|
-
tags:
|
3
|
-
required?: boolean;
|
4
|
-
valueText?: string;
|
5
|
-
label: string;
|
6
|
-
field: string;
|
7
|
-
clean: () => void;
|
8
|
-
} & any)[];
|
3
|
+
tags: SearchTag[];
|
9
4
|
};
|
10
|
-
declare const
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
6
|
+
declare const _default: typeof __VLS_export;
|
11
7
|
export default _default;
|
12
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
13
|
-
type __VLS_TypePropsToOption<T> = {
|
14
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
15
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
16
|
-
} : {
|
17
|
-
type: import('vue').PropType<T[K]>;
|
18
|
-
required: true;
|
19
|
-
};
|
20
|
-
};
|
package/dist/types/index.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { TransformCallback } from './types/Searchable';
|
2
2
|
import { SearchValueLike } from './types/SearchValueLike';
|
3
|
-
export * from "./
|
3
|
+
export * from "./types/Searchable";
|
4
4
|
export { default as SearchBar } from './SearchBar.vue';
|
5
5
|
export type SearchBarInstance = {
|
6
6
|
getSearchItems(): SearchValueLike[];
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import type { VNode } from 'vue';
|
2
2
|
import { SearchValueLike } from '../types/SearchValueLike';
|
3
|
-
import { Searchable, TransformCallback } from '../types/Searchable';
|
3
|
+
import { PredicateCallback, Searchable, TransformCallback } from '../types/Searchable';
|
4
|
+
import { SearchBarState } from '../SearchBarState';
|
4
5
|
export declare const DEFAULT_SEARCH_SPAN = 6;
|
5
6
|
export type SearchItemRender = (value: SearchValueLike) => VNode | undefined;
|
6
7
|
export declare class SearchItem {
|
@@ -10,12 +11,16 @@ export declare class SearchItem {
|
|
10
11
|
required?: boolean;
|
11
12
|
index: number;
|
12
13
|
visible: boolean;
|
14
|
+
disabled: boolean | PredicateCallback;
|
13
15
|
span: number;
|
14
16
|
initValue?: any;
|
17
|
+
enable: boolean | PredicateCallback;
|
15
18
|
tagFilter?: (value: any) => boolean;
|
16
19
|
render: SearchItemRender;
|
17
20
|
transform?: TransformCallback<any>;
|
18
21
|
constructor(searchable: Searchable, index: number);
|
19
22
|
clean(): void;
|
20
23
|
reset(): void;
|
24
|
+
isEnable(state: SearchBarState): boolean;
|
25
|
+
isDisabled(state: SearchBarState): boolean;
|
21
26
|
}
|
@@ -1,4 +1,5 @@
|
|
1
|
-
declare const
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {
|
2
2
|
show: (api: import("../SearchBarState").SearchBarState) => void;
|
3
|
-
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string,
|
3
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
4
|
+
declare const _default: typeof __VLS_export;
|
4
5
|
export default _default;
|
@@ -3,14 +3,6 @@ import { SearchBarState } from '../SearchBarState';
|
|
3
3
|
type __VLS_Props = {
|
4
4
|
state: UnwrapNestedRefs<SearchBarState>;
|
5
5
|
};
|
6
|
-
declare const
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
7
|
+
declare const _default: typeof __VLS_export;
|
7
8
|
export default _default;
|
8
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
9
|
-
type __VLS_TypePropsToOption<T> = {
|
10
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
11
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
12
|
-
} : {
|
13
|
-
type: import('vue').PropType<T[K]>;
|
14
|
-
required: true;
|
15
|
-
};
|
16
|
-
};
|
@@ -1,14 +1,24 @@
|
|
1
1
|
import type { SearchBarState } from '../SearchBarState';
|
2
|
+
import { TreeInstance } from 'element-plus';
|
3
|
+
type TreeNode = {
|
4
|
+
label: string;
|
5
|
+
id: string;
|
6
|
+
children?: TreeNode[];
|
7
|
+
};
|
2
8
|
export declare const useSetting: () => {
|
3
|
-
treeRef: import("vue").Ref<
|
4
|
-
visible: import("vue").Ref<boolean>;
|
9
|
+
treeRef: import("vue").Ref<TreeInstance | undefined, TreeInstance | undefined>;
|
10
|
+
visible: import("vue").Ref<boolean, boolean>;
|
5
11
|
snapshot: import("vue").Ref<{
|
6
12
|
label: string;
|
7
13
|
id: string;
|
8
14
|
children?: /*elided*/ any[] | undefined;
|
15
|
+
}[], TreeNode[] | {
|
16
|
+
label: string;
|
17
|
+
id: string;
|
18
|
+
children?: /*elided*/ any[] | undefined;
|
9
19
|
}[]>;
|
10
|
-
defaultCheckedKeys: import("vue").Ref<string[] | undefined>;
|
11
|
-
drawerWidth: import("vue").Ref<number>;
|
20
|
+
defaultCheckedKeys: import("vue").Ref<string[] | undefined, string[] | undefined>;
|
21
|
+
drawerWidth: import("vue").Ref<number, number>;
|
12
22
|
updateSnapshot: (api: SearchBarState) => void;
|
13
23
|
show: (api: SearchBarState) => void;
|
14
24
|
save: () => void;
|
@@ -16,4 +26,6 @@ export declare const useSetting: () => {
|
|
16
26
|
keepSelection: () => void;
|
17
27
|
restoreSelection: () => void;
|
18
28
|
allowDrop: (_: any, __: any, type: string) => boolean;
|
29
|
+
allowDrag: (node: any) => boolean;
|
19
30
|
};
|
31
|
+
export {};
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import type { VNode } from 'vue';
|
2
2
|
import { SearchItem } from '../model/SearchItem';
|
3
|
+
import { SearchBarState } from '../SearchBarState';
|
3
4
|
export type TransformCallback<T> = (value: T) => Record<string, any>;
|
5
|
+
export type PredicateCallback = (value: SearchBarState) => boolean;
|
4
6
|
export interface Searchable {
|
5
7
|
/**
|
6
8
|
* 属性名
|
@@ -22,8 +24,13 @@ export interface Searchable {
|
|
22
24
|
* 搜索的tag标签是否可以关闭
|
23
25
|
*/
|
24
26
|
required?: boolean;
|
27
|
+
disabled?: boolean | PredicateCallback;
|
25
28
|
index?: number;
|
26
29
|
visible?: boolean;
|
30
|
+
/**
|
31
|
+
* 搜索项是否启用
|
32
|
+
*/
|
33
|
+
enable: boolean | PredicateCallback;
|
27
34
|
span?: number;
|
28
35
|
/**
|
29
36
|
* 渲染器
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@scvzerng/element-plus-search-vue2",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.4",
|
4
4
|
"type": "module",
|
5
5
|
"private": false,
|
6
6
|
"scripts": {
|
@@ -17,7 +17,7 @@
|
|
17
17
|
"require": "./dist/ElementPlusSearch.umd.js"
|
18
18
|
},
|
19
19
|
"./style": {
|
20
|
-
"default": "./dist/
|
20
|
+
"default": "./dist/style.css"
|
21
21
|
}
|
22
22
|
|
23
23
|
},
|
package/dist/style.css
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
@charset "UTF-8";.tags-scroll-container{display:flex}.tags-scroll-container .pointer{cursor:pointer}.tags-scroll-container .search-tags{display:flex;flex-wrap:nowrap;overflow-x:auto;gap:10px}.tags-scroll-container .search-tags::-webkit-scrollbar{display:none}.tags-scroll-container .scroll-left-bar{cursor:pointer;margin-right:10px}.tags-scroll-container .scroll-right-bar{cursor:pointer;margin-left:10px}.setting-container{display:flex;flex-direction:column;height:100%}.setting-container .tree{flex:1;overflow-y:auto}.setting-container .footer{margin-top:auto;margin-left:auto;padding:10px 15px;display:flex;gap:10px}.setting-container .footer .el-button{width:90px}.search-bar-container{font-size:smaller;width:100%;display:flex;flex-direction:column}.search-bar-container .search{width:100%}.search-bar-container .collapsed{max-height:134px;overflow:hidden}.search-bar-container .el-input-number,.search-bar-container .el-select,.search-bar-container .el-date-editor,.search-bar-container .el-cascader{width:100%}.search-bar-container .search-bottom{display:flex}.search-bar-container .search-bottom .tags-scroll-container{flex:1;min-width:0;margin-right:10px}.search-bar-container .search-bottom .actions{display:flex;margin-left:auto}.search-bar-container .search-bottom .actions .el-button{width:90px}.search-bar-container .search-bottom .actions .icon-button{padding:0 8px;width:34px;font-size:larger}.search-bar-container .search-item{margin-bottom:12px}.search-bar-container .search-item-content{margin-top:4px}.search-bar-container .preview{overflow-x:scroll;overflow-y:hidden}.search-bar-container .scroll-tags{display:flex;align-items:center}.search-bar-container .scroll-tags .left{margin-right:10px}.search-bar-container .scroll-tags .right{margin-left:10px}
|
@@ -1,14 +0,0 @@
|
|
1
|
-
import { SearchValueLike } from '../types/SearchValueLike';
|
2
|
-
/**
|
3
|
-
* vue2 翻译jsx片段时在非组件上下文中会生成this.$set 尝试设置属性导致报错 此时使用此方法绕过生成
|
4
|
-
*
|
5
|
-
* 此函数为变种专用于search组件
|
6
|
-
*
|
7
|
-
* @param searchValue
|
8
|
-
*/
|
9
|
-
export declare const vModel: (searchValue: SearchValueLike) => {
|
10
|
-
model: {
|
11
|
-
value: any;
|
12
|
-
callback: (newValue: any) => void;
|
13
|
-
};
|
14
|
-
};
|