@gx-design-vue/pro-table 0.0.2 → 0.0.3-rc.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.
Files changed (48) hide show
  1. package/dist/ProTable.d.ts +95 -95
  2. package/dist/_utils/ant-design-vue/table/props.d.ts +2 -1
  3. package/dist/_utils/ant-design-vue/table/typings.d.ts +1 -0
  4. package/dist/_utils/index.d.ts +0 -1
  5. package/dist/components/ColumnSetting/index.d.ts +1 -0
  6. package/dist/components/ColumnSetting/style.less +1 -3
  7. package/dist/components/Form/index.d.ts +1 -0
  8. package/dist/components/Form/style.less +1 -8
  9. package/dist/components/Form/useForm.d.ts +1 -0
  10. package/dist/components/ListToolBar/index.d.ts +13 -12
  11. package/dist/components/ListToolBar/style.less +1 -0
  12. package/dist/components/ToolBar/index.d.ts +1 -0
  13. package/dist/components/ToolBar/style.less +5 -29
  14. package/dist/context/TableContext.d.ts +2 -1
  15. package/dist/design/ant-design-theme.less +4 -0
  16. package/dist/design/ant-design-vue.less +19 -0
  17. package/dist/design/config.less +0 -5
  18. package/dist/hooks/useDebounceFn.d.ts +1 -5
  19. package/dist/hooks/useFetchData.d.ts +6 -4
  20. package/dist/hooks/useLoading.d.ts +1 -1
  21. package/dist/hooks/useRowSelection.d.ts +2 -0
  22. package/dist/hooks/useTableForm.d.ts +1 -0
  23. package/dist/hooks/useTableScroll.d.ts +1 -0
  24. package/dist/hooks/useTableSize.d.ts +1 -1
  25. package/dist/index.d.ts +7 -1
  26. package/dist/pro-table.less +5 -0
  27. package/dist/pro-table.mjs +1178 -1251
  28. package/dist/pro-table.umd.js +1 -1
  29. package/dist/props.d.ts +40 -22
  30. package/dist/style/index.less +18 -0
  31. package/dist/style/table.less +0 -8
  32. package/dist/style.css +1 -1
  33. package/dist/style.less +3 -5
  34. package/dist/types/column.d.ts +11 -3
  35. package/dist/types/table.d.ts +30 -19
  36. package/dist/typing.d.ts +9 -0
  37. package/dist/utils/config.d.ts +1 -0
  38. package/dist/utils/utils.d.ts +2 -0
  39. package/package.json +11 -12
  40. package/dist/_utils/gx-design-vue/extract-public-props.d.ts +0 -7
  41. package/dist/_utils/gx-design-vue/index.d.ts +0 -2
  42. package/dist/_utils/gx-design-vue/typings.d.ts +0 -1
  43. package/dist/hooks/core/index.d.ts +0 -3
  44. package/dist/hooks/core/useMemo.d.ts +0 -10
  45. package/dist/hooks/core/useTimeout.d.ts +0 -11
  46. package/dist/typings/components.d.ts +0 -6
  47. package/dist/utils/index.d.ts +0 -86
  48. package/dist/utils/validate.d.ts +0 -25
package/dist/style.less CHANGED
@@ -1,5 +1,3 @@
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';
1
+ @import './design/ant-design-theme.less';
2
+ @import './design/ant-design-vue.less';
3
+ @import './pro-table.less';
@@ -1,6 +1,7 @@
1
1
  import type { VNodeChild } from 'vue';
2
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';
3
+ import type { RecordType, VueNode, Breakpoint } from '../typing';
4
+ import type { ColumnFilterItem, ColumnTitle, CompareFn, FilterDropdownProps, FilterValue, Key, SortOrder, AlignType, CellEllipsisType, DataIndex, FixedType, GetComponentProps, RenderedCell } from '../_utils';
4
5
  /**
5
6
  * @param text 文本框
6
7
  * @param date 日期 YYYY-MM-DD
@@ -18,7 +19,7 @@ export declare type ProFieldValueType = 'text' | 'date' | 'select' | 'treeSelect
18
19
  * @param time: 时间 HH:mm:ss
19
20
  * @param select 下拉选择器
20
21
  */
