auto-vue-manual 0.0.2

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.
@@ -0,0 +1,13 @@
1
+ import { DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
2
+ declare const _default: DefineComponent<ExtractPropTypes<{
3
+ url: {
4
+ type: StringConstructor;
5
+ required: true;
6
+ };
7
+ }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<{
8
+ url: {
9
+ type: StringConstructor;
10
+ required: true;
11
+ };
12
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
13
+ export default _default;
@@ -0,0 +1,2 @@
1
+ export declare const loading_svg = "\n <path class=\"path\" d=\"\n M 30 15\n L 28 17\n M 25.61 25.61\n A 15 15, 0, 0, 1, 15 30\n A 15 15, 0, 1, 1, 27.99 7.5\n L 15 15\n \" style=\"stroke-width: 4px; fill: rgba(0, 0, 0, 0)\"/>\n";
2
+ export declare const LoadingSvgPath: (style?: string) => string;
@@ -0,0 +1,17 @@
1
+ import { Ref, ComputedRef } from 'vue';
2
+ /**
3
+ * @description 表格多选数据操作
4
+ * @param {String} rowKey 当表格可以多选时,所指定的 id
5
+ * */
6
+ export declare const useSelection: (rowKey?: string, emit?: any) => {
7
+ isSelected: Ref<boolean, boolean>;
8
+ selectedList: Ref<{
9
+ [key: string]: any;
10
+ }[], {
11
+ [key: string]: any;
12
+ }[]>;
13
+ selectedListIds: ComputedRef<string[]>;
14
+ selectionChange: (rowArr: {
15
+ [key: string]: any;
16
+ }[]) => void;
17
+ };
@@ -0,0 +1,66 @@
1
+ import { ProTableProps, ColumnProps } from '../interface/index';
2
+ import { Ref } from 'vue';
3
+ /**
4
+ * @description table 页面操作方法封装
5
+ * @param {Function} url 获取表格数据 api 方法 (必传)
6
+ * @param {Object} initParam 获取数据初始化参数 (非必传,默认为{})
7
+ * @param {Boolean} isPagination 是否有分页 (非必传,默认为true)
8
+ * @param {Function} dataCallBack 对后台返回的数据进行处理的方法 (非必传)
9
+ * */
10
+ export declare const useTable: (url?: string, initParam?: object, isPagination?: boolean, dataCallBack?: (data: any) => any, requestError?: (error: any) => void, props?: ProTableProps) => {
11
+ enumMap: Ref<Map<string, {
12
+ [key: string]: any;
13
+ }[]> & Omit<Map<string, {
14
+ [key: string]: any;
15
+ }[]>, keyof Map<any, any>>, Map<string, {
16
+ [key: string]: any;
17
+ }[]> | (Map<string, {
18
+ [key: string]: any;
19
+ }[]> & Omit<Map<string, {
20
+ [key: string]: any;
21
+ }[]>, keyof Map<any, any>>)>;
22
+ getTableList: () => void;
23
+ getSummaries: () => string[];
24
+ search: () => void;
25
+ reset: () => void;
26
+ handleSizeChange: (val: number) => void;
27
+ handleCurrentChange: (val: number) => void;
28
+ updatedTotalParam: () => void;
29
+ flatColumnsFunc: (columns: ColumnProps[], flatArr?: ColumnProps[]) => ColumnProps<any>[];
30
+ containerRef: Ref<HTMLElement | null, HTMLElement | null>;
31
+ calculateHeight: Ref<number, number>;
32
+ calculateRowH: Ref<number, number>;
33
+ calculateTitleH: Ref<number, number>;
34
+ pagerCount: Ref<number, number>;
35
+ updatePageSize: (val: number) => void;
36
+ tableData: Ref<any[], any[]>;
37
+ pagination: Ref<{
38
+ page: number;
39
+ size: number;
40
+ total: number;
41
+ }, {
42
+ page: number;
43
+ size: number;
44
+ total: number;
45
+ }>;
46
+ searchParam: Ref<{
47
+ [key: string]: any;
48
+ }, {
49
+ [key: string]: any;
50
+ }>;
51
+ searchInitParam: Ref<{
52
+ [key: string]: any;
53
+ }, {
54
+ [key: string]: any;
55
+ }>;
56
+ totalParam: Ref<{
57
+ [key: string]: any;
58
+ }, {
59
+ [key: string]: any;
60
+ }>;
61
+ icon?: Ref<{
62
+ [key: string]: any;
63
+ } | undefined, {
64
+ [key: string]: any;
65
+ } | undefined> | undefined;
66
+ };
@@ -0,0 +1,134 @@
1
+ import { VNode, ComponentPublicInstance, Ref } from 'vue';
2
+ import { TableColumnCtx, ButtonProps, Column } from 'element-plus';
3
+ import { default as ProTable } from '../../ProTable/index.vue';
4
+ export type BreakPoint = "xs" | "sm" | "md" | "lg" | "xl";
5
+ export type Responsive = {
6
+ span?: number;
7
+ offset?: number;
8
+ };
9
+ export interface EnumProps {
10
+ label?: string;
11
+ value?: string | number | boolean | any[];
12
+ disabled?: boolean;
13
+ tagType?: string;
14
+ children?: EnumProps[];
15
+ [key: string]: any;
16
+ }
17
+ export type TypeProps = "index" | "selection" | "radio" | "expand" | "sort" | "icon" | "tag" | "copy";
18
+ export type SearchType = "input" | "input-number" | "select" | "select-v2" | "tree-select" | "cascader" | "date-picker" | "time-picker" | "time-select" | "switch" | "slider";
19
+ export type SearchRenderScope = {
20
+ searchParam: {
21
+ [key: string]: any;
22
+ };
23
+ placeholder: string;
24
+ clearable: boolean;
25
+ options: EnumProps[];
26
+ data: EnumProps[];
27
+ };
28
+ export type SearchProps = {
29
+ el?: SearchType;
30
+ label?: string;
31
+ props?: any;
32
+ key?: string;
33
+ tooltip?: string;
34
+ order?: number;
35
+ span?: number;
36
+ offset?: number;
37
+ defaultValue?: string | number | boolean | any[] | Ref<any>;
38
+ render?: (scope: SearchRenderScope) => VNode;
39
+ } & Partial<Record<BreakPoint, Responsive>>;
40
+ export type FieldNamesProps = {
41
+ label: string;
42
+ value: string;
43
+ children?: string;
44
+ };
45
+ export type RenderScope<T> = {
46
+ row: T;
47
+ $index: number;
48
+ column: TableColumnCtx<T>;
49
+ [key: string]: any;
50
+ };
51
+ export type HeaderRenderScope<T> = {
52
+ $index: number;
53
+ column: TableColumnCtx<T>;
54
+ [key: string]: any;
55
+ };
56
+ export type HeaderScope<T> = RenderScope<T> & {
57
+ isSelected: boolean;
58
+ selectedList: Array<RenderScope<T>["row"]>;
59
+ selectedListIds: any[];
60
+ };
61
+ export interface ColumnProps<T = any> extends Partial<Omit<TableColumnCtx<T> & Column<T>, "type" | "children" | "renderCell" | "renderHeader">> {
62
+ type?: TypeProps;
63
+ isShow?: boolean | Ref<boolean>;
64
+ isSetting?: boolean | Ref<boolean>;
65
+ search?: SearchProps | undefined;
66
+ enum?: EnumProps[] | Ref<EnumProps[]> | ((params?: any) => Promise<any>);
67
+ isFilterEnum?: boolean | Ref<boolean>;
68
+ fieldNames?: FieldNamesProps;
69
+ headerRender?: (scope: HeaderRenderScope<T>) => VNode;
70
+ render?: (scope: RenderScope<T>) => VNode | string;
71
+ _children?: ColumnProps<T>[];
72
+ summary?: boolean | Ref<boolean>;
73
+ }
74
+ export type ProTableInstance = Omit<InstanceType<typeof ProTable>, keyof ComponentPublicInstance | keyof ProTableProps>;
75
+ export type AsyncButton = ButtonProps & {
76
+ eventType?: "drawer" | "selection" | "global";
77
+ modalName?: string;
78
+ eventName?: "add" | "edit" | "view" | "delete" | "audit";
79
+ auth?: string[];
80
+ judge?: Record<string, any[]>;
81
+ };
82
+ export interface SummaryMethodProps<T = any> {
83
+ columns: TableColumnCtx<T>[];
84
+ data: T[];
85
+ }
86
+ export interface ProTableProps {
87
+ columns: ColumnProps[];
88
+ data?: any[];
89
+ api?: string;
90
+ url?: string;
91
+ sumUrl?: string;
92
+ autoSearch?: boolean;
93
+ requestError?: (params: any) => void;
94
+ dataCallback?: (data: any) => any;
95
+ title?: string;
96
+ pagination?: boolean;
97
+ initParam?: any;
98
+ border?: boolean;
99
+ toolButton?: ("refresh" | "setting" | "search")[] | boolean;
100
+ rowKey?: string;
101
+ searchCol?: number | Record<BreakPoint, number>;
102
+ loading: Boolean;
103
+ size?: "" | "small" | "default" | "large";
104
+ pageSize?: number;
105
+ rowH?: number;
106
+ extH?: number;
107
+ sumText?: string;
108
+ sumTextFormat?: string;
109
+ }
110
+ export interface Pagination {
111
+ page: number;
112
+ size: number;
113
+ total: number;
114
+ }
115
+ export interface StateProps {
116
+ tableData: any[];
117
+ pagination: Pagination;
118
+ searchParam: {
119
+ [key: string]: any;
120
+ };
121
+ searchInitParam: {
122
+ [key: string]: any;
123
+ };
124
+ totalParam: {
125
+ [key: string]: any;
126
+ };
127
+ icon?: {
128
+ [key: string]: any;
129
+ };
130
+ }
131
+ export type SumResult = {
132
+ index: number;
133
+ text: string;
134
+ };
@@ -0,0 +1,5 @@
1
+ export declare function CopyString(s: string): void;
2
+ declare const _default: {
3
+ CopyString: typeof CopyString;
4
+ };
5
+ export default _default;
@@ -0,0 +1,46 @@
1
+ import { FieldNamesProps } from '../interface/index';
2
+ /**
3
+ * @description 处理 prop 为多级嵌套的情况,返回的数据 (列如: prop: user.name)
4
+ * @param {Object} row 当前行数据
5
+ * @param {String} prop 当前 prop
6
+ * @returns {*}
7
+ * */
8
+ export declare function handleRowAccordingToProp(row: {
9
+ [key: string]: any;
10
+ }, prop: string): any;
11
+ /**
12
+ * @description 处理 prop,当 prop 为多级嵌套时 ==> 返回最后一级 prop
13
+ * @param {String} prop 当前 prop
14
+ * @returns {String}
15
+ * */
16
+ export declare function handleProp(prop: string): string;
17
+ /**
18
+ * @description 根据枚举列表查询当需要的数据(如果指定了 label 和 value 的 key值,会自动识别格式化)
19
+ * @param {String} callValue 当前单元格值
20
+ * @param {Array} enumData 字典列表
21
+ * @param {Array} fieldNames label && value && children 的 key 值
22
+ * @param {String} type 过滤类型(目前只有 tag)
23
+ * @returns {String}
24
+ * */
25
+ export declare function filterEnum(callValue: any, enumData?: any, fieldNames?: FieldNamesProps, type?: "tag"): string;
26
+ /**
27
+ * @description 递归查找 callValue 对应的 enum 值
28
+ * */
29
+ export declare function findItemNested(enumData: any, callValue: any, value: string, children: string): any;
30
+ /**
31
+ * @description 生成唯一 uuid
32
+ * @returns {String}
33
+ */
34
+ export declare function generateUUID(): string;
35
+ /**
36
+ * @description 处理 ProTable 值为数组 || 无数据
37
+ * @param {*} callValue 需要处理的值
38
+ * @returns {String}
39
+ * */
40
+ export declare function formatValue(callValue: any): string;
41
+ /**
42
+ * @description 首字母大写
43
+ * @param {String} value 需要处理的值
44
+ * @returns {String}
45
+ * */
46
+ export declare function firstLetterUpper(value: string): string;
@@ -0,0 +1,8 @@
1
+ import { InstallOptions } from './types';
2
+ import { App } from 'vue';
3
+ declare const installer: {
4
+ install: (app: App, options: InstallOptions) => void;
5
+ version: string;
6
+ };
7
+ export type * from './types';
8
+ export default installer;
@@ -0,0 +1,8 @@
1
+ import { PersistedStateOptions } from 'pinia-plugin-persistedstate';
2
+ /**
3
+ * @description pinia 持久化参数配置
4
+ * @param {Array} paths 需要持久化的 state name
5
+ * @return persist
6
+ **/
7
+ declare const piniaPersistConfig: (key: string, paths?: string[], expireInMinutes?: number) => PersistedStateOptions;
8
+ export default piniaPersistConfig;
@@ -0,0 +1,7 @@
1
+ import { CacheState, CacheOptions } from '../../types';
2
+ import { StoreDefinition } from 'pinia';
3
+ export declare const useCacheStore: StoreDefinition<"CACHE", CacheState, {}, {
4
+ SET_CACHE(key: string, data: any): void;
5
+ REMOVE_CACHE(key: string): void;
6
+ GET_CACHE(options: CacheOptions): Promise<any>;
7
+ }>;
@@ -0,0 +1,2 @@
1
+ export * from './install';
2
+ export * from './pinia';
@@ -0,0 +1,7 @@
1
+ import { Method, AxiosPromise, ResponseType } from 'axios';
2
+ import { Emitter, EventType } from 'mitt';
3
+ export declare type Request = (url: string, params?: any, method?: Method, contentType?: string, responseType?: ResponseType) => AxiosPromise;
4
+ export declare type InstallOptions = {
5
+ request: Request;
6
+ mittBus: Emitter<Record<EventType, unknown>>;
7
+ };
@@ -0,0 +1,12 @@
1
+ export declare type CacheState = {
2
+ cache: {
3
+ [key: string]: any[];
4
+ };
5
+ };
6
+ export declare type CacheOptions = {
7
+ key: string;
8
+ url: string;
9
+ params?: Record<string, any>;
10
+ force?: boolean;
11
+ isArray?: boolean;
12
+ };
@@ -0,0 +1,5 @@
1
+ import { InstallOptions } from '../types';
2
+ export declare let request: InstallOptions["request"];
3
+ export declare let mittBus: InstallOptions["mittBus"];
4
+ declare const setOptions: (options: InstallOptions) => void;
5
+ export default setOptions;
@@ -0,0 +1,15 @@
1
+ import { EventHandlerMap, EventType, Handler, WildcardHandler } from 'mitt';
2
+ export declare const onWithPromise: (key: string, func: Function) => void;
3
+ export declare const emitWithPromise: (key: string, data?: any) => Promise<any>;
4
+ export declare const emitWithError: (key: string, data?: any) => void;
5
+ declare const _default: {
6
+ on: (key: string, func: Function) => void;
7
+ emitP: (key: string, data?: any) => Promise<any>;
8
+ emitE: (key: string, data?: any) => void;
9
+ all: EventHandlerMap<Record< EventType, unknown>>;
10
+ off<Key extends EventType>(type: Key, handler?: Handler<Record< EventType, unknown>[Key]> | undefined): void;
11
+ off(type: "*", handler: WildcardHandler<Record< EventType, unknown>>): void;
12
+ emit<Key extends EventType>(type: Key, event: Record< EventType, unknown>[Key]): void;
13
+ emit<Key extends EventType>(type: undefined extends Record< EventType, unknown>[Key] ? Key : never): void;
14
+ };
15
+ export default _default;
@@ -0,0 +1 @@
1
+ export const __VERSION__ = "0.0.1'
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "auto-vue-manual",
3
+ "version": "0.0.2",
4
+ "type": "module",
5
+ "main": "./dist/auto-vue-manual.umd.js",
6
+ "module": "./dist/auto-vue-manual.es.js",
7
+ "types": "./dist/types/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "scripts": {
12
+ "dev": "vite --port 9000",
13
+ "build:pub": "npm run build && npm run publish:latest && npm run update:auto",
14
+ "build": "rm -rf dist && vite build --config vite.config.ts && echo 'export const __VERSION__ = \"'$(npm pkg get version | tr -d '\"')\"'\" > dist/version.js",
15
+ "publish:latest": "npm version patch --no-git-tag-version && npm publish",
16
+ "update:auto": "npm uni auto-vue-manual && npm i auto-vue-manual && npm list auto-vue-manual"
17
+ },
18
+ "dependencies": {
19
+ "@element-plus/icons-vue": "^2.3.1",
20
+ "@types/react": "^19.0.10",
21
+ "axios": "^1.7.9",
22
+ "element-plus": "^2.9.3",
23
+ "mitt": "^3.0.1",
24
+ "pinia": "^2.3.0",
25
+ "pinia-plugin-persistedstate": "^3.2.3",
26
+ "sass": "^1.77.6",
27
+ "sass-loader": "^16.0.4",
28
+ "vue": "^3.5.13",
29
+ "vue-router": "^4.5.0"
30
+ },
31
+ "devDependencies": {
32
+ "@types/node": "^22.10.2",
33
+ "@vitejs/plugin-vue": "^5.2.1",
34
+ "@vitejs/plugin-vue-jsx": "^4.1.1",
35
+ "@vue/babel-plugin-jsx": "^1.2.5",
36
+ "@vue/runtime-core": "^3.5.13",
37
+ "@vue/runtime-dom": "^3.5.13",
38
+ "@vue/tsconfig": "^0.7.0",
39
+ "crypto-js": "^4.2.0",
40
+ "nprogress": "^0.2.0",
41
+ "typescript": "~5.6.2",
42
+ "uuid": "^11.1.0",
43
+ "vite": "^6.0.5",
44
+ "vite-plugin-dts": "^4.5.3",
45
+ "vue-tsc": "^2.2.0"
46
+ },
47
+ "peerDependencies": {
48
+ "@element-plus/icons-vue": "^2.3.1",
49
+ "element-plus": "^2.9.3",
50
+ "mitt": "^3.0.1",
51
+ "pinia": "^2.3.0",
52
+ "pinia-plugin-persistedstate": "^3.2.3",
53
+ "sass": "^1.77.6",
54
+ "sass-loader": "^16.0.4",
55
+ "vue": "^3.5.13",
56
+ "vue-router": "^4.5.0"
57
+ }
58
+ }