@pantograph/pattern-vue 0.0.3 → 0.0.4
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.
- package/README.md +2 -2
- package/dist/ComponentMap-B17Koyjo.js +1 -0
- package/dist/ComponentMap-D-1MyYm9.js +21 -0
- package/dist/ComponentMap.d.ts +1 -1
- package/dist/components/CoachMark/CoachMark.d.ts +52 -0
- package/dist/components/CoachMark/constant.d.ts +72 -0
- package/dist/components/CoachMark/index.d.ts +5 -0
- package/dist/components/CoachMark/model.d.ts +8 -0
- package/dist/components/CoachMark/types.d.ts +105 -0
- package/dist/components/Comment/Comment.d.ts +28 -0
- package/dist/components/Comment/CommentAction.d.ts +17 -0
- package/dist/components/Comment/CommentActions.d.ts +431 -0
- package/dist/components/Comment/CommentEditor.d.ts +67 -0
- package/dist/components/Comment/CommentFileList.d.ts +2 -0
- package/dist/components/Comment/CommentMention.d.ts +639 -0
- package/dist/components/Comment/CommentReaction.d.ts +11 -0
- package/dist/components/Comment/CommentReactionHoverCard.d.ts +10 -0
- package/dist/components/Comment/CommentReactionList.d.ts +217 -0
- package/dist/components/Comment/CommentReactionListItem.d.ts +3 -0
- package/dist/components/Comment/CommentTrigger.d.ts +15 -0
- package/dist/components/Comment/constant.d.ts +59 -0
- package/dist/components/Comment/context.d.ts +3 -0
- package/dist/components/Comment/index.d.ts +13 -0
- package/dist/components/Comment/types.d.ts +563 -0
- package/dist/components/Comment/useComment.d.ts +49 -0
- package/dist/components/DataTable/DataTable.d.ts +99 -0
- package/dist/components/DataTable/components/DataTableBatchActions.d.ts +9 -0
- package/dist/components/DataTable/components/DataTableBatchActionsContent.d.ts +2 -0
- package/dist/components/DataTable/components/DataTableColGroup.d.ts +6 -0
- package/dist/components/DataTable/components/DataTableContent.d.ts +2 -0
- package/dist/components/DataTable/components/DataTableEmpty.d.ts +2 -0
- package/dist/components/DataTable/components/DataTableFooter.d.ts +2 -0
- package/dist/components/DataTable/components/DataTableHeader.d.ts +57 -0
- package/dist/components/DataTable/components/DataTableHeaderCell.d.ts +243 -0
- package/dist/components/DataTable/components/DataTableHeaderCellActionsPopover.d.ts +2 -0
- package/dist/components/DataTable/components/DataTableInsertBetween.d.ts +2 -0
- package/dist/components/DataTable/components/DataTableLazyLoading.d.ts +56 -0
- package/dist/components/DataTable/components/DataTableLoadingRow.d.ts +18 -0
- package/dist/components/DataTable/components/DataTableRow.d.ts +15 -0
- package/dist/components/DataTable/components/ThDragGhost.d.ts +16 -0
- package/dist/components/DataTable/constant.d.ts +20 -0
- package/dist/components/DataTable/context.d.ts +2 -0
- package/dist/components/DataTable/index.d.ts +5 -0
- package/dist/components/DataTable/types/cell.d.ts +15 -0
- package/dist/components/DataTable/types/column.d.ts +69 -0
- package/dist/components/DataTable/types/common.d.ts +18 -0
- package/dist/components/DataTable/types/context.d.ts +44 -0
- package/dist/components/DataTable/types/index.d.ts +139 -0
- package/dist/components/DataTable/types/select.d.ts +25 -0
- package/dist/components/DataTable/utils/index.d.ts +14 -0
- package/dist/components/DataTable/utils/useCell.d.ts +23 -0
- package/dist/components/DataTable/utils/useCol.d.ts +35 -0
- package/dist/components/DataTable/utils/useColumnFixed.d.ts +23 -0
- package/dist/components/DataTable/utils/useColumnOrder.d.ts +32 -0
- package/dist/components/DataTable/utils/useColumnPopover.d.ts +19 -0
- package/dist/components/DataTable/utils/useColumnSize.d.ts +14 -0
- package/dist/components/DataTable/utils/useColumnWrap.d.ts +7 -0
- package/dist/components/DataTable/utils/useFilter.d.ts +14 -0
- package/dist/components/DataTable/utils/useInsertBetween.d.ts +5 -0
- package/dist/components/DataTable/utils/useRow.d.ts +9 -0
- package/dist/components/DataTable/utils/useRowOrder.d.ts +114 -0
- package/dist/components/DataTable/utils/useRowVirtualizer.d.ts +12 -0
- package/dist/components/DataTable/utils/useSelection.d.ts +30 -0
- package/dist/components/DataTable/utils/useSort.d.ts +12 -0
- package/dist/components/Form/Form.d.ts +58 -0
- package/dist/components/Form/FormItem.d.ts +22 -0
- package/dist/components/Form/constant.d.ts +18 -0
- package/dist/components/Form/defineRules.d.ts +6 -0
- package/dist/components/Form/index.d.ts +5 -0
- package/dist/components/Form/types.d.ts +418 -0
- package/dist/components/GOPicker/GOItemSkeleton.d.ts +2 -0
- package/dist/components/GOPicker/GOPicker.d.ts +33 -0
- package/dist/components/GOPicker/constant.d.ts +40 -0
- package/dist/components/GOPicker/emojis.d.ts +24 -0
- package/dist/components/GOPicker/getEmojiList.d.ts +42 -0
- package/dist/components/GOPicker/icons.d.ts +9 -0
- package/dist/components/GOPicker/index.d.ts +6 -0
- package/dist/components/GOPicker/model.d.ts +16 -0
- package/dist/components/GOPicker/types.d.ts +353 -0
- package/dist/components/InputPassword/InputPassword.d.ts +4 -71
- package/dist/components/InputPassword/constant.d.ts +12 -0
- package/dist/components/InputPassword/index.d.ts +4 -8
- package/dist/components/InputPassword/types.d.ts +46 -0
- package/dist/components/ListView/ListView.d.ts +15 -0
- package/dist/components/ListView/ListViewItem.d.ts +10 -0
- package/dist/components/ListView/constant.d.ts +4 -0
- package/dist/components/ListView/index.d.ts +5 -0
- package/dist/components/ListView/types.d.ts +16 -0
- package/dist/index-D-WRsztv.js +3431 -0
- package/dist/index-DhcyeKI-.js +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +52 -4
- package/dist/index.umd.cjs +1 -1
- package/dist/nuxt/index.js +1 -1
- package/dist/nuxt/index.umd.cjs +1 -1
- package/dist/resolver/index.js +1 -1
- package/dist/resolver/index.umd.cjs +1 -1
- package/dist/use/index.js +24437 -100
- package/dist/use/index.umd.cjs +30 -1
- package/package.json +10 -6
- package/dist/ComponentMap-BDQ8ar3z.js +0 -6
- package/dist/ComponentMap-CTyWVtmA.js +0 -1
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { PopoverProps, SkeletonProps } from '@pantograph/vue';
|
|
2
|
+
import { Column } from '@tanstack/vue-table';
|
|
3
|
+
import { VNode } from 'vue';
|
|
4
|
+
import { TableCustomCell, TableCustomCellReturn } from './cell';
|
|
5
|
+
import { TableTitle } from './common';
|
|
6
|
+
export interface TableGetFunctionsProps<T = any> {
|
|
7
|
+
index: number;
|
|
8
|
+
record: T;
|
|
9
|
+
parentId?: string;
|
|
10
|
+
depth: number;
|
|
11
|
+
id: {
|
|
12
|
+
cell: string;
|
|
13
|
+
column: string;
|
|
14
|
+
};
|
|
15
|
+
visibleColumnCount: number;
|
|
16
|
+
column: TableColumnBase<T> & TableColExtra;
|
|
17
|
+
}
|
|
18
|
+
export type TableCustomRender<T = any> = (data?: Partial<TableGetFunctionsProps<T>>) => VNode | undefined;
|
|
19
|
+
export interface TableColExtra {
|
|
20
|
+
id: string;
|
|
21
|
+
bind: {
|
|
22
|
+
style: Record<string, any>;
|
|
23
|
+
fixed: boolean;
|
|
24
|
+
afterShadow: boolean;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export interface DataTableSlotProps {
|
|
28
|
+
visibleColumns: (TableColumn & TableColExtra)[];
|
|
29
|
+
visibleRows: object[];
|
|
30
|
+
}
|
|
31
|
+
export interface ColumnMenuItemTitles {
|
|
32
|
+
sortAsc?: string;
|
|
33
|
+
sortDesc?: string;
|
|
34
|
+
autoFitWidth?: string;
|
|
35
|
+
freezeUpToColumn?: string;
|
|
36
|
+
unfreezeAllColumn?: string;
|
|
37
|
+
filter?: string;
|
|
38
|
+
deleteFilter?: string;
|
|
39
|
+
wrapColumn?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface TableColumnBase<T = any> extends Omit<TableCustomCellReturn, 'rowSpan'> {
|
|
42
|
+
dataIndex?: string;
|
|
43
|
+
render?: TableCustomRender<T>;
|
|
44
|
+
id: string;
|
|
45
|
+
responsive?: ('desktop' | 'tablet' | 'mobile')[];
|
|
46
|
+
sorter?: ((a: T, b: T) => number) | 'basic' | 'datetime' | 'textCaseSensitive' | 'text' | 'alphanumericCaseSensitive' | 'alphanumeric' | 'server';
|
|
47
|
+
hideColumnWrap?: boolean;
|
|
48
|
+
hideColumnFix?: boolean;
|
|
49
|
+
sortOrder?: 'asc' | 'desc';
|
|
50
|
+
multiSort?: number;
|
|
51
|
+
defaultSortOrder?: 'asc' | 'desc';
|
|
52
|
+
title?: TableTitle;
|
|
53
|
+
width?: number | string;
|
|
54
|
+
maxWidth?: number;
|
|
55
|
+
minWidth?: number;
|
|
56
|
+
skeletonProps?: SkeletonProps & Record<string, any>;
|
|
57
|
+
hasFilter?: boolean;
|
|
58
|
+
onFilter?: (reference: PopoverProps['reference'], placement: PopoverProps['placement']) => void;
|
|
59
|
+
onDeleteFilter?: (reference: PopoverProps['reference'], placement: PopoverProps['placement']) => void;
|
|
60
|
+
menuItemTitles?: ColumnMenuItemTitles;
|
|
61
|
+
}
|
|
62
|
+
export type TableColumn<T = any> = Omit<TableCustomCellReturn, 'rowSpan'> & TableColumnBase & {
|
|
63
|
+
customCell?: TableCustomCell<T>;
|
|
64
|
+
} & {
|
|
65
|
+
[key: string]: unknown;
|
|
66
|
+
};
|
|
67
|
+
export type TableCol = Column<unknown> & {
|
|
68
|
+
columnDef: TableColumn;
|
|
69
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { VNode } from 'vue';
|
|
2
|
+
export type TableTitle = string | (() => VNode);
|
|
3
|
+
export interface GetTableRowProps {
|
|
4
|
+
index?: number;
|
|
5
|
+
row?: object;
|
|
6
|
+
loading?: boolean;
|
|
7
|
+
header?: boolean;
|
|
8
|
+
footer?: boolean;
|
|
9
|
+
empty?: boolean;
|
|
10
|
+
lazyLoadObserver?: boolean;
|
|
11
|
+
zebra?: boolean;
|
|
12
|
+
checked?: boolean;
|
|
13
|
+
id?: string;
|
|
14
|
+
depth?: number;
|
|
15
|
+
parentId?: string;
|
|
16
|
+
first?: boolean;
|
|
17
|
+
last?: boolean;
|
|
18
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { EmitType } from '@pantograph/utils-vue';
|
|
2
|
+
import { Table } from '@tanstack/vue-table';
|
|
3
|
+
import { ComputedRef, Ref } from 'vue';
|
|
4
|
+
import { CellActions, ColActions, ColumnFixActions, ColumnOrderActions, ColumnSizeActions, ColumnWrapActions, FilterActions, RowActions, SelectionActions, SelectionState, SortActions, ColumnPopoverActions } from '../utils';
|
|
5
|
+
import { ConfigProviderContext } from '@pantograph/vue';
|
|
6
|
+
import { DataTableSlotProps, TableCol, TableColExtra, TableColumn } from './column';
|
|
7
|
+
import { GetTableRowProps } from './common';
|
|
8
|
+
import { DataTableEmits, DataTableProps, DataTableSlots } from './index';
|
|
9
|
+
export interface InsertBetweenState {
|
|
10
|
+
tr: undefined | HTMLElement;
|
|
11
|
+
position: 'before' | 'after';
|
|
12
|
+
}
|
|
13
|
+
export interface DataTableContext extends Pick<ConfigProviderContext, 'getDragging' | 'setDragging'> {
|
|
14
|
+
props: DataTableProps;
|
|
15
|
+
emit: EmitType<DataTableEmits>;
|
|
16
|
+
slots: DataTableSlots;
|
|
17
|
+
table: Table<unknown>;
|
|
18
|
+
getRowProps: (params: GetTableRowProps) => Record<string, any>;
|
|
19
|
+
selectionId: string;
|
|
20
|
+
cell: CellActions;
|
|
21
|
+
selectState: SelectionState;
|
|
22
|
+
col: ColActions;
|
|
23
|
+
sort: SortActions;
|
|
24
|
+
getSlotProps: ComputedRef<DataTableSlotProps>;
|
|
25
|
+
getTableLayout: ComputedRef<DataTableProps['tableLayout']>;
|
|
26
|
+
tableSelect: SelectionActions;
|
|
27
|
+
colWrap: ColumnWrapActions;
|
|
28
|
+
filter: FilterActions;
|
|
29
|
+
size: ColumnSizeActions;
|
|
30
|
+
fix: ColumnFixActions;
|
|
31
|
+
colOrder: ColumnOrderActions;
|
|
32
|
+
colPopover: ColumnPopoverActions;
|
|
33
|
+
row: RowActions;
|
|
34
|
+
getColDefByExtra: (col: TableCol) => TableColExtra & TableColumn;
|
|
35
|
+
hasFooter: Ref<boolean>;
|
|
36
|
+
onScroll: (e: Event) => void;
|
|
37
|
+
insertBetweenState: Ref<InsertBetweenState>;
|
|
38
|
+
hideShadowHeader: Ref<boolean>;
|
|
39
|
+
hideShadowColumn: Ref<boolean>;
|
|
40
|
+
headerRowCount: Ref<number>;
|
|
41
|
+
tableRootRef: Ref<HTMLElement | undefined>;
|
|
42
|
+
tableHeaderRef: Ref<any | undefined>;
|
|
43
|
+
tableBodyRef: Ref<any | undefined>;
|
|
44
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { MoveEvent, SortableEvent, SortableOptions } from '@pantograph/sortable';
|
|
2
|
+
import { Direction, EmptyProps, ScrollContainerProps, TableSize, TrProps } from '@pantograph/vue';
|
|
3
|
+
import { ClassValue } from 'clsx';
|
|
4
|
+
import { DataTableSlotProps, TableColumn, TableGetFunctionsProps } from './column';
|
|
5
|
+
import { GetTableRowProps } from './common';
|
|
6
|
+
import { TableRowSelection, TableSelectProps } from './select';
|
|
7
|
+
import { DataTableContext } from './context';
|
|
8
|
+
import { DefineComponent } from '@pantograph/utils-vue';
|
|
9
|
+
export interface DataTableProps {
|
|
10
|
+
minVisibleAreaOnFixColumns?: number | string;
|
|
11
|
+
dir?: Direction;
|
|
12
|
+
resizing?: {
|
|
13
|
+
mode?: 'onChange' | 'onEnd';
|
|
14
|
+
enable?: boolean;
|
|
15
|
+
};
|
|
16
|
+
columnOrdering?: boolean;
|
|
17
|
+
rowOrdering?: boolean | (Partial<Pick<SortableOptions, 'group'>> & {
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
getSelectedCount?: (row: object) => number | string;
|
|
20
|
+
includeSubRowsOnMultiDragBadgeCount?: boolean;
|
|
21
|
+
onStart?: (event: SortableEvent, row?: object) => void;
|
|
22
|
+
onMove?: (evt: MoveEvent, related?: object) => boolean | -1 | 1 | void;
|
|
23
|
+
onEnd?: (event: SortableEvent, row?: object) => void;
|
|
24
|
+
onChoose?: (event: SortableEvent, row?: object) => void;
|
|
25
|
+
getIsRowDragging?: (row: object) => boolean;
|
|
26
|
+
});
|
|
27
|
+
columnDefaultMinWidth?: number;
|
|
28
|
+
columns: TableColumn[];
|
|
29
|
+
columnOrder?: string[];
|
|
30
|
+
filteredColumns?: string[];
|
|
31
|
+
columnVisibility?: Record<string, boolean>;
|
|
32
|
+
rowLoading?: Record<string, boolean>;
|
|
33
|
+
expanded?: true | Record<string, boolean>;
|
|
34
|
+
childrenRowName?: string | ((row: Record<string, any>) => any);
|
|
35
|
+
rowLazyLoadKey?: string | ((row: any) => any);
|
|
36
|
+
childrenColumnName?: string | ((row: any) => any);
|
|
37
|
+
data: object[];
|
|
38
|
+
class?: ClassValue;
|
|
39
|
+
theadCls?: ClassValue;
|
|
40
|
+
tbodyCls?: ClassValue;
|
|
41
|
+
actionHoverCls?: ClassValue;
|
|
42
|
+
rootCls?: ClassValue;
|
|
43
|
+
rowSelection?: TableRowSelection;
|
|
44
|
+
rowKey: string | ((row: Record<string, any>, index: number) => string);
|
|
45
|
+
lazyLoading?: boolean;
|
|
46
|
+
loading?: boolean;
|
|
47
|
+
emptyProps?: EmptyProps;
|
|
48
|
+
scrollContainerProps?: ScrollContainerProps;
|
|
49
|
+
size?: TableSize;
|
|
50
|
+
batchActionsTitle?: string;
|
|
51
|
+
loadingRowCount?: number;
|
|
52
|
+
stickyHeader?: boolean;
|
|
53
|
+
paginateExpandedRows?: boolean;
|
|
54
|
+
stickyFooter?: boolean;
|
|
55
|
+
zebra?: boolean;
|
|
56
|
+
insertBetweenRows?: boolean;
|
|
57
|
+
scroll?: {
|
|
58
|
+
scrollToFirstRowOnChange?: boolean;
|
|
59
|
+
x?: string | number | 'max-content';
|
|
60
|
+
y?: string | number;
|
|
61
|
+
};
|
|
62
|
+
tableLayout?: 'auto' | 'fixed';
|
|
63
|
+
actionCol?: Omit<TableColumn, 'id' | 'wrap' | 'colSpan' | 'dataIndex' | 'sorter' | 'sortOrder' | 'multiSort' | 'defaultSortOrder'> & {
|
|
64
|
+
id?: string;
|
|
65
|
+
};
|
|
66
|
+
noHeader?: boolean;
|
|
67
|
+
rowProps?: TrProps | ((data: GetTableRowProps) => TrProps);
|
|
68
|
+
fixedColumn?: string;
|
|
69
|
+
overflowScroll?: boolean | 'scrollContainer' | string;
|
|
70
|
+
scrollCls?: ClassValue;
|
|
71
|
+
insertBetweenRowsCls?: ClassValue;
|
|
72
|
+
hideDataOnLoading?: boolean;
|
|
73
|
+
bordered?: boolean;
|
|
74
|
+
columnBordered?: boolean;
|
|
75
|
+
getScrollElement?: () => HTMLElement | undefined;
|
|
76
|
+
virtual?: boolean;
|
|
77
|
+
reCalculateVirtualRows?: number;
|
|
78
|
+
bodyProps?: Record<string, any>;
|
|
79
|
+
}
|
|
80
|
+
export interface DataTableSlots {
|
|
81
|
+
headerCell?: (props: Partial<Pick<TableGetFunctionsProps, 'column'>>) => never;
|
|
82
|
+
bodyCell?: (props: TableGetFunctionsProps) => never;
|
|
83
|
+
footer?: (props: DataTableSlotProps) => never;
|
|
84
|
+
footerCell?: (props: Pick<TableGetFunctionsProps, 'column'>) => never;
|
|
85
|
+
skeleton?: (props: Partial<Omit<TableGetFunctionsProps, 'record'>>) => never;
|
|
86
|
+
batchActions?: (props: Partial<TableSelectProps>) => never;
|
|
87
|
+
action?: (props: TableGetFunctionsProps) => never;
|
|
88
|
+
cellAction?: (props: TableGetFunctionsProps) => never;
|
|
89
|
+
hoverAction?: (props: TableGetFunctionsProps) => never;
|
|
90
|
+
emptyTitle?: (params?: object) => never;
|
|
91
|
+
emptyDescription?: (params?: object) => never;
|
|
92
|
+
emptyActions?: (params?: object) => never;
|
|
93
|
+
emptyImage?: (params?: object) => never;
|
|
94
|
+
extra?: (params?: object) => never;
|
|
95
|
+
}
|
|
96
|
+
export interface SortItem {
|
|
97
|
+
desc: boolean;
|
|
98
|
+
id: string;
|
|
99
|
+
multiple?: number;
|
|
100
|
+
sorter: Required<TableColumn['sorter']>;
|
|
101
|
+
}
|
|
102
|
+
export interface DataTableRowDropParams extends SortableEvent {
|
|
103
|
+
multiple?: boolean;
|
|
104
|
+
before?: unknown;
|
|
105
|
+
after?: unknown;
|
|
106
|
+
beforeIndex?: number;
|
|
107
|
+
afterIndex?: number;
|
|
108
|
+
draggedRow?: unknown;
|
|
109
|
+
draggedRows?: unknown[];
|
|
110
|
+
}
|
|
111
|
+
export interface DataTableEmits {
|
|
112
|
+
drop: [params: DataTableRowDropParams];
|
|
113
|
+
'update:filteredColumns': [value: string[]];
|
|
114
|
+
'update:columnVisibility': [value?: Record<string, boolean>];
|
|
115
|
+
'update:expanded': [value?: Record<string, boolean> | true];
|
|
116
|
+
expand: [id: string, value: boolean];
|
|
117
|
+
'update:columnOrder': [value: string[]];
|
|
118
|
+
resize: [value: Record<string, number | undefined>];
|
|
119
|
+
reorder: [value: string[]];
|
|
120
|
+
fetch: [getIsVisible: () => Promise<boolean>];
|
|
121
|
+
rowClick: [row: object, event: Event];
|
|
122
|
+
insertBetweenRows: [row: GetTableRowProps & {
|
|
123
|
+
position: 'before' | 'after';
|
|
124
|
+
}];
|
|
125
|
+
sort: [column: TableColumn, order: 'asc' | 'desc' | false, sorting: SortItem[]];
|
|
126
|
+
columnWrap: [wrapped: boolean, column: TableColumn];
|
|
127
|
+
'update:fixedColumn': [value?: string];
|
|
128
|
+
init: [value?: DataTableContext];
|
|
129
|
+
}
|
|
130
|
+
export * from './cell';
|
|
131
|
+
export * from './column';
|
|
132
|
+
export { type GetTableRowProps } from './common';
|
|
133
|
+
export * from './select';
|
|
134
|
+
export { type DataTableContext };
|
|
135
|
+
declare module 'vue' {
|
|
136
|
+
interface GlobalComponents {
|
|
137
|
+
DataTable: DefineComponent<DataTableProps, DataTableSlots, DataTableEmits>;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CheckboxProps } from '@pantograph/vue';
|
|
2
|
+
import { MaybeRef } from 'vue';
|
|
3
|
+
export interface TableSelectProps<T = any> {
|
|
4
|
+
selectedRowKeys: MaybeRef<string[]>;
|
|
5
|
+
selectedRows: MaybeRef<T[]>;
|
|
6
|
+
}
|
|
7
|
+
export type TableRowSelection<T = any> = {
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
checkStrictly?: boolean;
|
|
10
|
+
columnWidth?: string | number;
|
|
11
|
+
getCheckboxProps?: (record: T) => CheckboxProps;
|
|
12
|
+
preserveSelectedRowKeys?: boolean;
|
|
13
|
+
selectedRowKeys?: string[];
|
|
14
|
+
onChange?: (props: TableSelectProps<T>) => void;
|
|
15
|
+
onSelect?: (props: TableSelectProps<T> & {
|
|
16
|
+
selected: boolean;
|
|
17
|
+
record: T;
|
|
18
|
+
}) => void;
|
|
19
|
+
onSelectAll?: (props: TableSelectProps<T> & {
|
|
20
|
+
selected: boolean;
|
|
21
|
+
}) => void;
|
|
22
|
+
getSelectable?: (row: T, index: number) => boolean;
|
|
23
|
+
getOrderable?: (row: T, index: number) => boolean;
|
|
24
|
+
colSpan?: (row: T, index: number) => number;
|
|
25
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './useCell';
|
|
2
|
+
export * from './useCol';
|
|
3
|
+
export * from './useRow';
|
|
4
|
+
export * from './useColumnWrap';
|
|
5
|
+
export * from './useSelection';
|
|
6
|
+
export * from './useSort';
|
|
7
|
+
export * from './useFilter';
|
|
8
|
+
export * from './useColumnSize';
|
|
9
|
+
export * from './useColumnFixed';
|
|
10
|
+
export * from './useColumnOrder';
|
|
11
|
+
export * from './useColumnPopover';
|
|
12
|
+
export * from './useRowOrder';
|
|
13
|
+
export * from './useRowVirtualizer';
|
|
14
|
+
export * from './useInsertBetween';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { TableColumn, TableGetFunctionsProps } from '../types';
|
|
2
|
+
import { SkeletonProps } from '@pantograph/vue';
|
|
3
|
+
import { VNode } from 'vue';
|
|
4
|
+
import { Table } from '@tanstack/vue-table';
|
|
5
|
+
interface RenderCellProps {
|
|
6
|
+
props: {
|
|
7
|
+
column: any;
|
|
8
|
+
row?: any;
|
|
9
|
+
table: Table<unknown>;
|
|
10
|
+
};
|
|
11
|
+
render?: object | never | string;
|
|
12
|
+
customRender?: object | never | string;
|
|
13
|
+
}
|
|
14
|
+
export interface CellActions {
|
|
15
|
+
getSkeletonProps: (column?: TableColumn) => SkeletonProps;
|
|
16
|
+
RenderCell: (data: RenderCellProps) => VNode;
|
|
17
|
+
getThProps: (data: any) => Record<string, any>;
|
|
18
|
+
getTdProps: (data: any) => Record<string, any>;
|
|
19
|
+
getCellParams: (data: any) => TableGetFunctionsProps;
|
|
20
|
+
isThVisible: (headerTrIndex: number, headerTrCount: number, id: string) => boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare const useCell: ({ isColumnWrapped, getOutsideCol }: any) => CellActions;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { DataTableEmits, DataTableProps, DataTableSlots, TableCol, TableColumn } from '../types';
|
|
2
|
+
import { ComputedRef, Ref } from 'vue';
|
|
3
|
+
import { Column } from '@tanstack/vue-table';
|
|
4
|
+
import { EmitType } from '@pantograph/utils-vue';
|
|
5
|
+
export interface ColActions {
|
|
6
|
+
cols: ComputedRef<any[]>;
|
|
7
|
+
colsSize: ComputedRef<Record<string, number | undefined>>;
|
|
8
|
+
autoFitWidth: Ref<string[]>;
|
|
9
|
+
columnOrder: Ref<string[]>;
|
|
10
|
+
columnOrderUpdating: Ref<boolean>;
|
|
11
|
+
actionId: ComputedRef<string>;
|
|
12
|
+
columnVisibility: Ref<Record<string, boolean>>;
|
|
13
|
+
setColumnVisibility: (params: {
|
|
14
|
+
id?: string;
|
|
15
|
+
value?: boolean;
|
|
16
|
+
bulkValue?: Record<string, boolean>;
|
|
17
|
+
}) => void;
|
|
18
|
+
getOutsideCol: (col: any) => TableColumn;
|
|
19
|
+
columnDefaults: {
|
|
20
|
+
size: number;
|
|
21
|
+
minSize: number;
|
|
22
|
+
maxSize: number;
|
|
23
|
+
};
|
|
24
|
+
setAutoFitWidth: (col: Column<unknown>, value: boolean) => void;
|
|
25
|
+
colRefs: Ref<Record<string, HTMLElement>>;
|
|
26
|
+
setColRef: (id: string, col: HTMLElement) => void;
|
|
27
|
+
getColRefSize: (col: TableCol) => number;
|
|
28
|
+
}
|
|
29
|
+
export declare const useCol: ({ props, emit, prefix, slots, getSelectionCol, }: {
|
|
30
|
+
props: DataTableProps;
|
|
31
|
+
emit: EmitType<DataTableEmits>;
|
|
32
|
+
slots: DataTableSlots;
|
|
33
|
+
prefix: string;
|
|
34
|
+
getSelectionCol: () => any;
|
|
35
|
+
}) => ColActions;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { EmitType } from '@pantograph/utils-vue';
|
|
2
|
+
import { Table } from '@tanstack/vue-table';
|
|
3
|
+
import { ComputedRef, Ref } from 'vue';
|
|
4
|
+
import { DataTableEmits, DataTableProps, TableCol } from '../types';
|
|
5
|
+
export interface ColumnFixActions {
|
|
6
|
+
fixedColumn: Ref<undefined | TableCol>;
|
|
7
|
+
fixedCols: ComputedRef<TableCol[]>;
|
|
8
|
+
isColFixed: (column?: TableCol, returnUndefinedAsFalse?: boolean) => boolean | undefined;
|
|
9
|
+
fixUpToColumn: (column: TableCol) => void;
|
|
10
|
+
unfixAllColumns: () => void;
|
|
11
|
+
getBeforeFixedCols: (column: TableCol) => TableCol[];
|
|
12
|
+
getSortedCols: (columns?: TableCol[]) => TableCol[];
|
|
13
|
+
}
|
|
14
|
+
interface UseColumnFixedParams {
|
|
15
|
+
props: DataTableProps;
|
|
16
|
+
emit: EmitType<DataTableEmits>;
|
|
17
|
+
table: Table<unknown>;
|
|
18
|
+
getColRefSize: (col: TableCol) => number;
|
|
19
|
+
tableRootRef: Ref<HTMLElement | undefined>;
|
|
20
|
+
setColumnSizing: (columnSizing: Record<string, number>) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare const useColumnFix: ({ props, emit, table, getColRefSize, tableRootRef, setColumnSizing, }: UseColumnFixedParams) => ColumnFixActions;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { DataTableEmits, DataTableProps } from '../types';
|
|
2
|
+
import { Table } from '@tanstack/vue-table';
|
|
3
|
+
import { ComputedRef, Ref } from 'vue';
|
|
4
|
+
import { SortableEvent } from '@pantograph/sortable';
|
|
5
|
+
import { EmitType } from '@pantograph/utils-vue';
|
|
6
|
+
/**
|
|
7
|
+
* Actions interface for managing column order operations
|
|
8
|
+
*/
|
|
9
|
+
export interface ColumnOrderActions {
|
|
10
|
+
updateColumnOrder: () => void;
|
|
11
|
+
updateColumnOrderFromDOM: (event: SortableEvent, depth: number) => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Hook for managing column ordering in data tables
|
|
15
|
+
*
|
|
16
|
+
* @param columnOrder - Reactive reference to current column order
|
|
17
|
+
* @param columnOrderUpdating - Flag to prevent update loops
|
|
18
|
+
* @param props - DataTable component props
|
|
19
|
+
* @param emit - DataTable component emits
|
|
20
|
+
* @param selectionId - ID of selection column
|
|
21
|
+
* @param actionId - ID of action column
|
|
22
|
+
* @param table - TanStack table instance
|
|
23
|
+
*/
|
|
24
|
+
export declare const useColumnOrder: ({ columnOrder, columnOrderUpdating, props, emit, selectionId, actionId, table, }: {
|
|
25
|
+
columnOrder: Ref<string[]>;
|
|
26
|
+
columnOrderUpdating: Ref<boolean>;
|
|
27
|
+
props: DataTableProps;
|
|
28
|
+
emit: EmitType<DataTableEmits>;
|
|
29
|
+
selectionId: string;
|
|
30
|
+
actionId: ComputedRef<string>;
|
|
31
|
+
table: Table<unknown>;
|
|
32
|
+
}) => ColumnOrderActions;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { TableCol } from '../types';
|
|
3
|
+
import { PopoverProps } from '@pantograph/vue';
|
|
4
|
+
import { DebouncedFunction } from 'es-toolkit';
|
|
5
|
+
type OpenState = 'open' | 'closed';
|
|
6
|
+
export interface ColumnPopoverActions {
|
|
7
|
+
open: Ref<boolean>;
|
|
8
|
+
reference: Ref<PopoverProps['reference']>;
|
|
9
|
+
parentReference: Ref<PopoverProps['reference']>;
|
|
10
|
+
column: Ref<TableCol | undefined>;
|
|
11
|
+
getActionState: (_column: TableCol) => OpenState;
|
|
12
|
+
openHoverCard: (e: PointerEvent, _column: TableCol) => void;
|
|
13
|
+
debounceOpenHoverCard: DebouncedFunction<(e: PointerEvent, _column: TableCol) => void>;
|
|
14
|
+
closeHoverCard: () => void;
|
|
15
|
+
onPointerDown: (e: PointerEvent, _column: TableCol) => void;
|
|
16
|
+
debounceCloseHoverCard: DebouncedFunction<() => void>;
|
|
17
|
+
}
|
|
18
|
+
export declare const useColumnPopover: () => ColumnPopoverActions;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TableCol } from '../types';
|
|
2
|
+
import { Ref } from 'vue';
|
|
3
|
+
import { ColActions } from './useCol';
|
|
4
|
+
import { Table } from '@tanstack/vue-table';
|
|
5
|
+
export interface ColumnSizeActions {
|
|
6
|
+
getColSizeStyle: (column: TableCol, isFixed?: boolean, getSortedCols?: (columns: TableCol[]) => TableCol[]) => Record<string, any>;
|
|
7
|
+
setColumnSizing: (columnSizing: Record<string, number>) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const useColumnSize: ({ hideShadowColumn, col, table, setColumnSizingLocallyReset, }: {
|
|
10
|
+
hideShadowColumn: Ref<boolean>;
|
|
11
|
+
col: ColActions;
|
|
12
|
+
table: Table<unknown>;
|
|
13
|
+
setColumnSizingLocallyReset: (value: boolean) => void;
|
|
14
|
+
}) => ColumnSizeActions;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DataTableProps, DataTableEmits, TableCol } from '../types';
|
|
2
|
+
import { EmitType } from '@pantograph/utils-vue';
|
|
3
|
+
export interface ColumnWrapActions {
|
|
4
|
+
isColumnWrapped: (id?: string) => boolean;
|
|
5
|
+
toggleWrap: (column: TableCol) => boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const useColumnWrap: (props: DataTableProps, emit: EmitType<DataTableEmits>, defaultWrappedIds: string[]) => ColumnWrapActions;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { EmitType } from '@pantograph/utils-vue';
|
|
2
|
+
import { PopoverProps } from '@pantograph/vue';
|
|
3
|
+
import { Ref } from 'vue';
|
|
4
|
+
import { DataTableEmits, DataTableProps, TableCol } from '../types';
|
|
5
|
+
export interface FilterActions {
|
|
6
|
+
colFilter: (placement: PopoverProps['placement'], reference: PopoverProps['reference'], col: TableCol) => void;
|
|
7
|
+
deleteColFilter: (placement: PopoverProps['placement'], reference: PopoverProps['reference'], col: TableCol) => void;
|
|
8
|
+
filteredCols: Ref<string[]>;
|
|
9
|
+
isColumnFiltered: (id?: string) => boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const useFilter: ({ props, emit, }: {
|
|
12
|
+
props: DataTableProps;
|
|
13
|
+
emit: EmitType<DataTableEmits>;
|
|
14
|
+
}) => FilterActions;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DataTableProps } from '../types';
|
|
2
|
+
import { Ref } from 'vue';
|
|
3
|
+
import { ExpandedState } from '@tanstack/vue-table';
|
|
4
|
+
export interface RowActions {
|
|
5
|
+
expanded: Ref<ExpandedState>;
|
|
6
|
+
}
|
|
7
|
+
export declare const useRow: ({ props }: {
|
|
8
|
+
props: DataTableProps;
|
|
9
|
+
}) => RowActions;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { Row } from '@tanstack/table-core';
|
|
2
|
+
import { ComputedRef } from 'vue';
|
|
3
|
+
import { DataTableContext } from '../types';
|
|
4
|
+
interface RowSortableParams {
|
|
5
|
+
context: DataTableContext;
|
|
6
|
+
hasSubRows: ComputedRef<boolean>;
|
|
7
|
+
visibleFlattenRows: ComputedRef<Row<unknown>[]>;
|
|
8
|
+
getShouldCollapseParent: (row: Row<unknown>) => boolean | undefined;
|
|
9
|
+
getTableBindings: (_class?: string) => Record<string, any>;
|
|
10
|
+
}
|
|
11
|
+
export declare const useRowOrder: ({ context, hasSubRows: _hasSubRows, visibleFlattenRows, getShouldCollapseParent, getTableBindings, }: RowSortableParams) => {
|
|
12
|
+
id: ComputedRef<any>;
|
|
13
|
+
draggedRow: import('vue').Ref<{
|
|
14
|
+
_getAllCellsByColumnId: () => Record<string, import('@tanstack/table-core').Cell<unknown, unknown>>;
|
|
15
|
+
_uniqueValuesCache: Record<string, unknown>;
|
|
16
|
+
_valuesCache: Record<string, unknown>;
|
|
17
|
+
depth: number;
|
|
18
|
+
getAllCells: () => import('@tanstack/table-core').Cell<unknown, unknown>[];
|
|
19
|
+
getLeafRows: () => Row<unknown>[];
|
|
20
|
+
getParentRow: () => Row<unknown> | undefined;
|
|
21
|
+
getParentRows: () => Row<unknown>[];
|
|
22
|
+
getUniqueValues: <TValue>(columnId: string) => TValue[];
|
|
23
|
+
getValue: <TValue_1>(columnId: string) => TValue_1;
|
|
24
|
+
id: string;
|
|
25
|
+
index: number;
|
|
26
|
+
original: unknown;
|
|
27
|
+
originalSubRows?: unknown[] | undefined;
|
|
28
|
+
parentId?: string | undefined;
|
|
29
|
+
renderValue: <TValue_2>(columnId: string) => TValue_2;
|
|
30
|
+
subRows: any[];
|
|
31
|
+
_getAllVisibleCells: () => import('@tanstack/table-core').Cell<unknown, unknown>[];
|
|
32
|
+
getVisibleCells: () => import('@tanstack/table-core').Cell<unknown, unknown>[];
|
|
33
|
+
getCenterVisibleCells: () => import('@tanstack/table-core').Cell<unknown, unknown>[];
|
|
34
|
+
getLeftVisibleCells: () => import('@tanstack/table-core').Cell<unknown, unknown>[];
|
|
35
|
+
getRightVisibleCells: () => import('@tanstack/table-core').Cell<unknown, unknown>[];
|
|
36
|
+
getCanPin: () => boolean;
|
|
37
|
+
getIsPinned: () => import('@tanstack/table-core').RowPinningPosition;
|
|
38
|
+
getPinnedIndex: () => number;
|
|
39
|
+
pin: (position: import('@tanstack/table-core').RowPinningPosition, includeLeafRows?: boolean | undefined, includeParentRows?: boolean | undefined) => void;
|
|
40
|
+
columnFilters: Record<string, boolean>;
|
|
41
|
+
columnFiltersMeta: Record<string, import('@tanstack/table-core').FilterMeta>;
|
|
42
|
+
_groupingValuesCache: Record<string, any>;
|
|
43
|
+
getGroupingValue: (columnId: string) => unknown;
|
|
44
|
+
getIsGrouped: () => boolean;
|
|
45
|
+
groupingColumnId?: string | undefined;
|
|
46
|
+
groupingValue?: unknown;
|
|
47
|
+
getCanMultiSelect: () => boolean;
|
|
48
|
+
getCanSelect: () => boolean;
|
|
49
|
+
getCanSelectSubRows: () => boolean;
|
|
50
|
+
getIsAllSubRowsSelected: () => boolean;
|
|
51
|
+
getIsSelected: () => boolean;
|
|
52
|
+
getIsSomeSelected: () => boolean;
|
|
53
|
+
getToggleSelectedHandler: () => (event: unknown) => void;
|
|
54
|
+
toggleSelected: (value?: boolean | undefined, opts?: {
|
|
55
|
+
selectChildren?: boolean | undefined;
|
|
56
|
+
} | undefined) => void;
|
|
57
|
+
getCanExpand: () => boolean;
|
|
58
|
+
getIsAllParentsExpanded: () => boolean;
|
|
59
|
+
getIsExpanded: () => boolean;
|
|
60
|
+
getToggleExpandedHandler: () => () => void;
|
|
61
|
+
toggleExpanded: (expanded?: boolean | undefined) => void;
|
|
62
|
+
} | undefined, Row<unknown> | {
|
|
63
|
+
_getAllCellsByColumnId: () => Record<string, import('@tanstack/table-core').Cell<unknown, unknown>>;
|
|
64
|
+
_uniqueValuesCache: Record<string, unknown>;
|
|
65
|
+
_valuesCache: Record<string, unknown>;
|
|
66
|
+
depth: number;
|
|
67
|
+
getAllCells: () => import('@tanstack/table-core').Cell<unknown, unknown>[];
|
|
68
|
+
getLeafRows: () => Row<unknown>[];
|
|
69
|
+
getParentRow: () => Row<unknown> | undefined;
|
|
70
|
+
getParentRows: () => Row<unknown>[];
|
|
71
|
+
getUniqueValues: <TValue>(columnId: string) => TValue[];
|
|
72
|
+
getValue: <TValue_1>(columnId: string) => TValue_1;
|
|
73
|
+
id: string;
|
|
74
|
+
index: number;
|
|
75
|
+
original: unknown;
|
|
76
|
+
originalSubRows?: unknown[] | undefined;
|
|
77
|
+
parentId?: string | undefined;
|
|
78
|
+
renderValue: <TValue_2>(columnId: string) => TValue_2;
|
|
79
|
+
subRows: any[];
|
|
80
|
+
_getAllVisibleCells: () => import('@tanstack/table-core').Cell<unknown, unknown>[];
|
|
81
|
+
getVisibleCells: () => import('@tanstack/table-core').Cell<unknown, unknown>[];
|
|
82
|
+
getCenterVisibleCells: () => import('@tanstack/table-core').Cell<unknown, unknown>[];
|
|
83
|
+
getLeftVisibleCells: () => import('@tanstack/table-core').Cell<unknown, unknown>[];
|
|
84
|
+
getRightVisibleCells: () => import('@tanstack/table-core').Cell<unknown, unknown>[];
|
|
85
|
+
getCanPin: () => boolean;
|
|
86
|
+
getIsPinned: () => import('@tanstack/table-core').RowPinningPosition;
|
|
87
|
+
getPinnedIndex: () => number;
|
|
88
|
+
pin: (position: import('@tanstack/table-core').RowPinningPosition, includeLeafRows?: boolean | undefined, includeParentRows?: boolean | undefined) => void;
|
|
89
|
+
columnFilters: Record<string, boolean>;
|
|
90
|
+
columnFiltersMeta: Record<string, import('@tanstack/table-core').FilterMeta>;
|
|
91
|
+
_groupingValuesCache: Record<string, any>;
|
|
92
|
+
getGroupingValue: (columnId: string) => unknown;
|
|
93
|
+
getIsGrouped: () => boolean;
|
|
94
|
+
groupingColumnId?: string | undefined;
|
|
95
|
+
groupingValue?: unknown;
|
|
96
|
+
getCanMultiSelect: () => boolean;
|
|
97
|
+
getCanSelect: () => boolean;
|
|
98
|
+
getCanSelectSubRows: () => boolean;
|
|
99
|
+
getIsAllSubRowsSelected: () => boolean;
|
|
100
|
+
getIsSelected: () => boolean;
|
|
101
|
+
getIsSomeSelected: () => boolean;
|
|
102
|
+
getToggleSelectedHandler: () => (event: unknown) => void;
|
|
103
|
+
toggleSelected: (value?: boolean | undefined, opts?: {
|
|
104
|
+
selectChildren?: boolean | undefined;
|
|
105
|
+
} | undefined) => void;
|
|
106
|
+
getCanExpand: () => boolean;
|
|
107
|
+
getIsAllParentsExpanded: () => boolean;
|
|
108
|
+
getIsExpanded: () => boolean;
|
|
109
|
+
getToggleExpandedHandler: () => () => void;
|
|
110
|
+
toggleExpanded: (expanded?: boolean | undefined) => void;
|
|
111
|
+
} | undefined>;
|
|
112
|
+
isMultiDrag: ComputedRef<boolean>;
|
|
113
|
+
};
|
|
114
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ComputedRef, Ref } from 'vue';
|
|
2
|
+
import { DataTableContext } from '../types';
|
|
3
|
+
interface VirtualizerParams {
|
|
4
|
+
context: DataTableContext;
|
|
5
|
+
dataAndLoadingRows: ComputedRef<any[]>;
|
|
6
|
+
scrollRef: Ref<any>;
|
|
7
|
+
}
|
|
8
|
+
export declare const useRowVirtualizer: ({ context, dataAndLoadingRows, scrollRef, }: VirtualizerParams) => {
|
|
9
|
+
visibleItems: ComputedRef<any[]>;
|
|
10
|
+
trHeight: ComputedRef<string | number | undefined>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|