@gx-design-vue/pro-table 0.2.0-beta.12 → 0.2.0-beta.120

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 +236 -779
  2. package/dist/_utils/ant-design-vue/index.d.ts +4 -2
  3. package/dist/_utils/ant-design-vue/input/typings.d.ts +1 -0
  4. package/dist/_utils/ant-design-vue/table/props.d.ts +33 -2
  5. package/dist/_utils/ant-design-vue/table/typings.d.ts +6 -5
  6. package/dist/_utils/ant-design-vue/tooltip/typings.d.ts +1 -0
  7. package/dist/_utils/index.d.ts +1 -1
  8. package/dist/components/ColumnSetting/index.d.ts +17 -17
  9. package/dist/components/ColumnSetting/style.d.ts +2 -5
  10. package/dist/components/Form/components/RequestSelect.d.ts +39 -0
  11. package/dist/components/Form/{useForm.d.ts → hooks/useForm.d.ts} +1 -1
  12. package/dist/components/Form/index.d.ts +13 -25
  13. package/dist/components/Form/style.d.ts +2 -5
  14. package/dist/components/Form/utils/config.d.ts +5 -0
  15. package/dist/components/Form/utils/dateFormat.d.ts +20 -0
  16. package/dist/components/ListToolBar/index.d.ts +21 -21
  17. package/dist/components/ListToolBar/style.d.ts +2 -5
  18. package/dist/components/ToolBar/FullscreenIcon.d.ts +1 -1
  19. package/dist/components/ToolBar/index.d.ts +20 -20
  20. package/dist/context/TableContext.d.ts +16 -14
  21. package/dist/hooks/tryOnActivated.d.ts +2 -0
  22. package/dist/hooks/useColumnSetting.d.ts +6 -6
  23. package/dist/hooks/useColumns.d.ts +102 -0
  24. package/dist/hooks/useDebounceFn.d.ts +2 -2
  25. package/dist/hooks/useFetchData.d.ts +20 -15
  26. package/dist/hooks/useLoading.d.ts +4 -3
  27. package/dist/hooks/usePagination.d.ts +10 -6
  28. package/dist/hooks/useRowSelection.d.ts +11 -8
  29. package/dist/hooks/useTable.d.ts +38 -11
  30. package/dist/hooks/useTableForm.d.ts +6 -6
  31. package/dist/hooks/useTableScroll.d.ts +11 -11
  32. package/dist/hooks/useTableSize.d.ts +2 -2
  33. package/dist/index.d.ts +8 -7
  34. package/dist/pro-table.js +2860 -0
  35. package/dist/pro-table.umd.cjs +12 -0
  36. package/dist/props.d.ts +95 -360
  37. package/dist/style.d.ts +2 -6
  38. package/dist/types/ColumnTypings.d.ts +54 -16
  39. package/dist/types/SlotsTypings.d.ts +47 -9
  40. package/dist/types/TableTypings.d.ts +119 -68
  41. package/dist/utils/utils.d.ts +4 -1
  42. package/package.json +33 -50
  43. package/volar.d.ts +3 -3
  44. package/dist/hooks/useColums.d.ts +0 -24
  45. package/dist/pro-table.mjs +0 -35100
  46. package/dist/pro-table.umd.js +0 -364
  47. package/dist/typing.d.ts +0 -1
  48. package/dist/utils/config.d.ts +0 -1
@@ -1,11 +1,12 @@
1
- import type { ComputedRef, Ref } from 'vue';
2
- import type { TableSorter } from '../_utils';
3
1
  import type { RecordType } from '@gx-design-vue/pro-utils';
4
- import type { ProTableProps, ProTablePagination, ProTabelFeachParams, ProTablePaginationConfig } from '../types/TableTypings';
2
+ import type { ComputedRef, Ref } from 'vue';
3
+ import type { FilterValue, SorterResult, TableCurrentDataSource } from '../_utils';
5
4
  import type { ProColumnsType } from '../types/ColumnTypings';
