@gx-design-vue/pro-table 0.0.1

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.
Files changed (52) hide show
  1. package/README.md +1 -0
  2. package/dist/ProTable.d.ts +704 -0
  3. package/dist/_utils/ant-design-vue/index.d.ts +5 -0
  4. package/dist/_utils/ant-design-vue/pagination/typings.d.ts +1 -0
  5. package/dist/_utils/ant-design-vue/table/props.d.ts +191 -0
  6. package/dist/_utils/ant-design-vue/table/typings.d.ts +11 -0
  7. package/dist/_utils/gx-design-vue/extract-public-props.d.ts +7 -0
  8. package/dist/_utils/gx-design-vue/index.d.ts +2 -0
  9. package/dist/_utils/gx-design-vue/typings.d.ts +1 -0
  10. package/dist/_utils/hooks/useRefFunction/index.d.ts +1 -0
  11. package/dist/_utils/index.d.ts +15 -0
  12. package/dist/_utils/typings.d.ts +40 -0
  13. package/dist/components/ColumnSetting/index.d.ts +10 -0
  14. package/dist/components/ColumnSetting/style.less +95 -0
  15. package/dist/components/Form/index.d.ts +35 -0
  16. package/dist/components/Form/style.less +42 -0
  17. package/dist/components/Form/useForm.d.ts +6 -0
  18. package/dist/components/ListToolBar/index.d.ts +61 -0
  19. package/dist/components/ListToolBar/style.less +62 -0
  20. package/dist/components/ToolBar/DensityIcon.d.ts +3 -0
  21. package/dist/components/ToolBar/FullscreenIcon.d.ts +3 -0
  22. package/dist/components/ToolBar/index.d.ts +16 -0
  23. package/dist/components/ToolBar/style.less +40 -0
  24. package/dist/context/TableContext.d.ts +25 -0
  25. package/dist/design/config.less +7 -0
  26. package/dist/hooks/core/index.d.ts +3 -0
  27. package/dist/hooks/core/useMemo.d.ts +10 -0
  28. package/dist/hooks/core/useTimeout.d.ts +11 -0
  29. package/dist/hooks/useColumnSetting.d.ts +30 -0
  30. package/dist/hooks/useColums.d.ts +24 -0
  31. package/dist/hooks/useDebounceFn.d.ts +10 -0
  32. package/dist/hooks/useFetchData.d.ts +37 -0
  33. package/dist/hooks/useLoading.d.ts +17 -0
  34. package/dist/hooks/usePagination.d.ts +11 -0
  35. package/dist/hooks/useRowSelection.d.ts +9 -0
  36. package/dist/hooks/useTableForm.d.ts +15 -0
  37. package/dist/hooks/useTableScroll.d.ts +27 -0
  38. package/dist/hooks/useTableSize.d.ts +9 -0
  39. package/dist/index.d.ts +6 -0
  40. package/dist/pro-table.mjs +2095 -0
  41. package/dist/pro-table.umd.js +1 -0
  42. package/dist/props.d.ts +433 -0
  43. package/dist/style/index.less +168 -0
  44. package/dist/style/table.less +42 -0
  45. package/dist/style.css +1 -0
  46. package/dist/style.less +5 -0
  47. package/dist/types/column.d.ts +147 -0
  48. package/dist/types/table.d.ts +78 -0
  49. package/dist/typings/components.d.ts +6 -0
  50. package/dist/utils/index.d.ts +86 -0
  51. package/dist/utils/validate.d.ts +25 -0
  52. package/package.json +74 -0
