@cobre-npm/ds-v3 0.140.0 → 0.142.0
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/dist/cobre-ds-v3-lib.es.js +6918 -6755
- package/dist/style.css +1 -1
- package/dist/types/components/organisms/CobreTable/CobreTable.vue.d.ts +38 -1
- package/dist/types/components/organisms/CobreTable/useColumnGrouping.d.ts +24 -0
- package/dist/types/components/organisms/CobreTable/useColumnPinning.d.ts +33 -0
- package/dist/types/components/organisms/CobreTable/useColumnReorder.d.ts +17 -8
- package/dist/types/components/organisms/CobreTable/useColumnResizing.d.ts +14 -0
- package/package.json +1 -1
|
@@ -51,6 +51,31 @@ export interface CobreTableProps<T> {
|
|
|
51
51
|
* focus, keyboard handling).
|
|
52
52
|
*/
|
|
53
53
|
enableColumnReorder?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Enable pinning columns to the left or right edge of the table, staying visible during
|
|
56
|
+
* horizontal scroll. Requires the table to also control columnPinning state
|
|
57
|
+
* (state: { columnPinning } + onColumnPinningChange) for the pin to persist — this prop only
|
|
58
|
+
* toggles the sticky rendering/affordances.
|
|
59
|
+
*/
|
|
60
|
+
enableColumnPinning?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Labels for the pin/unpin actions in each column's kebab menu (shown when
|
|
63
|
+
* enableColumnPinning is on). Defaults to Spanish, matching this component's other
|
|
64
|
+
* built-in text (e.g. emptyStateProps) — pass overrides to localize.
|
|
65
|
+
*/
|
|
66
|
+
pinMenuLabels?: {
|
|
67
|
+
pinLeft?: string;
|
|
68
|
+
pinRight?: string;
|
|
69
|
+
unpin?: string;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Enable dragging a column header's right edge to resize it live, respecting each column's
|
|
73
|
+
* minSize/maxSize. Requires the table to also set columnResizeMode: 'onChange' (so width
|
|
74
|
+
* updates while dragging, not just on release) and control columnSizing state
|
|
75
|
+
* (state: { columnSizing } + onColumnSizingChange) for the new size to persist — this prop
|
|
76
|
+
* only toggles the resize handle affordance.
|
|
77
|
+
*/
|
|
78
|
+
enableColumnResizing?: boolean;
|
|
54
79
|
}
|
|
55
80
|
declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
56
81
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
@@ -65,7 +90,14 @@ declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>
|
|
|
65
90
|
columnId: string;
|
|
66
91
|
method: ColumnReorderMethod;
|
|
67
92
|
}) => any) | undefined;
|
|
68
|
-
|
|
93
|
+
readonly "onColumn-pin"?: ((payload: {
|
|
94
|
+
columnId: string;
|
|
95
|
+
side: "left" | "right";
|
|
96
|
+
}) => any) | undefined;
|
|
97
|
+
readonly "onColumn-unpin"?: ((payload: {
|
|
98
|
+
columnId: string;
|
|
99
|
+
}) => any) | undefined;
|
|
100
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onColumn-reorder" | "onColumn-reorder-cancel" | "onColumn-pin" | "onColumn-unpin"> & CobreTableProps<T> & Partial<{}>> & import("vue").PublicProps;
|
|
69
101
|
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
70
102
|
attrs: any;
|
|
71
103
|
slots: {
|
|
@@ -85,6 +117,11 @@ declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>
|
|
|
85
117
|
}) => void) & ((evt: "column-reorder-cancel", payload: {
|
|
86
118
|
columnId: string;
|
|
87
119
|
method: ColumnReorderMethod;
|
|
120
|
+
}) => void) & ((evt: "column-pin", payload: {
|
|
121
|
+
columnId: string;
|
|
122
|
+
side: "left" | "right";
|
|
123
|
+
}) => void) & ((evt: "column-unpin", payload: {
|
|
124
|
+
columnId: string;
|
|
88
125
|
}) => void);
|
|
89
126
|
}>) => import("vue").VNode & {
|
|
90
127
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Table as TanStackTable } from '@tanstack/vue-table';
|
|
2
|
+
export interface ColumnGroupingColumnMeta {
|
|
3
|
+
/**
|
|
4
|
+
* Id of this column's "leader" column. When set, this column moves and pins as a single
|
|
5
|
+
* unit with that leader instead of independently — for columns without their own header
|
|
6
|
+
* that ride along a primary one (e.g. a currency code or country flag next to an amount
|
|
7
|
+
* column).
|
|
8
|
+
*/
|
|
9
|
+
groupWith?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Column grouping for CobreTable: reads the `meta.groupWith` primitive off each ColumnDef —
|
|
13
|
+
* no enable flag, it's always honored wherever set — so a handful of related columns without
|
|
14
|
+
* their own header move/pin as a unit with a "leader" column instead of independently. Purely
|
|
15
|
+
* derived from static ColumnDef meta plus the table's current columns, no state of its own —
|
|
16
|
+
* useColumnReorder and useColumnPinning each call `canonicalizeOrder` at the exact points
|
|
17
|
+
* where they'd otherwise commit an order that could split a group, and read `isGroupFollower`
|
|
18
|
+
* to exclude followers from independent drag/pin.
|
|
19
|
+
*/
|
|
20
|
+
export declare function useColumnGrouping<T>(table: TanStackTable<T>): {
|
|
21
|
+
isGroupFollower: (columnId: string) => boolean;
|
|
22
|
+
getGroupFollowerIds: (leaderId: string) => string[];
|
|
23
|
+
canonicalizeOrder: (order: string[]) => string[];
|
|
24
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ComputedRef, CSSProperties } from 'vue';
|
|
2
|
+
import type { Column, Table as TanStackTable, ColumnPinningPosition } from '@tanstack/vue-table';
|
|
3
|
+
export interface ColumnPinningEmits {
|
|
4
|
+
(event: 'column-pin', payload: {
|
|
5
|
+
columnId: string;
|
|
6
|
+
side: 'left' | 'right';
|
|
7
|
+
}): void;
|
|
8
|
+
(event: 'column-unpin', payload: {
|
|
9
|
+
columnId: string;
|
|
10
|
+
}): void;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Column pinning for CobreTable, wired to a TanStack table instance. Requires the table to
|
|
14
|
+
* control columnPinning state (state: { columnPinning } + onColumnPinningChange) for pin
|
|
15
|
+
* changes to persist — this composable only mutates table.setColumnPinning(); persistence
|
|
16
|
+
* is the consumer's responsibility (e.g. useDataTable).
|
|
17
|
+
*
|
|
18
|
+
* Sticky offsets come straight from TanStack's own column.getStart/getAfter — no hand-rolled
|
|
19
|
+
* offset math needed. Rendering pinned columns at the table edges is useColumnReorder's own
|
|
20
|
+
* orderedColumnIds computed, which reads this same columnPinning state directly — this
|
|
21
|
+
* composable only mutates it (via column.pin()), it doesn't reorder anything itself.
|
|
22
|
+
*
|
|
23
|
+
* A column with meta.groupWith (see useColumnGrouping) has no pin state of its own — pinning
|
|
24
|
+
* a leader cascades to its followers by adding all of them to columnPinning.left/right
|
|
25
|
+
* together, so TanStack's own getStart/getAfter keep working unmodified for followers too.
|
|
26
|
+
*/
|
|
27
|
+
export declare function useColumnPinning<T>(table: TanStackTable<T>, isEnabled: ComputedRef<boolean>, emit: ColumnPinningEmits): {
|
|
28
|
+
getIsPinned: (columnId: string) => ColumnPinningPosition;
|
|
29
|
+
isColumnIdPinned: (columnId: string) => boolean;
|
|
30
|
+
pinColumn: (columnId: string, side: ColumnPinningPosition) => void;
|
|
31
|
+
pinnedStyleFor: (column: Column<T>, baseLeftOffsetPx?: number) => CSSProperties;
|
|
32
|
+
isPinnedBoundary: (column: Column<T>) => boolean;
|
|
33
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type { Table as TanStackTable
|
|
1
|
+
import { type ComponentPublicInstance, type ComputedRef } from 'vue';
|
|
2
|
+
import type { Header, HeaderGroup, Table as TanStackTable } from '@tanstack/vue-table';
|
|
3
3
|
/** Method used to trigger a column reorder */
|
|
4
4
|
export type ColumnReorderMethod = 'pointer' | 'keyboard';
|
|
5
5
|
export interface ColumnReorderEmits {
|
|
@@ -16,13 +16,22 @@ export interface ColumnReorderEmits {
|
|
|
16
16
|
}): void;
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
|
-
* Drag-and-drop and keyboard column reordering for CobreTable,
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
19
|
+
* Drag-and-drop and keyboard column reordering for CobreTable,
|
|
20
|
+
* wired to a TanStack table instance.
|
|
21
|
+
*
|
|
22
|
+
* Requires the table to control columnOrder state:
|
|
23
|
+
*
|
|
24
|
+
* state: { columnOrder }
|
|
25
|
+
* onColumnOrderChange
|
|
26
|
+
*
|
|
27
|
+
* Structural headers such as bulk actions and row actions are
|
|
28
|
+
* excluded from FormKit's draggable nodes through `draggable`.
|
|
29
|
+
*
|
|
30
|
+
* Actual TanStack columns that cannot be reordered are excluded
|
|
31
|
+
* through `draggableValue`.
|
|
23
32
|
*/
|
|
24
|
-
export declare function useColumnReorder<T>(table: TanStackTable<T>, isEnabled: ComputedRef<boolean>, emit: ColumnReorderEmits): {
|
|
25
|
-
orderedColumnIds:
|
|
33
|
+
export declare function useColumnReorder<T>(table: TanStackTable<T>, isEnabled: ComputedRef<boolean>, isPinningEnabled: ComputedRef<boolean>, emit: ColumnReorderEmits): {
|
|
34
|
+
orderedColumnIds: ComputedRef<string[]>;
|
|
26
35
|
setHeaderRowEl: (el: Element | ComponentPublicInstance | null) => void;
|
|
27
36
|
setHeaderElRef: (columnId: string, el: Element | ComponentPublicInstance | null) => void;
|
|
28
37
|
isColumnIdDraggable: (columnId: string) => boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ComputedRef, CSSProperties } from 'vue';
|
|
2
|
+
import type { Column, Header } from '@tanstack/vue-table';
|
|
3
|
+
/**
|
|
4
|
+
* Column resizing for CobreTable, driven by TanStack's columnSizing state and
|
|
5
|
+
* header.getResizeHandler(). Requires the table to also set columnResizeMode: 'onChange' (so
|
|
6
|
+
* width updates while dragging, not just on release) and control columnSizing state
|
|
7
|
+
* (state: { columnSizing } + onColumnSizingChange) for the new size to persist — persistence
|
|
8
|
+
* is the consumer's responsibility (e.g. useDataTable).
|
|
9
|
+
*/
|
|
10
|
+
export declare function useColumnResizing<T>(isEnabled: ComputedRef<boolean>): {
|
|
11
|
+
isColumnResizable: (column: Column<T, unknown>) => boolean;
|
|
12
|
+
resizingStyleFor: (column: Column<T, unknown>) => CSSProperties;
|
|
13
|
+
handleResizeStart: (event: MouseEvent | TouchEvent, header: Header<T, unknown>) => void;
|
|
14
|
+
};
|