@cobre-npm/ds-v3 0.140.0 → 0.141.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.
@@ -51,6 +51,23 @@ 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
+ };
54
71
  }
55
72
  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
73
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
@@ -65,7 +82,14 @@ declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>
65
82
  columnId: string;
66
83
  method: ColumnReorderMethod;
67
84
  }) => any) | undefined;
68
- } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onColumn-reorder" | "onColumn-reorder-cancel"> & CobreTableProps<T> & Partial<{}>> & import("vue").PublicProps;
85
+ readonly "onColumn-pin"?: ((payload: {
86
+ columnId: string;
87
+ side: "left" | "right";
88
+ }) => any) | undefined;
89
+ readonly "onColumn-unpin"?: ((payload: {
90
+ columnId: string;
91
+ }) => any) | undefined;
92
+ } & 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
93
  expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
70
94
  attrs: any;
71
95
  slots: {
@@ -85,6 +109,11 @@ declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>
85
109
  }) => void) & ((evt: "column-reorder-cancel", payload: {
86
110
  columnId: string;
87
111
  method: ColumnReorderMethod;
112
+ }) => void) & ((evt: "column-pin", payload: {
113
+ columnId: string;
114
+ side: "left" | "right";
115
+ }) => void) & ((evt: "column-unpin", payload: {
116
+ columnId: string;
88
117
  }) => void);
89
118
  }>) => import("vue").VNode & {
90
119
  __ctx?: Awaited<typeof __VLS_setup>;
@@ -0,0 +1,27 @@
1
+ import type { ComputedRef, CSSProperties, Ref } 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. The one thing this composable owns is repartitioning `orderedColumnIds`
20
+ * on pin/unpin so pinned columns render at the table edges.
21
+ */
22
+ export declare function useColumnPinning<T>(table: TanStackTable<T>, isEnabled: ComputedRef<boolean>, orderedColumnIds: Ref<string[]>, emit: ColumnPinningEmits): {
23
+ getIsPinned: (columnId: string) => ColumnPinningPosition;
24
+ isColumnIdPinned: (columnId: string) => boolean;
25
+ pinColumn: (columnId: string, side: ColumnPinningPosition) => void;
26
+ pinnedStyleFor: (column: Column<T>, baseLeftOffsetPx?: number) => CSSProperties;
27
+ };
@@ -21,7 +21,7 @@ export interface ColumnReorderEmits {
21
21
  * onColumnOrderChange) for the new order to persist — this composable only mutates
22
22
  * table.setColumnOrder(); persistence is the consumer's responsibility (e.g. useDataTable).
23
23
  */
24
- export declare function useColumnReorder<T>(table: TanStackTable<T>, isEnabled: ComputedRef<boolean>, emit: ColumnReorderEmits): {
24
+ export declare function useColumnReorder<T>(table: TanStackTable<T>, isEnabled: ComputedRef<boolean>, isPinningEnabled: ComputedRef<boolean>, emit: ColumnReorderEmits): {
25
25
  orderedColumnIds: import("vue").Ref<string[], string[]>;
26
26
  setHeaderRowEl: (el: Element | ComponentPublicInstance | null) => void;
27
27
  setHeaderElRef: (columnId: string, el: Element | ComponentPublicInstance | null) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cobre-npm/ds-v3",
3
- "version": "0.140.0",
3
+ "version": "0.141.0",
4
4
  "type": "module",
5
5
  "packageManager": "pnpm@11.0.4",
6
6
  "engines": {