@@ -0,0 +1,5 @@
1
+ @import './style/index.less';
2
+ @import './components/ColumnSetting/style.less';
3
+ @import './components/Form/style.less';
4
+ @import './components/ListToolBar/style.less';
5
+ @import './components/ToolBar/style.less';
@@ -0,0 +1,147 @@
1
+ import type { VNodeChild } from 'vue';
2
+ import type { TooltipProps } from 'ant-design-vue/es/tooltip/Tooltip';
3
+ import type { ColumnFilterItem, ColumnTitle, CompareFn, FilterDropdownProps, FilterValue, Key, SortOrder, AlignType, CellEllipsisType, DataIndex, FixedType, GetComponentProps, RenderedCell } from '../../../_utils';
4
+ /**
5
+ * @param text 文本框
6
+ * @param date 日期 YYYY-MM-DD
7
+ * @param dateMonth 月选择器
8
+ * @param dateRange 日期范围 YYYY-MM-DD[]
9
+ * @param time: 时间 HH:mm:ss
10
+ * @param select 下拉选择器
11
+ */
12
+ export declare type ProFieldValueType = 'text' | 'date' | 'select' | 'treeSelect' | 'dateMonth' | 'dateRange' | 'time';
13
+ /**
14
+ * @param text 文本框
15
+ * @param date 日期 YYYY-MM-DD
16
+ * @param dateMonth 月选择器
17
+ * @param dateRange 日期范围 YYYY-MM-DD[]
18
+ * @param time: 时间 HH:mm:ss
19
+ * @param select 下拉选择器
20
+ */
21
+ export declare type ProFieldValueFormat = 'data' | 'dateMonth' | 'dateRange' | 'dateMonth' | 'time';
22
+ export declare type ProSchemaValueEnumType = {
23
+ /** @name 演示的文案 */
24
+ text: VNodeChild | JSX.Element;
25
+ /** @name 演示的value值 */
26
+ value: any;
27
+ /** @name 是否禁用 */
28
+ disabled?: boolean;
29
+ };
30
+ declare type ProSchemaValueType<ValueType> = (ValueType | ProFieldValueType);
31
+ declare type ProSchemaValueFormat<ValueType> = (ValueType | ProFieldValueFormat);
32
+ export declare type ProSearchMap<ValueType = 'text', ValueFormat = 'date'> = {
33
+ name?: string;
34
+ /** 选择如何渲染相应的模式 */
35
+ valueType?: ProSchemaValueType<ValueType>;
36
+ ValueFormat?: ProSchemaValueFormat<ValueFormat>;
37
+ placeholder?: string | string[];
38
+ /** valueType为select生效 */
39
+ allowClear?: boolean;
40
+ /** valueType为select生效 */
41
+ showSearch?: boolean;
42
+ /** valueType为date|dateMonth|dateRange|time生效 */
43
+ format?: string;
44
+ /** valueType为date生效 */
45
+ showToday?: boolean;
46
+ /** valueType为dateRange生效 */
47
+ rangeStartName?: string;
48
+ /** valueType为dateRange生效 */
49
+ rangeEndName?: string;
50
+ /** valueType为time生效 */
51
+ use12Hours?: boolean;
52
+ /** valueType为select生效 */
53
+ loading?: boolean;
54
+ showTime?: RecordType | boolean;
55
+ /** 搜索表单的默认值 */
56
+ initialValue?: any;
57
+ /** 针对select、treeselect取值的key */
58
+ valueKey?: string;
59
+ /** 表单的属性值(ant-design)*/
60
+ field?: RecordType;
61
+ /**
62
+ * 支持 object 和Map,Map 是支持其他基础类型作为 key
63
+ *
64
+ * @name 映射值的类型
65
+ */
66
+ valueEnum?: ProSchemaValueEnumType[];
67
+ };
68
+ export declare type ProColumn = {
69
+ title?: ColumnTitle<any>;
70
+ sorter?: boolean | CompareFn<RecordType> | {
71
+ compare?: CompareFn<RecordType>;
72
+ /** Config multiple sorter order priority */
73
+ multiple?: number;
74
+ };
75
+ sortOrder?: SortOrder;
76
+ defaultSortOrder?: SortOrder;
77
+ sortDirections?: SortOrder[];
78
+ showSorterTooltip?: boolean | TooltipProps;
79
+ filtered?: boolean;
80
+ filters?: ColumnFilterItem[];
81
+ filterDropdown?: VueNode | ((props: FilterDropdownProps<RecordType>) => VueNode);
82
+ filterMultiple?: boolean;
83
+ filteredValue?: FilterValue | null;
84
+ defaultFilteredValue?: FilterValue | null;
85
+ filterIcon?: VueNode | ((opt: {
86
+ filtered: boolean;
87
+ column: ProColumns;
88
+ }) => VueNode);
89
+ onFilter?: (value: string | number | boolean, record: RecordType) => boolean;
90
+ filterDropdownVisible?: boolean;
91
+ onFilterDropdownVisibleChange?: (visible: boolean) => void;
92
+ responsive?: Breakpoint[];
93
+ children?: ProColumn[];
94
+ colSpan?: number;
95
+ dataIndex?: DataIndex;
96
+ customRender?: (opt: {
97
+ value: any;
98
+ text: any;
99
+ record: RecordType;
100
+ index: number;
101
+ column: ProColumns;
102
+ }) => any | RenderedCell<RecordType>;
103
+ rowSpan?: number;
104
+ width?: number | string;
105
+ minWidth?: number;
106
+ maxWidth?: number;
107
+ resizable?: boolean;
108
+ customCell?: GetComponentProps<RecordType>;
109
+ /** @deprecated Please use `onCell` instead */
110
+ onCellClick?: (record: RecordType, e: MouseEvent) => void;
111
+ key?: Key;
112
+ class?: string;
113
+ className?: string;
114
+ fixed?: FixedType;
115
+ customHeaderCell?: GetComponentProps<ProColumns[]>;
116
+ ellipsis?: CellEllipsisType;
117
+ align?: AlignType;
118
+ customFilterDropdown?: boolean;
119
+ /** @deprecated Please use `v-slot:filterIcon` `v-slot:bodyCell` `v-slot:headerCell` instead */
120
+ slots?: {
121
+ filterIcon?: string;
122
+ filterDropdown?: string;
123
+ customRender?: string;
124
+ title?: string;
125
+ };
126
+ /**
127
+ * @private Internal usage.
128
+ *
129
+ * !!! DO NOT USE IN PRODUCTION ENVIRONMENT !!!
130
+ */
131
+ __originColumn__?: any;
132
+ uuid?: string | number;
133
+ /** 不在列表中显示 */
134
+ show?: boolean;
135
+ /** 列表顺序值 */
136
+ order?: number;
137
+ /** 不在配置工具中显示 */
138
+ hideInSetting?: boolean;
139
+ /** 表单搜索配置 */
140
+ searchConfig?: ProSearchMap;
141
+ /** 是否拷贝 */
142
+ copyable?: boolean;
143
+ /** 值为空时,默认取值 */
144
+ columnEmptyText?: string;
145
+ };
146
+ export declare type ProColumns = ProColumn[];
147
+ export {};
@@ -0,0 +1,78 @@
1
+ import type { VNodeChild } from 'vue';
2
+ import type { TableRowSelection, TablePaginationConfig } from '../../../_utils';
3
+ export declare type ProTabelFeachParams = {
4
+ params?: any;
5
+ filters?: any;
6
+ sorter?: any;
7
+ pagination?: ProTablePagination | boolean;
8
+ removeKeys?: (string | number)[];
9
+ immediate?: boolean;
10
+ isPolling?: boolean;
11
+ };
12
+ export declare type ProFieldEmptyText = string | false;
13
+ export declare type ProTableRowSelection<T = any> = TableRowSelection<T> & {
14
+ defaultSelectKeys: (string | number)[];
15
+ defaultSelectRows: T[];
16
+ };
17
+ export declare type ProTablePaginationConfig = Omit<TablePaginationConfig, 'position'> & {
18
+ total?: number;
19
+ current: number;
20
+ pageSize: number;
21
+ position?: string;
22
+ };
23
+ export declare type ProTablePagination = ProTablePaginationConfig | false;
24
+ export declare type SortOrder = 'descend' | 'ascend' | null;
25
+ export declare type RequestData = {
26
+ data: any[] | undefined;
27
+ success?: boolean;
28
+ total?: number;
29
+ } & RecordType;
30
+ export declare type requsetConfig = (params: {
31
+ pageSize?: number;
32
+ current?: number;
33
+ keyword?: string;
34
+ }, sort: Record<string, SortOrder>, filter: Record<string, any[] | null>) => Promise<Partial<RequestData>>;
35
+ export declare type ColConfig = Partial<Record<Breakpoint, number>>;
36
+ export declare type SearchConfig = {
37
+ searchText?: string;
38
+ resetText?: string;
39
+ className?: string;
40
+ defaultCollapsed?: boolean;
41
+ showSearch?: boolean;
42
+ showReset?: boolean;
43
+ collapseRender?: WithFalse<(collapsed?: boolean) => CustomRender>;
44
+ span?: ColConfig;
45
+ };
46
+ export declare type OptionConfigSettings = {
47
+ draggable?: boolean;
48
+ checkable?: boolean;
49
+ checkedReset?: boolean;
50
+ extra?: VueNode;
51
+ };
52
+ export interface OptionConfig {
53
+ reload?: (() => VNodeChild | JSX.Element) | boolean;
54
+ density?: boolean;
55
+ setting?: boolean | OptionConfigSettings;
56
+ fullScreen?: (() => VNodeChild | JSX.Element) | boolean | (() => Promise<void>);
57
+ }
58
+ export declare type ProCoreActionTypeConfig = {
59
+ formParams?: RecordType;
60
+ pageParams?: RecordType | boolean;
61
+ /** @name 刷新 */
62
+ reload?: (info?: ProTabelFeachParams) => void;
63
+ /** @name 刷新并清空表单,重置为第一页 */
64
+ reloadAndRest?: () => void;
65
+ /** @name 设置翻页、排序、筛选*/
66
+ changePageInfo?: (pagination: ProTablePaginationConfig, filters: any, sorter: any) => void;
67
+ /** @name 更新TableData属性值 */
68
+ reSetDataList?: (data: RecordType[]) => void;
69
+ /** @name 更新TableData属性值 */
70
+ changeDataValue?: ({ key, value }: {
71
+ key?: string;
72
+ value: RecordType;
73
+ }) => void;
74
+ /** @name 改变loading状态 */
75
+ loadingOperation?: (loading: boolean) => void;
76
+ };
77
+ /** 操作类型 */
78
+ export declare type ProCoreActionType = ({ reload, reloadAndRest, changeDataValue, loadingOperation }: ProCoreActionTypeConfig) => void;
@@ -0,0 +1,6 @@
1
+ declare module 'vue' {
2
+ interface GlobalComponents {
3
+ ProTable: typeof import('gx-design-vue')['ProTable'];
4
+ }
5
+ }
6
+ export {};
@@ -0,0 +1,86 @@
1
+ import type { ProTablePagination } from '../types/table';
2
+ import type { AlignType } from '../_utils';
3
+ import type { ProSearchMap } from '../types/column';
4
+ import type { ProColumns } from '../types/column';
5
+ export declare const proTableSlots: string[];
6
+ /**
7
+ * 根据 key 和 dataIndex 生成唯一 id
8
+ *
9
+ * @param key 用户设置的 key
10
+ * @param dataIndex 在对象中的数据
11
+ * @param index 序列号,理论上唯一
12
+ */
13
+ export declare const genColumnKey: (key?: string | number | undefined, index?: number) => string;
14
+ export declare function handleShowIndex(columns: ProColumns, { align, showIndex }: {
15
+ align: AlignType;
16
+ showIndex: boolean;
17
+ }): ProColumns;
18
+ export declare function handleFormDefaultValue(data: ProSearchMap[]): any;
19
+ /**
20
+ * @Author gx12358
21
+ * @DateTime 2021/11/3
22
+ * @lastTime 2021/11/3
23
+ * @description 如果是个方法执行一下它
24
+ */
25
+ export declare function runFunction<T extends any[]>(valueEnum: any, ...rest: T): any;
26
+ /**
27
+ * @Author gx12358
28
+ * @DateTime 2022/10/11
29
+ * @lastTime 2022/10/11
30
+ * @description 简单深拷贝下
31
+ */
32
+ export declare function deepCopy(data: object | any[]): any;
33
+ /**
34
+ * @Author gx12358
35
+ * @DateTime 2021/1/28
36
+ * @lastTime 2021/1/28
37
+ * @description 判断删除是否到当前页最后一条
38
+ */
39
+ export declare function handleCurrentPage(pageConfig: {
40
+ current: number;
41
+ pageSize: number | undefined;
42
+ total: number | undefined;
43
+ } | undefined, number: number): number;
44
+ /**
45
+ * @Author gaoxiang
46
+ * @DateTime 2020/7/24
47
+ * @lastTime 2020/7/24
48
+ * @description 数组(树形)添加序号
49
+ */
50
+ export declare function getSortIndex(data?: any[], pageConfig?: ProTablePagination, childrenKey?: string): any;
51
+ /**
52
+ * @Author gaoxiang
53
+ * @DateTime 2019/11/29
54
+ * @lastTime 2019/11/29
55
+ * @description 排序(从小到大)
56
+ */
57
+ export declare function compareToMax(obj1: RecordType, obj2: RecordType, key: string): number;
58
+ /**
59
+ * @Author gaoxiang
60
+ * @DateTime 2019/12/11
61
+ * @lastTime 2019/12/11
62
+ * @description 数组去重
63
+ */
64
+ export declare function arrayRepeat(data: any[]): any;
65
+ /**
66
+ * @Author gaoxiang
67
+ * @DateTime 2020/8/26
68
+ * @lastTime 2020/8/26
69
+ * @description 处理表格字段为空
70
+ */
71
+ export declare function hanndleField(str: any, customize: any): {
72
+ value: any;
73
+ success: boolean;
74
+ };
75
+ /**
76
+ * @Author gaoxiang
77
+ * @DateTime 2019/11/29
78
+ * @lastTime 2019/11/29
79
+ * @description 随机uuid
80
+ */
81
+ export declare function getRandomNumber(): {
82
+ uuid(len?: number, rad?: number): any;
83
+ uuidFast(): string;
84
+ uuidString(): string;
85
+ uuidCompact(): string;
86
+ };
@@ -0,0 +1,25 @@
1
+ export declare function is(val: unknown, type: string): boolean;
2
+ export declare function isBoolean(val: unknown): val is boolean;
3
+ export declare function isNumber(val: unknown): boolean;
4
+ /**
5
+ * @author gx12358 2539306317@qq.com
6
+ * @description 判断是否是数组
7
+ * @param arg
8
+ * @returns {arg is any[]|boolean}
9
+ */
10
+ export declare function isArray(arg: unknown): boolean;
11
+ /**
12
+ * @Author gaoxiang
13
+ * @DateTime 2019/11/29
14
+ * @lastTime 2019/11/29
15
+ * @description 是否是对象
16
+ */
17
+ export declare function isObject(val: any): val is Record<any, any>;
18
+ /**
19
+ * @author gx12358 2539306317@qq.com
20
+ * @description 判断是否是字符串
21
+ * @param value
22
+ * @returns {boolean}
23
+ */
24
+ export declare function isString(value: unknown): boolean;
25
+ export declare function isFunction(func: any): boolean;
package/package.json ADDED
@@ -0,0 +1,74 @@
1
+ {
2
+ "name": "@gx-design-vue/pro-table",
3
+ "version": "0.0.1",
4
+ "scripts": {
5
+ "dev": "vite",
6
+ "build": "vue-tsc --noEmit && vite build",
7
+ "types": "vue-tsc --declaration --emitDeclarationOnly",
8
+ "preview": "vite preview --port 5050",
9
+ "test:unit": "vitest --environment jsdom",
10
+ "typecheck": "vue-tsc --noEmit && vue-tsc --noEmit -p tsconfig.vitest.json --composite false",
11
+ "lint": "TIMING=1 eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
12
+ },
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "types": "./dist",
17
+ "style": "./dist/style.css",
18
+ "main": "./dist/pro-table.umd.js",
19
+ "module": "./dist/pro-table.es.js",
20
+ "exports": {
21
+ ".": {
22
+ "import": "./dist/pro-table.es.js",
23
+ "require": "./dist/pro-table.umd.js"
24
+ },
25
+ "./dist/style.css": "./dist/style.css",
26
+ "./dist/style.less": "./dist/style.less"
27
+ },
28
+ "dependencies": {
29
+ "@vueuse/core": "^9.3.1",
30
+ "ant-design-vue": "3.2.13",
31
+ "dayjs": "^1.11.0",
32
+ "lodash-es": "^4.17.21",
33
+ "vite-plugin-dts": "^1.6.6",
34
+ "vue": "3.2.39",
35
+ "vue-router": "^4.0.14",
36
+ "vue-types": "^4.1.1"
37
+ },
38
+ "devDependencies": {
39
+ "@shared/vite-plugin-less-copy": "workspace:^0.0.0",
40
+ "@rollup/plugin-typescript": "^8.3.0",
41
+ "@rushstack/eslint-patch": "^1.1.0",
42
+ "@types/lodash-es": "^4.17.6",
43
+ "@types/jsdom": "^16.2.14",
44
+ "@types/node": "^16.11.26",
45
+ "@vitejs/plugin-vue": "3.1.0",
46
+ "@vitejs/plugin-vue-jsx": "2.0.1",
47
+ "@vue/eslint-config-prettier": "^7.0.0",
48
+ "@vue/eslint-config-typescript": "^10.0.0",
49
+ "@vue/test-utils": "^2.0.0-rc.18",
50
+ "@vue/tsconfig": "^0.1.3",
51
+ "eslint": "^8.13.0",
52
+ "eslint-plugin-prettier": "^4.0.0",
53
+ "eslint-plugin-vue": "^8.6.0",
54
+ "jsdom": "^19.0.0",
55
+ "less": "^4.1.2",
56
+ "postcss": "^8.4.12",
57
+ "postcss-html": "^1.4.1",
58
+ "postcss-less": "^6.0.0",
59
+ "prettier": "^2.6.2",
60
+ "rollup": "^2.70.2",
61
+ "stylelint": "^14.7.1",
62
+ "stylelint-config-prettier": "^9.0.3",
63
+ "stylelint-config-recommended": "^7.0.0",
64
+ "stylelint-config-recommended-vue": "^1.4.0",
65
+ "stylelint-config-standard": "^25.0.0",
66
+ "stylelint-order": "^5.0.0",
67
+ "typescript": "^4.6.4",
68
+ "vite": "3.1.3",
69
+ "vite-plugin-windicss": "1.8.7",
70
+ "vue-eslint-parser": "9.0.3",
71
+ "vue-tsc": "0.39.4"
72
+ },
73
+ "description": "Gx Design"
74
+ }