lizaui 14.0.5 → 14.0.6

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.
@@ -11,7 +11,30 @@ interface TableReorderEvent<TData = unknown> {
11
11
  };
12
12
  /** The full data array after applying the move; ready to store as the new order. */
13
13
  reorderedData: TData[];
14
+ /** Absolute position (`indexOffset` + page index) of the first moved row before the move. */
15
+ fromIndex: number;
16
+ /** Absolute position of the first moved row after the move. */
17
+ toIndex: number;
18
+ /** Every row of `data` in its new order with its absolute position, ready to persist. */
19
+ positions: TableRowPosition<TData>[];
14
20
  }
21
+ /** A row and its absolute position (0-based, `indexOffset` included). */
22
+ interface TableRowPosition<TData = unknown> {
23
+ key: string;
24
+ item: TData;
25
+ index: number;
26
+ }
27
+ /** Fired by "Mover a posición…" (`onMoveToPosition`): one row to an absolute position, possibly on another page. */
28
+ interface TableMoveToPositionEvent<TData = unknown> {
29
+ key: string;
30
+ item: TData;
31
+ /** Absolute position (0-based) before the move. */
32
+ fromIndex: number;
33
+ /** Absolute position (0-based) requested, clamped to `0 … totalCount - 1`. */
34
+ toIndex: number;
35
+ }
36
+ /** What `onReorder` / `onMoveToPosition` may return: a promise turns on the optimistic, busy and rollback flow. */
37
+ type TableReorderResult = void | Promise<unknown>;
15
38
  export interface TableKeyCurrent {
16
39
  id: string;
17
40
  name: string;
@@ -74,6 +97,12 @@ interface TableShareProps {
74
97
  * `sortDescriptor` is active, since the visual order is then derived.
75
98
  */
76
99
  isReorderable?: boolean;
100
+ /**
101
+ * Disables the handles without removing their column (no layout shift). A string is the reason,
102
+ * shown on hover and read by screen readers (e.g. "Quita la búsqueda para cambiar el orden").
103
+ * Use it whenever the visible order is not the real one: a search, a filter, a grouped view.
104
+ */
105
+ reorderDisabled?: boolean | string;
77
106
  sortDescriptor?: SortDescriptor | null;
78
107
  onSortChange?: (column: string) => void;
79
108
  columnWidths?: ColumnWidths;
@@ -204,8 +233,25 @@ interface TableBodyProps<TData> {
204
233
  * Fired when a row (or the selection it belongs to) is dropped in a new
205
234
  * position. Requires `isReorderable` on the table and a `rowKey` that
206
235
  * matches each row's `keyCurrent.id`.
236
+ *
237
+ * Returning a promise (e.g. the save request) makes the table show the new
238
+ * order right away, disable the handles until it settles and roll back if
239
+ * it rejects. The optimistic order lasts until `data` changes.
240
+ */
241
+ onReorder?: (event: TableReorderEvent<TData>) => TableReorderResult;
242
+ /**
243
+ * Absolute position of the first row of `data` (e.g. `(page - 1) * limit`).
244
+ * Added to `fromIndex`, `toIndex` and `positions` so they can be saved as is.
245
+ */
246
+ indexOffset?: number;
247
+ /**
248
+ * Enables "Mover a posición…" on the handles (double click or Shift+Enter):
249
+ * moves one row to an absolute position, also to another page. Pair it with
250
+ * `totalCount`. A returned promise disables the handles until it settles.
207
251
  */
208
- onReorder?: (event: TableReorderEvent<TData>) => void;
252
+ onMoveToPosition?: (event: TableMoveToPositionEvent<TData>) => TableReorderResult;
253
+ /** Total rows across all pages; upper bound for "Mover a posición…". Defaults to `indexOffset + data.length`. */
254
+ totalCount?: number;
209
255
  }
210
256
  interface TableBodyRowProps {
211
257
  className?: string;
@@ -249,4 +295,4 @@ interface TableProps {
249
295
  persistKey?: string;
250
296
  }
251
297
  export declare const useTable: ({ initialDisabledKeys, initialSelectKey, initialValueSearch, initialSortDescriptor, initialColumnWidths, initialHiddenColumns, persistKey }: TableProps) => TableHookProps;
252
- export type { TableDropPosition, TableReorderEvent };
298
+ export type { TableDropPosition, TableMoveToPositionEvent, TableReorderEvent, TableReorderResult, TableRowPosition };