@cobre-npm/ds-v3 0.141.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.
@@ -68,6 +68,14 @@ export interface CobreTableProps<T> {
68
68
  pinRight?: string;
69
69
  unpin?: string;
70
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;
71
79
  }
72
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<{
73
81
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
@@ -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
+ };
@@ -1,4 +1,4 @@
1
- import type { ComputedRef, CSSProperties, Ref } from 'vue';
1
+ import type { ComputedRef, CSSProperties } from 'vue';
2
2
  import type { Column, Table as TanStackTable, ColumnPinningPosition } from '@tanstack/vue-table';
3
3
  export interface ColumnPinningEmits {
4
4
  (event: 'column-pin', payload: {
@@ -16,12 +16,18 @@ export interface ColumnPinningEmits {
16
16
  * is the consumer's responsibility (e.g. useDataTable).
17
17
  *
18
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.
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.
21
26
  */
22
- export declare function useColumnPinning<T>(table: TanStackTable<T>, isEnabled: ComputedRef<boolean>, orderedColumnIds: Ref<string[]>, emit: ColumnPinningEmits): {
27
+ export declare function useColumnPinning<T>(table: TanStackTable<T>, isEnabled: ComputedRef<boolean>, emit: ColumnPinningEmits): {
23
28
  getIsPinned: (columnId: string) => ColumnPinningPosition;
24
29
  isColumnIdPinned: (columnId: string) => boolean;
25
30
  pinColumn: (columnId: string, side: ColumnPinningPosition) => void;
26
31
  pinnedStyleFor: (column: Column<T>, baseLeftOffsetPx?: number) => CSSProperties;
32
+ isPinnedBoundary: (column: Column<T>) => boolean;
27
33
  };
@@ -1,5 +1,5 @@
1
- import { type ComputedRef, type ComponentPublicInstance } from 'vue';
2
- import type { Table as TanStackTable, Header, HeaderGroup } from '@tanstack/vue-table';
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, wired to a TanStack table
20
- * instance. Requires the table to control columnOrder state (state: { columnOrder } +
21
- * onColumnOrderChange) for the new order to persist — this composable only mutates
22
- * table.setColumnOrder(); persistence is the consumer's responsibility (e.g. useDataTable).
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
33
  export declare function useColumnReorder<T>(table: TanStackTable<T>, isEnabled: ComputedRef<boolean>, isPinningEnabled: ComputedRef<boolean>, emit: ColumnReorderEmits): {
25
- orderedColumnIds: import("vue").Ref<string[], string[]>;
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
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cobre-npm/ds-v3",
3
- "version": "0.141.0",
3
+ "version": "0.142.0",
4
4
  "type": "module",
5
5
  "packageManager": "pnpm@11.0.4",
6
6
  "engines": {