@xn-lib/component 0.1.35 → 0.1.40
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/index.cjs +2 -2
- package/dist/index.css +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.iife.js +2 -2
- package/dist/index.mjs +2 -2
- package/dist/index.umd.js +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +4 -1
- package/dist/types/select-input/index.d.ts +4 -0
- package/dist/types/select-input/index.vue.d.ts +59 -0
- package/dist/types/select-input/props.d.ts +31 -0
- package/dist/types/select-input/useCalcSelect.d.ts +10 -0
- package/dist/types/table/composables/index.d.ts +10 -0
- package/dist/types/table/composables/store.d.ts +181 -182
- package/dist/types/table/composables/useAutoHeight.d.ts +6 -0
- package/dist/types/table/composables/useColumns.d.ts +11 -0
- package/dist/types/table/composables/useFilter.d.ts +7 -0
- package/dist/types/table/composables/useModal.d.ts +25 -0
- package/dist/types/table/composables/useModalHandlers.d.ts +5 -0
- package/dist/types/table/composables/usePagination.d.ts +11 -0
- package/dist/types/table/composables/useRequest.d.ts +14 -0
- package/dist/types/table/composables/useSearch.d.ts +9 -0
- package/dist/types/table/composables/useSelection.d.ts +22 -0
- package/dist/types/table/composables/useSelectionSync.d.ts +4 -0
- package/dist/types/table/index.vue.d.ts +2 -2
- package/dist/types/types/select-input.d.ts +7 -0
- package/dist/types/types/table.d.ts +12 -1
- package/package.json +1 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
import type { TableProps } from '../props';
|
|
3
|
+
export declare function useFilter(props: TableProps, isRequestMode: Ref<boolean>, searchParams: Ref<Record<string, any>>): {
|
|
4
|
+
filteredData: Ref<any[], any[]>;
|
|
5
|
+
handleFilter: () => void;
|
|
6
|
+
resetFilter: () => void;
|
|
7
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare function useModal(): {
|
|
2
|
+
modalMap: import("vue").Ref<Map<string, {
|
|
3
|
+
visible: boolean;
|
|
4
|
+
data?: any;
|
|
5
|
+
}> & Omit<Map<string, {
|
|
6
|
+
visible: boolean;
|
|
7
|
+
data?: any;
|
|
8
|
+
}>, keyof Map<any, any>>, Map<string, {
|
|
9
|
+
visible: boolean;
|
|
10
|
+
data?: any;
|
|
11
|
+
}> | (Map<string, {
|
|
12
|
+
visible: boolean;
|
|
13
|
+
data?: any;
|
|
14
|
+
}> & Omit<Map<string, {
|
|
15
|
+
visible: boolean;
|
|
16
|
+
data?: any;
|
|
17
|
+
}>, keyof Map<any, any>>)>;
|
|
18
|
+
getModal: (key: string) => {
|
|
19
|
+
visible: boolean;
|
|
20
|
+
data?: any;
|
|
21
|
+
} | undefined;
|
|
22
|
+
openModal: (key: string, data?: any) => void;
|
|
23
|
+
closeModal: (key: string) => void;
|
|
24
|
+
closeAllModals: () => void;
|
|
25
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function useModalHandlers(openModal: (key: string, data?: any) => void, closeModal: (key: string) => void, modalRefs: Record<string, any>): {
|
|
2
|
+
getModalAttrs: (item: Record<string, any>) => Record<string, any>;
|
|
3
|
+
handleOpenModal: (key: string, data?: any) => void;
|
|
4
|
+
handleCloseModal: (key: string) => void;
|
|
5
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PaginationConfig } from '../../types';
|
|
2
|
+
import type { TableProps } from '../props';
|
|
3
|
+
export declare function usePagination(props: TableProps): {
|
|
4
|
+
currentPage: import("vue").Ref<number, number>;
|
|
5
|
+
pageSize: import("vue").Ref<number, number>;
|
|
6
|
+
paginationConfig: import("vue").ComputedRef<PaginationConfig>;
|
|
7
|
+
paginationEnabled: import("vue").ComputedRef<boolean>;
|
|
8
|
+
pageSizeOptions: import("vue").ComputedRef<number[]>;
|
|
9
|
+
setCurrentPage: (page: number) => void;
|
|
10
|
+
setPageSize: (size: number) => void;
|
|
11
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
import type { RequestConfig } from '../../types';
|
|
3
|
+
import type { TableProps } from '../props';
|
|
4
|
+
export declare function useRequest(props: TableProps, searchParams: Ref<Record<string, any>>, currentPage: Ref<number>, pageSize: Ref<number>): {
|
|
5
|
+
requestConfig: import("vue").ComputedRef<RequestConfig | undefined>;
|
|
6
|
+
autoLoad: import("vue").ComputedRef<boolean>;
|
|
7
|
+
autoRequest: import("vue").ComputedRef<boolean>;
|
|
8
|
+
isRequestMode: import("vue").ComputedRef<boolean>;
|
|
9
|
+
requestData: Ref<any[], any[]>;
|
|
10
|
+
requestTotal: Ref<number, number>;
|
|
11
|
+
requestLoading: Ref<boolean, boolean>;
|
|
12
|
+
loading: import("vue").ComputedRef<boolean>;
|
|
13
|
+
load: (emit?: (name: string, data: any) => void) => Promise<void>;
|
|
14
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TableProps } from '../props';
|
|
2
|
+
export declare function useSearch(props: TableProps): {
|
|
3
|
+
searchParams: import("vue").Ref<Record<string, any>, Record<string, any>>;
|
|
4
|
+
visibleSearchConfig: import("vue").ComputedRef<import("..").SearchConfig[]>;
|
|
5
|
+
updateSearchParam: (key: string, value: any) => void;
|
|
6
|
+
setSearchFields: (fields: Record<string, any>) => void;
|
|
7
|
+
resetSearch: () => void;
|
|
8
|
+
getSearchParams: (ignoreEmpty?: boolean) => Record<string, any>;
|
|
9
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { SelectionConfig } from '../../types';
|
|
2
|
+
import type { TableProps } from '../props';
|
|
3
|
+
export declare function useSelection(props: TableProps): {
|
|
4
|
+
selectedKeys: import("vue").ShallowRef<Set<any>, Set<any>>;
|
|
5
|
+
selectedRows: import("vue").ShallowRef<any[], any[]>;
|
|
6
|
+
hasSelection: import("vue").ComputedRef<boolean>;
|
|
7
|
+
selectionConfig: import("vue").ComputedRef<SelectionConfig>;
|
|
8
|
+
selectionEnabled: import("vue").ComputedRef<boolean | undefined>;
|
|
9
|
+
selectionType: import("vue").ComputedRef<any>;
|
|
10
|
+
singleSelectedKey: import("vue").ComputedRef<any>;
|
|
11
|
+
getKeyValue: (row: any) => any;
|
|
12
|
+
getRowKey: (row: any) => any;
|
|
13
|
+
toggleSelection: (row: any, _getRowKey: (row: any) => any) => void;
|
|
14
|
+
setSelection: (keys: any[], rows?: any[], append?: boolean) => void;
|
|
15
|
+
clearSelection: () => void;
|
|
16
|
+
handleSelectionChange: (selection: any[]) => void;
|
|
17
|
+
handleSelectAll: (selection: any[]) => void;
|
|
18
|
+
getSelectedKeys: () => any[];
|
|
19
|
+
getSelectedRows: () => any[];
|
|
20
|
+
isSingleSelected: (row: any) => boolean;
|
|
21
|
+
handleSingleSelect: (row: any, selected: any) => void;
|
|
22
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
export declare function useSelectionSync(selectedKeys: Ref<Set<any>>, selectedRows: Ref<any[]>, selectionType: Ref<string>, selectionConfig: Ref<{
|
|
3
|
+
reserve?: boolean;
|
|
4
|
+
}>, displayData: Ref<any[]>, getRowKey: (row: any) => any, setSelection: (keys: any[], rows?: any[]) => void, propsSelectedKeys: Ref<any[] | undefined>, propsSelectedRows: Ref<any[] | undefined>, emitUpdateKeys: (keys: any[]) => void, emitUpdateRows: (rows: any[]) => void, tableMainRef: Ref<any>): void;
|
|
@@ -110,7 +110,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
110
110
|
readonly default: () => never[];
|
|
111
111
|
};
|
|
112
112
|
}>, TableInst, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
113
|
-
search: (params: Record<string, any>) => any;
|
|
113
|
+
search: (params: Record<string, any>, searchParams: Record<string, any>) => any;
|
|
114
114
|
reset: () => any;
|
|
115
115
|
"selection-change": (selection: any[]) => any;
|
|
116
116
|
"page-change": (page: number) => any;
|
|
@@ -217,7 +217,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
217
217
|
readonly default: () => never[];
|
|
218
218
|
};
|
|
219
219
|
}>> & Readonly<{
|
|
220
|
-
onSearch?: ((params: Record<string, any>) => any) | undefined;
|
|
220
|
+
onSearch?: ((params: Record<string, any>, searchParams: Record<string, any>) => any) | undefined;
|
|
221
221
|
onReset?: (() => any) | undefined;
|
|
222
222
|
"onSelection-change"?: ((selection: any[]) => any) | undefined;
|
|
223
223
|
"onPage-change"?: ((page: number) => any) | undefined;
|
|
@@ -6,7 +6,7 @@ export type AlignType = typeof TableAlign.Left.value | typeof TableAlign.Center.
|
|
|
6
6
|
export type FixedType = boolean | typeof TableFixed.Left.value | typeof TableFixed.Right.value;
|
|
7
7
|
export type SizeType = typeof TableSize.Large.value | typeof TableSize.Default.value | typeof TableSize.Small.value;
|
|
8
8
|
export type ButtonTypeValue = typeof ButtonType.Primary.value | typeof ButtonType.Success.value | typeof ButtonType.Warning.value | typeof ButtonType.Danger.value | typeof ButtonType.Info.value | typeof ButtonType.Text.value;
|
|
9
|
-
export type SearchTypeValue = typeof SearchType.Input.value | typeof SearchType.Select.value | typeof SearchType.Date.value | typeof SearchType.DateRange.value | typeof SearchType.DateTimeRange.value | typeof SearchType.Cascader.value | typeof SearchType.Custom.value;
|
|
9
|
+
export type SearchTypeValue = typeof SearchType.Input.value | typeof SearchType.Select.value | typeof SearchType.Date.value | typeof SearchType.DateRange.value | typeof SearchType.DateTimeRange.value | typeof SearchType.Cascader.value | typeof SearchType.Custom.value | typeof SearchType.SelectInput.value;
|
|
10
10
|
export type SelectionTypeValue = typeof SelectionType.Single.value | typeof SelectionType.Multiple.value;
|
|
11
11
|
export interface ConfirmConfig {
|
|
12
12
|
/** 确认消息 */
|
|
@@ -188,10 +188,21 @@ export interface SearchConfig {
|
|
|
188
188
|
attrs?: Record<string, any>;
|
|
189
189
|
/** 日期格式(date/daterange/datetimerange 时有效) */
|
|
190
190
|
format?: string;
|
|
191
|
+
stripWhitespace?: boolean;
|
|
191
192
|
/** 值变化事件 */
|
|
192
193
|
onChange?: (value: any) => void;
|
|
193
194
|
/** 自定义渲染(type=custom 时) */
|
|
194
195
|
render?: (config: SearchConfig, model: Record<string, any>, setModel: (key: string, value: any) => void) => VNode;
|
|
196
|
+
/**
|
|
197
|
+
* 日期范围字段映射(daterange/datetimerange 时有效)
|
|
198
|
+
* 传入如 ['start', 'end'],则返回 { start: 开始时间, end: 结束时间 }
|
|
199
|
+
*/
|
|
200
|
+
rangeKeys?: [string, string];
|
|
201
|
+
/**
|
|
202
|
+
* select-input 类型时,是否格式化为 "select值: input值" 格式
|
|
203
|
+
* 默认为 false,即返回 { input: string, select: string } 对象
|
|
204
|
+
*/
|
|
205
|
+
combineValue?: boolean;
|
|
195
206
|
}
|
|
196
207
|
export interface DropdownItem {
|
|
197
208
|
/** 唯一标识 */
|