@gx-design-vue/pro-table 0.2.0-beta.5 → 0.2.0-beta.50

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 (39) hide show
  1. package/dist/ProTable.d.ts +327 -563
  2. package/dist/_utils/ant-design-vue/index.d.ts +2 -0
  3. package/dist/_utils/ant-design-vue/input/typings.d.ts +1 -0
  4. package/dist/_utils/ant-design-vue/spin/typings.d.ts +1 -0
  5. package/dist/_utils/ant-design-vue/table/props.d.ts +183 -2
  6. package/dist/_utils/ant-design-vue/table/typings.d.ts +4 -3
  7. package/dist/_utils/ant-design-vue/tooltip/typings.d.ts +1 -0
  8. package/dist/_utils/index.d.ts +0 -1
  9. package/dist/components/ColumnSetting/index.d.ts +12 -12
  10. package/dist/components/ColumnSetting/style.d.ts +2 -5
  11. package/dist/components/Form/index.d.ts +14 -13
  12. package/dist/components/Form/style.d.ts +2 -5
  13. package/dist/components/ListToolBar/index.d.ts +14 -14
  14. package/dist/components/ListToolBar/style.d.ts +2 -5
  15. package/dist/components/ToolBar/FullscreenIcon.d.ts +1 -2
  16. package/dist/components/ToolBar/index.d.ts +18 -18
  17. package/dist/context/TableContext.d.ts +5 -6
  18. package/dist/hooks/useColums.d.ts +5 -5
  19. package/dist/hooks/useFetchData.d.ts +10 -8
  20. package/dist/hooks/useLoading.d.ts +3 -11
  21. package/dist/hooks/usePagination.d.ts +2 -2
  22. package/dist/hooks/useRowSelection.d.ts +2 -1
  23. package/dist/hooks/useTable.d.ts +9 -4
  24. package/dist/hooks/useTableForm.d.ts +4 -3
  25. package/dist/hooks/useTableScroll.d.ts +6 -6
  26. package/dist/hooks/useTableSize.d.ts +1 -1
  27. package/dist/index.d.ts +1 -1
  28. package/dist/pro-table.js +2756 -0
  29. package/dist/pro-table.umd.cjs +1 -0
  30. package/dist/props.d.ts +135 -265
  31. package/dist/style.d.ts +2 -6
  32. package/dist/types/ColumnTypings.d.ts +1 -1
  33. package/dist/types/SlotsTypings.d.ts +1 -1
  34. package/dist/types/TableTypings.d.ts +43 -28
  35. package/dist/utils/utils.d.ts +3 -1
  36. package/package.json +20 -42
  37. package/dist/_utils/typings.d.ts +0 -9
  38. package/dist/pro-table.mjs +0 -32740
  39. package/dist/pro-table.umd.js +0 -328
package/dist/style.d.ts CHANGED
@@ -1,7 +1,3 @@
1
+ import type { GenerateStyle } from 'ant-design-vue/es/theme/internal';
1
2
  import type { ProAliasToken } from '@gx-design-vue/pro-provider';
