@gx-design-vue/pro-table 0.2.0-beta.10 → 0.2.0-beta.100

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 (44) hide show
  1. package/dist/ProTable.d.ts +220 -792
  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 +16 -16
  9. package/dist/components/ColumnSetting/style.d.ts +2 -5
  10. package/dist/components/Form/dateFormat.d.ts +20 -0
  11. package/dist/components/Form/index.d.ts +39 -21
  12. package/dist/components/Form/style.d.ts +2 -5
  13. package/dist/components/ListToolBar/index.d.ts +21 -21
  14. package/dist/components/ListToolBar/style.d.ts +2 -5
  15. package/dist/components/ToolBar/FullscreenIcon.d.ts +1 -1
  16. package/dist/components/ToolBar/index.d.ts +20 -20
  17. package/dist/context/TableContext.d.ts +16 -14
  18. package/dist/hooks/tryOnActivated.d.ts +2 -0
  19. package/dist/hooks/useColumnSetting.d.ts +6 -6
  20. package/dist/hooks/useColums.d.ts +92 -11
  21. package/dist/hooks/useDebounceFn.d.ts +2 -2
  22. package/dist/hooks/useFetchData.d.ts +18 -15
  23. package/dist/hooks/useLoading.d.ts +5 -4
  24. package/dist/hooks/usePagination.d.ts +8 -3
  25. package/dist/hooks/useRowSelection.d.ts +11 -8
  26. package/dist/hooks/useTable.d.ts +38 -11
  27. package/dist/hooks/useTableForm.d.ts +6 -6
  28. package/dist/hooks/useTableScroll.d.ts +11 -11
  29. package/dist/hooks/useTableSize.d.ts +2 -2
  30. package/dist/index.d.ts +6 -5
  31. package/dist/pro-table.js +2836 -0
  32. package/dist/pro-table.umd.cjs +1 -0
  33. package/dist/props.d.ts +89 -358
  34. package/dist/style.d.ts +2 -6
  35. package/dist/types/ColumnTypings.d.ts +34 -16
  36. package/dist/types/SlotsTypings.d.ts +42 -9
  37. package/dist/types/TableTypings.d.ts +115 -67
  38. package/dist/utils/utils.d.ts +4 -1
  39. package/package.json +20 -43
  40. package/volar.d.ts +3 -3
  41. package/dist/pro-table.mjs +0 -35085
  42. package/dist/pro-table.umd.js +0 -364
  43. package/dist/typing.d.ts +0 -1
  44. package/dist/utils/config.d.ts +0 -1
@@ -1,11 +1,12 @@
1
1
  import type { ComputedRef, Ref } from 'vue';
2
- import type { TableSorter } from '../_utils';
3
- import type { RecordType } from '@gx-design-vue/pro-utils';
4
- import type { ProTableProps, ProTablePagination, ProTabelFeachParams, ProTablePaginationConfig } from '../types/TableTypings';
2
+ import type { FilterValue, SorterResult, TableCurrentDataSource } from '../_utils/ant-design-vue/table/typings';
5
3
  import type { ProColumnsType } from '../types/ColumnTypings';
4
+ import type { ProTabelFeachParams, ProTablePagination, ProTablePaginationConfig, ProTableProps, SearchConfig } from '../types/TableTypings';
5
+ import { type RecordType } from '@gx-design-vue/pro-utils';
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,27 @@ 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 {
19
21
  polling: ComputedRef<ProTableProps['polling']>;
20
- request: ComputedRef<ProTableProps['request']>;
21
- postData: ComputedRef<ProTableProps['postData']>;
22
+ request: ProTableProps['request'];
23
+ postData: ProTableProps['postData'];
22
24
  waitRequest: Ref<ProTableProps['waitRequest']>;
23
25
  debounceTime: ComputedRef<ProTableProps['debounceTime']>;
24
26
  dataSource: ComputedRef<ProTableProps['dataSource']>;
25
- };
27
+ }
26
28
  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[]>;