5
+ import type { ProTableFetchParams, ProTablePagination, ProTablePaginationConfig, ProTableProps, SearchConfig } from '../types/TableTypings';
6
6
  interface ActionType {
7
- getLoading: ComputedRef<boolean | undefined>;
8
- getPaginationInfo: ComputedRef<ProTablePagination>;
7
+ loading: ComputedRef<boolean | undefined>;
8
+ search: ComputedRef<SearchConfig | false>;
9
+ paginationInfo: Ref<ProTablePagination>;
9
10
  setPagination: (info: Partial<ProTablePagination>) => void;
10
11
  setLoading: (loading: boolean) => void;
11
12
  setColumns: (columnList: ProColumnsType) => void;
@@ -14,25 +15,29 @@ interface ActionType {
14
15
  columns: ComputedRef<ProColumnsType>;
15
16
  formParamsRef: RecordType;
16
17
  onBeforeSearchSubmit: ProTableProps['onBeforeSearchSubmit'];
18
+ hasCustomRender: ComputedRef<boolean>;
17
19
  }
18
- export type ConfigFetchData = {
20
+ export interface ConfigFetchData {
21
+ rowKey: ComputedRef<ProTableProps['rowKey']>;
19
22
  polling: ComputedRef<ProTableProps['polling']>;
20
- request: ComputedRef<ProTableProps['request']>;
21
- postData: ComputedRef<ProTableProps['postData']>;
23
+ request: ProTableProps['request'];
24
+ postData: ProTableProps['postData'];
22
25
  waitRequest: Ref<ProTableProps['waitRequest']>;
23
26
  debounceTime: ComputedRef<ProTableProps['debounceTime']>;
24
27
  dataSource: ComputedRef<ProTableProps['dataSource']>;
25
- };
28
+ }
26
29
  export declare function useConfigFetchData(props: ProTableProps): Omit<ConfigFetchData, 'waitRequest'>;
27
- export declare function useFetchData({ polling, request, postData, dataSource, waitRequest, debounceTime }: ConfigFetchData, { columns, getLoading, setLoading, setColumns, removeRowKeys, syncSelectedRows, formParamsRef, setPagination, getPaginationInfo, onBeforeSearchSubmit }: ActionType, emit: any): {
28
- getDataSourceRef: ComputedRef<RecordType[]>;
30
+ export declare function useFetchData({ rowKey, polling, request, postData, dataSource, waitRequest, debounceTime }: ConfigFetchData, { search, columns, loading, setLoading, setColumns, removeRowKeys, syncSelectedRows, formParamsRef, setPagination, paginationInfo, onBeforeSearchSubmit, hasCustomRender }: ActionType, emit: any): {
31
+ dataSource: ComputedRef<RecordType[]>;
29
32
  isTreeDataRef: ComputedRef<boolean>;
30
33
  reSetDataList: (list: RecordType[]) => void;
31
- changeDataValue: ({ key, params }: {
34
+ changeDataValue: ({ key, type, params, value }: {
35
+ params?: Partial<RecordType> | undefined;
32
36
  key?: string | undefined;
33
- params: RecordType;
37
+ value?: any;
38
+ type?: "update" | "push" | "delete" | "unshift";
34
39
  }) => void;
35
- handleTableChange: (pagination: ProTablePaginationConfig, filters: Record<string, any[] | null>, sorter: TableSorter) => void;
36
- reload: (info?: ProTabelFeachParams) => Promise<void>;
40
+ handleTableChange: (pagination: ProTablePaginationConfig, filters: Record<string, FilterValue | null>, sorter: SorterResult | SorterResult[], extra?: TableCurrentDataSource) => void;
41
+ reload: (info?: ProTableFetchParams) => Promise<void>;
37
42
  };
38
43
  export {};
@@ -1,9 +1,10 @@
1
1
  import type { Ref } from 'vue';
2
2
  import type { SpinProps } from '../_utils';
3
- export declare function useLoading({ emit, loading }: {
3
+ export declare function useLoading({ emit, loading: propsLoading }: {
4
4
  loading: Ref<boolean | SpinProps | undefined>;
5
5
  emit: any;
6
6
  }): {
7
- getLoading: import("vue").ComputedRef<boolean>;
8
- setLoading: (loading: boolean) => void;
7
+ loadingComputed: import("vue").ComputedRef<boolean | undefined>;
8
+ loading: Ref<boolean | undefined, boolean | undefined>;
9
+ setLoading: (value: boolean) => void;
9
10
  };
@@ -1,10 +1,14 @@
1
- import type { Ref, Slots, ComputedRef } from 'vue';
2
- import type { ProTableProps, ProTablePagination } from '../types/TableTypings';
3
- export declare function usePagination({ slots, props, pagination }: {
4
- slots: Slots;
5
- props: ComputedRef<ProTableProps>;
1
+ import type { Ref } from 'vue';
2
+ import type { PageItemRender } from '../types/SlotsTypings';
3
+ import type { ProTablePagination, ProTableProps } from '../types/TableTypings';
4
+ export declare function usePagination({ pagination, pageItemRender }: {
6
5
  pagination: Ref<ProTableProps['pagination']>;
6
+ pageItemRender: PageItemRender;
7
7
  }): {
8
- getPaginationInfo: ComputedRef<ProTablePagination>;
8
+ paginationInfo: Ref<ProTablePagination, ProTablePagination>;
9
+ requestPagination: {
10
+ pageSize: number;
11
+ pageNum: number;
12
+ };
9
13
  setPagination: (info: Partial<ProTablePagination>) => void;
10
14
  };
@@ -1,11 +1,14 @@
1
- import type { Ref } from 'vue';
2
1
  import type { RecordType } from '@gx-design-vue/pro-utils';
3
- import type { ProTableProps, ProTableRowSelection } from '../types/TableTypings';
4
- export declare function useRowSelection(rowKey: Ref<ProTableProps['rowKey']>, rowSelection: Ref<ProTableRowSelection | undefined>): {
5
- selectedKey: Ref<(string | number)[]>;
6
- selectRowKey: (record: RecordType, selected: any[]) => void;
7
- selectAllRowKey: (selected: any[], selectedRows: any[], changeRows: any[]) => void;
8
- removeRowKeys: (keyList: (string | number)[]) => void;
2
+ import type { Ref } from 'vue';
3
+ import type { Key, SelectionSelectFn } from '../_utils';
4
+ import type { ProTableRowSelection } from '../types/TableTypings';
5
+ export declare function useRowSelection(rowKey: Ref<string>, rowSelection: Ref<ProTableRowSelection | undefined>): {
6
+ selectedKeys: Ref<Key[], Key[]>;
7
+ selectedItems: Ref<RecordType[], RecordType[]>;
8
+ selectRowKey: SelectionSelectFn<RecordType>;
9
+ selectAllRowKey: (selected: boolean, selectedRows: RecordType[], changeRows: RecordType[]) => void;
10
+ removeRowKeys: (keys: (string | number)[]) => void;
9
11
  changeRowKey: () => void;
10
- syncSelectedRows: (dataList: any[]) => void;
12
+ syncSelectedRows: (dataList: RecordType[]) => void;
13
+ clearAllRowKeys: () => void;
11
14
  };
@@ -1,12 +1,39 @@
1
- import type { Ref, ComputedRef } from 'vue';
2
- import type { ProCoreActionType, ProCoreFormType, ProTableRef } from '../types/TableTypings';
3
- export declare function useTable(tableRef: Ref<ProTableRef>): {
4
- params: ComputedRef<Record<string, any>>;
5
- loading: ComputedRef<ProCoreActionType['getLoadingStatus']>;
6
- reload: ProCoreActionType['reload'];
7
- mutate: ProCoreActionType['reSetDataList'];
8
- setPage: ProCoreActionType['changePageInfo'];
9
- changeLoading: ProCoreActionType['loadingOperation'];
10
- actionRef: ComputedRef<ProCoreActionType>;
11
- formRef: ComputedRef<ProCoreFormType>;
1
+ import type { RecordType } from '@gx-design-vue/pro-utils';
2
+ import type { ComputedRef, MaybeRef, Ref } from 'vue';
3
+ import type { BaseTableProps } from '../props';
4
+ import type { ProColumnsType, ProSearchMap } from '../types/ColumnTypings';
5
+ import type { ProCoreActionType, ProCoreFormType, ProTableProps, ProTableRef, ProTableRowSelection, RequestConfig, RequestFunction } from '../types/TableTypings';
6
+ export type ProTableState<T extends object = RecordType, R extends object = RecordType> = BaseTableProps & {
7
+ params: R;
8
+ columns: ProColumnsType<T, R>;
9
+ dataSource: T[];
10
+ rowSelection: ProTableRowSelection<T>;
11
+ searchMap: ProSearchMap<undefined, keyof R | keyof T>[];
12
+ rowKey?: keyof T;
13
+ postData?: (data: T[]) => any;
14
+ onReset?: (params?: Partial<R>) => void;
15
+ onReload?: (params?: Partial<R>) => void;
16
+ onSubmit?: (params?: Partial<R>) => void;
17
+ };
18
+ export type BaseTableState<T extends object = RecordType, R extends object = RecordType> = Omit<ProTableProps<T, R>, 'request'>;
19
+ export declare function useTable<T extends object = RecordType, R extends object = RecordType>(tableRef: Ref<ProTableRef<T> | undefined>, options?: {
20
+ state?: MaybeRef<BaseTableState<T, R>>;
21
+ request?: RequestFunction<T, R>;
22
+ }): {
23
+ loading: Ref<boolean>;
24
+ dataSource: ComputedRef<T[]>;
25
+ selectedKeys: ProCoreActionType<T, R>['selectedKeys'];
26
+ selectedItems: ProCoreActionType<T, R>['selectedItems'];
27
+ rowsSelection: ProCoreActionType<T, R>['rowsSelection'];
28
+ requestSearch: ComputedRef<RequestConfig<R>['params']>;
29
+ reload: ProCoreActionType<T, R>['reload'];
30
+ mutate: ProCoreActionType<T, R>['reSetDataList'];
31
+ setPageAndReload: ProCoreActionType<T, R>['setPageAndReload'];
32
+ setDataValue: ProCoreActionType<T, R>['setDataValue'];
33
+ setPagination: ProCoreActionType<T, R>['setPagination'];
34
+ reloadAndReset: ProCoreActionType<T, R>['reloadAndReset'];
35
+ setLoading: ProCoreActionType<T, R>['setLoading'];
36
+ actionRef: ComputedRef<Partial<ProCoreActionType<T, R>>>;
37
+ formRef: ComputedRef<ProCoreFormType<R>>;
38
+ tableState: ProTableState<T, R>;
12
39
  };
@@ -1,16 +1,16 @@
1
- import type { ComputedRef, Ref } from 'vue';
2
1
  import type { RecordType } from '@gx-design-vue/pro-utils';
3
- import type { ProTableProps } from '../types/TableTypings';
2
+ import type { ComputedRef, Ref } from 'vue';
4
3
  import type { ProSearchMap } from '../types/ColumnTypings';
4
+ import type { ProTablePagination, ProTableProps } from '../types/TableTypings';
5
5
  export declare function handleFormDefaultValue(data: ProSearchMap[]): any;
6
- export declare function useTableForm({ search, searchMap, params, columns }: {
7
- search: Ref<ProTableProps['search']>;
6
+ export declare function useTableForm({ searchMap, params, columns, setPagination }: {
8
7
  searchMap: Ref<ProTableProps['searchMap']>;
9
8
  params: Ref<ProTableProps['params']>;
10
9
  columns: ComputedRef<ProTableProps['columns']>;
10
+ setPagination: (info: Partial<ProTablePagination>) => void;
11
11
  }): {
12
- formDataRef: Ref<ProSearchMap<"text">[]>;
12
+ formDataRef: Ref<ProSearchMap<"text", string>[], ProSearchMap<"text", string>[]>;
13
13
  formParamsRef: RecordType;
14
14
  defaultParamsRef: RecordType;
15
- setFormParams: (params: any) => void;
15
+ setFormParams: (params: RecordType) => void;
16
16
  };
@@ -1,28 +1,28 @@
1
+ import type { Breakpoint } from '@gx-design-vue/pro-utils';
1
2
  import type { ComputedRef, Ref } from 'vue';
2
- import { type Breakpoint } from '@gx-design-vue/pro-utils';
3
- import type { ProTableProps } from '../types/TableTypings';
4
3
  import type { ProColumnsType } from '../types/ColumnTypings';
5
- type ConfigScroll = {
4
+ import type { ProTableProps } from '../types/TableTypings';
5
+ interface ConfigScroll {
6
6
  scroll: ComputedRef<ProTableProps['scroll']>;
7
7
  autoScroll: ComputedRef<ProTableProps['autoScroll']>;
8
8
  modalScroll: ComputedRef<ProTableProps['modalScroll']>;
9
9
  neverScroll: ComputedRef<ProTableProps['neverScroll']>;
10
10
  rowSelection: ComputedRef<ProTableProps['rowSelection']>;
11
11
  scrollBreakpoint: ComputedRef<ProTableProps['scrollBreakpoint']>;
12
- };
12
+ }
13
13
  type useTableScrollType = {
14
14
  columns: ComputedRef<ProColumnsType>;
15
15
  innerWidth: Ref<number>;
16
- screensRef: Ref<Partial<Record<Breakpoint, boolean>>>;
16
+ screens: Ref<Partial<Record<Breakpoint, boolean>>>;
17
17
  } & ConfigScroll;
18
18
  export declare function useConfigScroll(props: ProTableProps): ConfigScroll;
19
- export declare function useTableScroll({ scroll, columns, autoScroll, modalScroll, neverScroll, rowSelection, screensRef, innerWidth, scrollBreakpoint, }: useTableScrollType): {
20
- getScrollRef: ComputedRef<({
21
- x?: string | number | true | undefined;
22
- y?: string | number | undefined;
19
+ export declare function useTableScroll({ scroll, columns, autoScroll, modalScroll, neverScroll, rowSelection, screens, innerWidth, scrollBreakpoint }: useTableScrollType): {
20
+ proScroll: ComputedRef<({
21
+ x?: number | true | string;
22
+ y?: number | string;
23
23
  } & {
24
- scrollToFirstRowOnChange?: boolean | undefined;
24
+ scrollToFirstRowOnChange?: boolean;
25
25
  }) | undefined>;
26
- breakpoint: ComputedRef<boolean>;
26
+ breakpoint: ComputedRef<boolean | undefined>;
27
27
  };
28
28
  export {};
@@ -1,9 +1,9 @@
1
- import type { Ref } from 'vue';
2
1
  import type { SizeType } from '@gx-design-vue/pro-utils';
2
+ import type { Ref } from 'vue';
3
3
  export declare function useTableSize({ size, emit }: {
4
4
  size: Ref<SizeType>;
5
5
  emit: any;
6
6
  }): {
7
- sizeRef: Ref<SizeType>;
7
+ sizeRef: Ref<SizeType, SizeType>;
8
8
  setTableSize: (size: SizeType) => void;
9
9
  };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
- import { useTable } from './hooks/useTable';
1
+ import ProTable from './ProTable';
2
+ export * from './hooks/useTable';
2
3
  export { proTableProps } from './props';
3
- export { default } from './ProTable';
4
- export type { ProTableProps } from './types/TableTypings';
5
- export type { RequsetFunction, ProTableRef, ProCoreActionType, ProTabelFeachParams, ProCoreFormType } from './types/TableTypings';
6
- export type { ProColumnType, ProColumnsType, ProSearchMap } from './types/ColumnTypings';
7
- export { useTable };
8
- export { default as GProTable } from './ProTable';
4
+ export { ProTable as GProTable };
5
+ export type { BaseTableProps } from './props';
6
+ export type { ProColumnsType, ProColumnType, ProFieldValueType, ProSearchMap } from './types/ColumnTypings';
7
+ export type { CustomRenderResult, ProTableBodyCellProps } from './types/SlotsTypings';
8
+ export type { PageState, ProTableProps } from './types/TableTypings';
9
+ export type { OptionConfig, ProCoreActionType, ProCoreFormType, ProTableFetchParams, ProTableRef, RequestFunction, SearchConfig } from './types/TableTypings';