2
- export interface ProToken extends ProAliasToken {
3
- antCls: string;
4
- componentCls: string;
5
- }
6
- declare const _default: (_prefixCls?: string | import("vue").Ref<string> | undefined) => import("ant-design-vue/es/theme/internal").UseComponentStyleResult;
7
- export default _default;
3
+ export declare const genProTabelStyle: GenerateStyle<ProAliasToken>;
@@ -55,7 +55,7 @@ export type ProSearchMap<ValueType = 'text'> = {
55
55
  initialValue?: any;
56
56
  /** 针对select、treeselect取值的key */
57
57
  valueKey?: string;
58
- /** 表单的属性值(ant-design)*/
58
+ /** 表单的属性值(ant-design) */
59
59
  field?: RecordType;
60
60
  /**
61
61
  * 支持 object 和Map,Map 是支持其他基础类型作为 key
@@ -9,4 +9,4 @@ export type PageItemRender = WithFalse<(opt: {
9
9
  type: 'page' | 'prev' | 'next' | 'jump-prev' | 'jump-next';
10
10
  originalElement: any;
11
11
  }) => CustomRender>;
12
- export type CustomizeRender = WithFalse<(dataSource: any[]) => CustomRender>;
12
+ export type CustomizeRender = WithFalse<(currenData: any[], dataSource: any[]) => CustomRender>;
@@ -1,19 +1,20 @@
1
- import type { CSSProperties } from 'vue';
2
- import type { RecordType, WithFalse, CustomRender, VueNode, SizeType, Breakpoint } from '@gx-design-vue/pro-utils';
3
- import type { ProSearchMap, ProColumnType, ProColumnsType } from './ColumnTypings';
4
- import type { DefaultRecordType } from '../typing';
5
- import type { HeaderTitleRender, ToolBarBtnRender, CustomizeRender, TitleTipRender, OptionsExtraRender, SettingExtraRender, PageItemRender } from './SlotsTypings';
6
- import type { TableRowSelection, TablePaginationConfig, SpinProps, TableFilters, TableSorter, TableProps } from '../_utils';
1
+ import type { CSSProperties, ComputedRef } from 'vue';
2
+ import type { Breakpoint, CustomRender, RecordType, SizeType, VueNode, WithFalse } from '@gx-design-vue/pro-utils';
3
+ import type { ProColumnType, ProColumnsType, ProSearchMap } from './ColumnTypings';
4
+ import type { CustomizeRender, HeaderTitleRender, OptionsExtraRender, PageItemRender, SettingExtraRender, TitleTipRender, ToolBarBtnRender } from './SlotsTypings';
5
+ import type { FilterValue, SorterResult, TableCurrentDataSource, TablePaginationConfig, TableProps, TableRowSelection } from '../_utils';
7
6
  import type { ColumnSettingProps } from '../components/ColumnSetting';
8
7
  import type { ColumnsState, ColumnsStateType } from '../hooks/useColumnSetting';
9
8
  export type ProTabelFeachParams = {
10
9
  params?: any;
11
- filters?: TableFilters;
12
- sorter?: TableSorter;
10
+ filters?: Record<string, FilterValue | null>;
11
+ sorter?: SorterResult | SorterResult[];
13
12
  pagination?: ProTablePagination;
14
13
  removeKeys?: (string | number)[];
15
14
  immediate?: boolean;
16
15
  isPolling?: boolean;
16
+ showLoading?: boolean;
17
+ extra?: TableCurrentDataSource;
17
18
  };
18
19
  export type TablePaginationPosition = 'topLeft' | 'topCenter' | 'topRight' | 'bottomLeft' | 'bottomCenter' | 'bottomRight';
19
20
  export type ProFieldEmptyText = string | false;
@@ -25,20 +26,25 @@ export interface ProTablePaginationConfig extends Omit<TablePaginationConfig, 'p
25
26
  position?: TablePaginationPosition[];
26
27
  }
27
28
  export type ProTablePagination = ProTablePaginationConfig | false;
29
+ export type DefaultParams = {
30
+ pageSize: number;
31
+ pageNum: number;
32
+ };
28
33
  export type RequestData<T = any> = {
29
34
  data: T[] | undefined;
30
35
  success: boolean;
31
36
  total: number;
32
- } & RecordType;
33
- export type RequsetConfig = {
34
- params: {
35
- pageSize?: number;
36
- pageNum?: number;
37
- };
38
- sort: TableSorter;
39
- filter: TableFilters;
40
37
  };
41
- export type RequsetFunction<T = any> = (params: RequsetConfig['params'], sort: RequsetConfig['sort'], filter: RequsetConfig['filter']) => Promise<Partial<RequestData<T>>>;
38
+ export type RequsetConfig<T> = {
39
+ params: T extends undefined ? DefaultParams : {
40
+ pageSize: number;
41
+ pageNum: number;
42
+ } & Partial<T>;
43
+ sort: SorterResult | SorterResult[];
44
+ filter: Record<string, FilterValue | null>;
45
+ extra: TableCurrentDataSource;
46
+ };
47
+ export type RequsetFunction<T = any, D = undefined> = (params: RequsetConfig<D>['params'], sort: RequsetConfig<D>['sort'], filter: RequsetConfig<D>['filter']) => Promise<Partial<RequestData<T>>>;
42
48
  export type ColConfig = Partial<Record<Breakpoint, number>>;
43
49
  export type SearchConfig = {
44
50
  searchText?: string;
@@ -58,20 +64,27 @@ export interface OptionConfig {
58
64
  }
59
65
  /** action表格实例 */
60
66
  export interface ProCoreActionType {
67
+ /** @name loadingStatus */
68
+ getLoadingStatus?: () => boolean;
69
+ dataSource?: any;
61
70
  pageParams?: RecordType | boolean;
62
- getLoadingStatus?: boolean | SpinProps | undefined;
71
+ selectedKey?: (string | number)[];
72
+ selectedItem?: RecordType[];
63
73
  /** @name 刷新 */
64
74
  reload?: (info?: ProTabelFeachParams) => void;
65
75
  /** @name 刷新并清空表单,重置为第一页 */
66
76
  reloadAndRest?: (callBack?: () => void) => void;
67
- /** @name 设置翻页、排序、筛选*/
68
- changePageInfo?: (pagination: ProTablePaginationConfig, filters: any, sorter: any) => void;
77
+ /** @name 设置翻页 */
78
+ setPagination?: (pagination: ProTablePaginationConfig) => void;
79
+ /** @name 设置翻页、排序、筛选、并且reload */
80
+ setPageAndReload?: (pagination: ProTablePaginationConfig, filters?: Record<string, FilterValue | null>, sorter?: SorterResult | SorterResult[], extra?: TableCurrentDataSource) => void;
69
81
  /** @name 更新TableData属性值 */
70
82
  reSetDataList?: (data: RecordType[]) => void;
71
83
  /** @name 更新TableData属性值 */
72
- changeDataValue?: ({ key, params }: {
84
+ changeDataValue?: ({ key, params, type }: {
73
85
  key?: string;
74
86
  params: RecordType;
87
+ type?: 'update' | 'add' | 'delete';
75
88
  }) => void;
76
89
  /** @name 改变loading状态 */
77
90
  loadingOperation?: (loading: boolean) => void;
@@ -79,23 +92,25 @@ export interface ProCoreActionType {
79
92
  /** form查询表单实例 */
80
93
  export interface ProCoreFormType {
81
94
  /** @name 获取表格-表单请求参数 */
82
- formParams?: RecordType;
95
+ getTableFormState?: () => RecordType;
83
96
  /** @name 获取表格-内部表单参数 */
84
97
  getFormState?: () => RecordType;
85
98
  /** @name 重置内部表单组件参数 */
86
99
  restForm?: (callBack?: () => void) => void;
87
100
  }
88
101
  export interface ProTableRef {
102
+ loading: ComputedRef<boolean>;
89
103
  formRef: () => ProCoreFormType;
90
104
  actionRef: () => ProCoreActionType;
91
105
  }
92
- export type ProTableProps<RecordType extends DefaultRecordType = DefaultRecordType> = Omit<TableProps<RecordType>, 'columns'> & Partial<{
106
+ export type ProTableProps<RecordType = any, ParamsType = Record<string, any>> = Omit<TableProps<RecordType>, 'columns'> & Partial<{
93
107
  tableClassName: string;
94
108
  tableStyle: CSSProperties;
95
109
  rowKey: string;
96
110
  titleTipText: string;
97
111
  autoScroll: boolean;
98
112
  columnEmptyText: ProFieldEmptyText;
113
+ showLoading: boolean;
99
114
  neverScroll: boolean;
100
115
  modalScroll: boolean;
101
116
  scrollBreakpoint: Breakpoint | number;
@@ -113,14 +128,14 @@ export type ProTableProps<RecordType extends DefaultRecordType = DefaultRecordTy
113
128
  polling: number;
114
129
  debounceTime: number;
115
130
  request: RequsetFunction<RecordType>;
116
- params: Record<string, unknown>;
131
+ params: ParamsType;
117
132
  postData: (data: any[]) => any;
118
133
  pagination: ProTablePagination;
119
- search: SearchConfig;
134
+ search: SearchConfig | boolean;
120
135
  searchMap: ProSearchMap[];
121
- onReset: (params?: Partial<Record<string, any>>) => any;
122
- onReload: (params?: Partial<Record<string, any>>) => any;
123
- onSubmit: (params?: Partial<Record<string, any>>) => any;
136
+ onReset: (params?: Partial<ParamsType>) => any;
137
+ onReload: (params?: Partial<ParamsType>) => any;
138
+ onSubmit: (params?: Partial<ParamsType>) => any;
124
139
  onSizeChange: (size: string) => any;
125
140
  onLoadingChange: (loading: boolean) => any;
126
141
  onRequestError: (e: Error) => void;
@@ -1,2 +1,4 @@
1
1
  import type { ProColumnsValueType } from '../types/ColumnTypings';
2
- export declare function valueFormat(value: any, format: ProColumnsValueType | undefined, className: string): any;
2
+ import type { ProTablePagination } from '../types/TableTypings';
3
+ export declare function valueFormat(value: any, format: ProColumnsValueType | undefined, className: string, hashId: string): any;
4
+ export declare function getCuurentData(data: any[], pageInfo: ProTablePagination): any[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gx-design-vue/pro-table",
3
- "version": "0.2.0-beta.5",
3
+ "version": "0.2.0-beta.50",
4
4
  "scripts": {
5
5
  "dev": "vite",
6
6
  "build": "vite build",
@@ -14,57 +14,35 @@
14
14
  "dist",
15
15
  "volar.d.ts"
16
16
  ],
17
+ "type": "module",
17
18
  "types": "./dist",
18
- "main": "./dist/pro-table.umd.js",
19
- "module": "./dist/pro-table.mjs",
19
+ "main": "./dist/pro-table.umd.cjs",
20
+ "module": "./dist/pro-table.js",
20
21
  "exports": {
21
22
  ".": {
22
- "import": "./dist/pro-table.mjs",
23
- "require": "./dist/pro-table.umd.js"
23
+ "import": "./dist/pro-table.js",
24
+ "require": "./dist/pro-table.umd.cjs"
24
25
  }
25
26
  },
26
27
  "dependencies": {
27
28
  "@vueuse/core": "^9.10.0",
28
- "@gx-design-vue/pro-utils": "^0.2.0-beta.5",
29
- "@gx-design-vue/pro-hooks": "^0.2.0-beta.3",
30
- "@gx-design-vue/pro-provider": "^0.1.0-beta.13",
31
- "ant-design-vue": "^4.0.0",
29
+ "@gx-design-vue/pro-utils": "^0.2.0-beta.35",
30
+ "@gx-design-vue/pro-hooks": "^0.2.0-beta.27",
31
+ "@gx-design-vue/pro-provider": "^0.1.0-beta.80",
32
+ "@gx-design-vue/pro-app": "^0.1.0-beta.12",
32
33
  "dayjs": "^1.11.0",
33
- "lodash-es": "^4.17.21",
34
- "vue": "^3.2.45",
35
- "vue-types": "^4.1.1"
34
+ "lodash-es": "^4.17.21"
36
35
  },
37
36
  "devDependencies": {
38
- "@rollup/plugin-typescript": "^8.3.0",
39
- "@rushstack/eslint-patch": "^1.1.0",
40
37
  "@types/lodash-es": "^4.17.6",
41
- "@types/jsdom": "^16.2.14",
42
- "@types/node": "^16.11.26",
43
- "@vitejs/plugin-vue": "^4.2.3",
44
- "@vitejs/plugin-vue-jsx": "^3.0.1",
45
- "@vue/eslint-config-prettier": "^7.0.0",
46
- "@vue/eslint-config-typescript": "^10.0.0",
47
- "@vue/tsconfig": "^0.1.3",
48
- "eslint": "^8.13.0",
49
- "eslint-plugin-prettier": "^4.0.0",
50
- "eslint-plugin-vue": "^8.6.0",
51
- "jsdom": "^19.0.0",
52
- "less": "^4.1.2",
53
- "postcss": "^8.4.12",
54
- "postcss-html": "^1.4.1",
55
- "postcss-less": "^6.0.0",
56
- "prettier": "^2.6.2",
57
- "rollup": "^2.70.2",
58
- "stylelint": "^14.7.1",
59
- "stylelint-config-prettier": "^9.0.3",
60
- "stylelint-config-recommended": "^7.0.0",
61
- "stylelint-config-recommended-vue": "^1.4.0",
62
- "stylelint-config-standard": "^25.0.0",
63
- "stylelint-order": "^5.0.0",
64
- "typescript": "^4.6.4",
65
- "vite": "^4.3.8",
66
- "vue-eslint-parser": "^9.0.3",
67
- "vue-tsc": "^1.0.24"
38
+ "typescript": "^5.3.3"
68
39
  },
69
- "description": "Gx Design"
40
+ "peerDependencies": {
41
+ "vue": ">=3.0.0",
42
+ "ant-design-vue": "^4.1.2"
43
+ },
44
+ "description": "Gx Design Pro Table",
45
+ "authors": [
46
+ "gx12358 <gx12358@gmail.com> (https://github.com/gx12358)"
47
+ ]
70
48
  }
@@ -1,9 +0,0 @@
1
- export type SpinProps = {
2
- prefixCls?: string;
3
- spinning?: boolean;
4
- size?: 'small' | 'default' | 'large';
5
- wrapperClassName?: string;
6
- tip?: string;
7
- delay?: number;
8
- indicator?: any;
9
- };