21
- export declare type ProFieldValueFormat = 'data' | 'dateMonth' | 'dateRange' | 'dateMonth' | 'time';
22
+ export declare type ProFieldValueFormat = 'data' | 'dateMonth' | 'dateRange' | 'time';
22
23
  export declare type ProSchemaValueEnumType = {
23
24
  /** @name 演示的文案 */
24
25
  text: VNodeChild | JSX.Element;
@@ -33,7 +34,7 @@ export declare type ProSearchMap<ValueType = 'text', ValueFormat = 'date'> = {
33
34
  name?: string;
34
35
  /** 选择如何渲染相应的模式 */
35
36
  valueType?: ProSchemaValueType<ValueType>;
36
- ValueFormat?: ProSchemaValueFormat<ValueFormat>;
37
+ valueFormat?: ProSchemaValueFormat<ValueFormat>;
37
38
  placeholder?: string | string[];
38
39
  /** valueType为select生效 */
39
40
  allowClear?: boolean;
@@ -142,6 +143,13 @@ export declare type ProColumn = {
142
143
  copyable?: boolean;
143
144
  /** 值为空时,默认取值 */
144
145
  columnEmptyText?: string;
146
+ valueType?: ProColumnsValueType;
147
+ };
148
+ export declare type ProColumnsValueType = 'text' | 'link' | 'time' | 'dateMonth' | 'dateTime' | {
149
+ node?: string;
150
+ class?: string;
151
+ attr?: string;
152
+ click?: () => void;
145
153
  };
146
154
  export declare type ProColumns = ProColumn[];
147
155
  export {};
@@ -1,5 +1,6 @@
1
1
  import type { VNodeChild } from 'vue';
2
- import type { TableRowSelection, TablePaginationConfig } from '../../../_utils';
2
+ import type { RecordType, VueNode, Breakpoint, WithFalse, CustomRender } from '../typing';
3
+ import type { TableRowSelection, TablePaginationConfig, SpinProps } from '../_utils';
3
4
  export declare type ProTabelFeachParams = {
4
5
  params?: any;
5
6
  filters?: any;
@@ -9,29 +10,32 @@ export declare type ProTabelFeachParams = {
9
10
  immediate?: boolean;
10
11
  isPolling?: boolean;
11
12
  };
13
+ export declare type TablePaginationPosition = 'topLeft' | 'topCenter' | 'topRight' | 'bottomLeft' | 'bottomCenter' | 'bottomRight';
12
14
  export declare type ProFieldEmptyText = string | false;
13
15
  export declare type ProTableRowSelection<T = any> = TableRowSelection<T> & {
14
16
  defaultSelectKeys: (string | number)[];
15
17
  defaultSelectRows: T[];
16
18
  };
17
- export declare type ProTablePaginationConfig = Omit<TablePaginationConfig, 'position'> & {
19
+ export interface ProTablePaginationConfig extends Omit<TablePaginationConfig, 'position'> {
18
20
  total?: number;
19
- current: number;
20
- pageSize: number;
21
- position?: string;
22
- };
21
+ position?: TablePaginationPosition[];
22
+ }
23
23
  export declare type ProTablePagination = ProTablePaginationConfig | false;
24
24
  export declare type SortOrder = 'descend' | 'ascend' | null;
25
- export declare type RequestData = {
26
- data: any[] | undefined;
27
- success?: boolean;
28
- total?: number;
25
+ export declare type RequestData<T = any> = {
26
+ data: T[] | undefined;
27
+ success: boolean;
28
+ total: number;
29
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>>;
30
+ export declare type RequsetConfig = {
31
+ params: {
32
+ pageSize?: number;
33
+ pageNum?: number;
34
+ };
35
+ sort: Record<string, SortOrder>;
36
+ filter: Record<string, any[] | null>;
37
+ };
38
+ export declare type RequsetFunction<T = any> = (params: RequsetConfig['params'], sort: RequsetConfig['sort'], filter: RequsetConfig['filter']) => Promise<Partial<RequestData<T>>>;
35
39
  export declare type ColConfig = Partial<Record<Breakpoint, number>>;
36
40
  export declare type SearchConfig = {
37
41
  searchText?: string;
@@ -56,8 +60,8 @@ export interface OptionConfig {
56
60
  fullScreen?: (() => VNodeChild | JSX.Element) | boolean | (() => Promise<void>);
57
61
  }
58
62
  export declare type ProCoreActionTypeConfig = {
59
- formParams?: RecordType;
60
63
  pageParams?: RecordType | boolean;
64
+ getLoadingStatus?: boolean | SpinProps | undefined;
61
65
  /** @name 刷新 */
62
66
  reload?: (info?: ProTabelFeachParams) => void;
63
67
  /** @name 刷新并清空表单,重置为第一页 */
@@ -67,12 +71,19 @@ export declare type ProCoreActionTypeConfig = {
67
71
  /** @name 更新TableData属性值 */
68
72
  reSetDataList?: (data: RecordType[]) => void;
69
73
  /** @name 更新TableData属性值 */
70
- changeDataValue?: ({ key, value }: {
74
+ changeDataValue?: ({ key, params }: {
71
75
  key?: string;
72
- value: RecordType;
76
+ params: RecordType;
73
77
  }) => void;
74
78
  /** @name 改变loading状态 */
75
79
  loadingOperation?: (loading: boolean) => void;
76
80
  };
77
81
  /** 操作类型 */
78
- export declare type ProCoreActionType = ({ reload, reloadAndRest, changeDataValue, loadingOperation }: ProCoreActionTypeConfig) => void;
82
+ export declare type ProCoreActionType = (config: ProCoreActionTypeConfig) => void;
83
+ export declare type ProCoreFormTypeConfig = {
84
+ formParams?: RecordType;
85
+ /** @name 刷新 */
86
+ restForm?: () => void;
87
+ };
88
+ /** 操作类型 */
89
+ export declare type ProCoreFormType = (config: ProCoreFormTypeConfig) => void;
@@ -0,0 +1,9 @@
1
+ import type { Slot, VNode, VNodeChild, PropType as VuePropType } from 'vue';
2
+ export declare type SizeType = 'small' | 'middle' | 'large' | undefined;
3
+ export declare type WithFalse<T> = T | false;
4
+ export declare type RecordType = Record<string, any>;
5
+ export declare type PropType<T> = VuePropType<T>;
6
+ export declare type VueNode = VNodeChild | JSX.Element;
7
+ export declare type Breakpoint = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs';
8
+ export declare type ProVueNode = VueNode | VueNode[] | WithFalse<() => CustomRender>;
9
+ export declare type CustomRender = Slot | VNodeChild | VNode | ((...props: any[]) => Slot) | ((...props: any[]) => VNode) | ((...args: any[]) => VNode) | VNode[] | JSX.Element | string | null | undefined;
@@ -0,0 +1 @@
1
+ export declare const proTableSlots: string[];
@@ -0,0 +1,2 @@
1
+ import type { ProColumnsValueType } from '../types/column';
2
+ export declare function valueFormat(value: any, format: ProColumnsValueType | undefined, className: string): any;
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@gx-design-vue/pro-table",
3
- "version": "0.0.2",
3
+ "version": "0.0.3-rc.2",
4
4
  "scripts": {
5
5
  "dev": "vite",
6
- "build": "vue-tsc --noEmit && vite build",
6
+ "build": "vite build",
7
7
  "types": "vue-tsc --declaration --emitDeclarationOnly",
8
8
  "preview": "vite preview --port 5050",
9
9
  "test:unit": "vitest --environment jsdom",
@@ -26,13 +26,13 @@
26
26
  "./dist/style.less": "./dist/style.less"
27
27
  },
28
28
  "dependencies": {
29
- "@vueuse/core": "^9.3.1",
30
- "ant-design-vue": "3.2.13",
29
+ "@vueuse/core": "^6.8.0",
30
+ "@gx-design-vue/pro-utils": "0.0.5-rc.04",
31
+ "@gx-design-vue/pro-hooks": "0.0.1-rc.05",
32
+ "ant-design-vue": "^3.2.15",
31
33
  "dayjs": "^1.11.0",
32
34
  "lodash-es": "^4.17.21",
33
- "vite-plugin-dts": "^1.6.6",
34
- "vue": "3.2.39",
35
- "vue-router": "^4.0.14",
35
+ "vue": "^3.0.0",
36
36
  "vue-types": "^4.1.1"
37
37
  },
38
38
  "devDependencies": {
@@ -42,8 +42,8 @@
42
42
  "@types/lodash-es": "^4.17.6",
43
43
  "@types/jsdom": "^16.2.14",
44
44
  "@types/node": "^16.11.26",
45
- "@vitejs/plugin-vue": "3.1.0",
46
- "@vitejs/plugin-vue-jsx": "2.0.1",
45
+ "@vitejs/plugin-vue": "^3.1.0",
46
+ "@vitejs/plugin-vue-jsx": "^2.0.1",
47
47
  "@vue/eslint-config-prettier": "^7.0.0",
48
48
  "@vue/eslint-config-typescript": "^10.0.0",
49
49
  "@vue/test-utils": "^2.0.0-rc.18",
@@ -65,9 +65,8 @@
65
65
  "stylelint-config-standard": "^25.0.0",
66
66
  "stylelint-order": "^5.0.0",
67
67
  "typescript": "^4.6.4",
68
- "vite": "3.1.3",
69
- "vite-plugin-windicss": "1.8.7",
70
- "vue-eslint-parser": "9.0.3",
68
+ "vite": "^3.1.3",
69
+ "vue-eslint-parser": "^9.0.3",
71
70
  "vue-tsc": "0.39.4"
72
71
  },
73
72
  "description": "Gx Design"
@@ -1,7 +0,0 @@
1
- import type { ExtractPropTypes } from 'vue';
2
- declare type RemoveReadonly<T> = {
3
- -readonly [key in keyof T]: T[key];
4
- };
5
- export declare type ExtractPublicPropTypes<T> = Omit<Partial<RemoveReadonly<ExtractPropTypes<T>>>, Extract<keyof T, `internal${string}`>>;
6
- export declare type ExtractInternalPropTypes<T> = Partial<ExtractPropTypes<T>>;
7
- export {};
@@ -1,2 +0,0 @@
1
- export * from './typings';
2
- export * from './extract-public-props';
@@ -1 +0,0 @@
1
- export declare type SizeType = 'small' | 'middle' | 'large' | undefined;
@@ -1,3 +0,0 @@
1
- import useMemo from './useMemo';
2
- export * from './useTimeout';
3
- export { useMemo };
@@ -1,10 +0,0 @@
1
- import type { ComputedRef, WritableComputedRef } from 'vue';
2
- declare type MemoGetter<T> = () => T;
3
- declare type MemoSetter<T> = (v: T) => void;
4
- interface WritableMemoOptions<T> {
5
- get: MemoGetter<T>;
6
- set: MemoSetter<T>;
7
- }
8
- declare function useMemo<T>(getter: MemoGetter<T>): ComputedRef<T>;
9
- declare function useMemo<T>(options: WritableMemoOptions<T>): WritableComputedRef<T>;
10
- export default useMemo;
@@ -1,11 +0,0 @@
1
- export declare function tryOnUnmounted(fn: Fn): void;
2
- export declare function useTimeoutFn(handle: Fn<any>, wait: number, native?: boolean): {
3
- readyRef: import("vue").Ref<boolean>;
4
- stop: () => void;
5
- start: () => void;
6
- };
7
- export declare function useTimeoutRef(wait: number): {
8
- readyRef: import("vue").Ref<boolean>;
9
- stop: () => void;
10
- start: () => void;
11
- };
@@ -1,6 +0,0 @@
1
- declare module 'vue' {
2
- interface GlobalComponents {
3
- ProTable: typeof import('gx-design-vue')['ProTable'];
4
- }
5
- }
6
- export {};
@@ -1,86 +0,0 @@
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
- };
@@ -1,25 +0,0 @@
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;