29
+ export declare function useFetchData({ polling, request, postData, dataSource, waitRequest, debounceTime }: ConfigFetchData, { search, columns, loading, setLoading, setColumns, removeRowKeys, syncSelectedRows, formParamsRef, setPagination, paginationInfo, onBeforeSearchSubmit, hasCustomRender }: ActionType, emit: any): {
30
+ dataSource: ComputedRef<RecordType[]>;
29
31
  isTreeDataRef: ComputedRef<boolean>;
30
32
  reSetDataList: (list: RecordType[]) => void;
31
- changeDataValue: ({ key, params }: {
32
- key?: string | undefined;
33
- params: RecordType;
33
+ changeDataValue: <T = RecordType>({ key, record, type }: {
34
+ record: T;
35
+ type: "update" | "push" | "delete" | "unshift";
36
+ key?: keyof T;
34
37
  }) => void;
35
- handleTableChange: (pagination: ProTablePaginationConfig, filters: Record<string, any[] | null>, sorter: TableSorter) => void;
38
+ handleTableChange: (pagination: ProTablePaginationConfig, filters: Record<string, FilterValue | null>, sorter: SorterResult | SorterResult[], extra?: TableCurrentDataSource) => void;
36
39
  reload: (info?: ProTabelFeachParams) => Promise<void>;
37
40
  };
38
41
  export {};
@@ -1,9 +1,10 @@
1
- import type { Ref } from 'vue';
2
1
  import type { SpinProps } from '../_utils';
3
- export declare function useLoading({ emit, loading }: {
2
+ import { type Ref } from 'vue';
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,15 @@
1
- import type { Ref, Slots, ComputedRef } from 'vue';
2
- import type { ProTableProps, ProTablePagination } from '../types/TableTypings';
1
+ import type { ComputedRef, Ref } from 'vue';
2
+ import type { Slots } from '../types/SlotsTypings';
3
+ import type { ProTablePagination, ProTableProps } from '../types/TableTypings';
3
4
  export declare function usePagination({ slots, props, pagination }: {
4
5
  slots: Slots;
5
6
  props: ComputedRef<ProTableProps>;
6
7
  pagination: Ref<ProTableProps['pagination']>;
7
8
  }): {
8
- getPaginationInfo: ComputedRef<ProTablePagination>;
9
+ paginationInfo: Ref<ProTablePagination, ProTablePagination>;
10
+ requestPagination: {
11
+ pageSize: number;
12
+ pageNum: number;
13
+ };
9
14
  setPagination: (info: Partial<ProTablePagination>) => void;
10
15
  };
@@ -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 { ComputedRef, Ref } from 'vue';
2
+ import type { BaseTableProps } from '../props';
3
+ import type { ProColumnsType, ProSearchMap } from '../types/ColumnTypings';
4
+ import type { ProCoreActionType, ProCoreFormType, ProTableProps, ProTableRef, ProTableRowSelection, RequsetConfig, RequsetFunction } from '../types/TableTypings';
5
+ import { type RecordType } from '@gx-design-vue/pro-utils';
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?: BaseTableState<T, R>;
21
+ request?: RequsetFunction<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
+ requestParams: ComputedRef<RequsetConfig<R>['params']>;
29
+ reload: ProCoreActionType<T, R>['reload'];
30
+ mutate: ProCoreActionType<T, R>['reSetDataList'];
31
+ setPageAndReload: ProCoreActionType<T, R>['setPageAndReload'];
32
+ setData: ProCoreActionType<T, R>['setData'];
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
1
  import type { ComputedRef, Ref } from 'vue';
2
- import { type Breakpoint } from '@gx-design-vue/pro-utils';
3
- import type { ProTableProps } from '../types/TableTypings';
4
2
  import type { ProColumnsType } from '../types/ColumnTypings';
5
- type ConfigScroll = {
3
+ import type { ProTableProps } from '../types/TableTypings';
4
+ import { type Breakpoint } from '@gx-design-vue/pro-utils';
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
+ export * from './hooks/useTable';
2
+ export type { BaseTableProps } from './props';
2
3
  export { proTableProps } from './props';
3
4
  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
5
  export { default as GProTable } from './ProTable';
6
+ export type { ProColumnsType, ProColumnType, 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, ProTabelFeachParams, ProTableRef, RequsetFunction, SearchConfig } from './types/TableTypings';