@starasia/admin 8.19.2 → 8.20.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.
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { TableLayoutProps } from './types';
|
|
3
3
|
|
|
4
|
-
export declare const TableLayout: <T>({ columns, data, getRowKey, rowBg, size, resizable, layout, widthStorageKey, columnState, onColumnStateChange, columnMenu, sort, defaultSort, onSortChange, height, mobileLayout, mobileBreakpoint, groupSeparator, summary, emptyState, loading, loadingRows, rowActions, }: TableLayoutProps<T>) => React.JSX.Element;
|
|
4
|
+
export declare const TableLayout: <T>({ columns, data, getRowKey, rowBg, size, resizable, layout, widthStorageKey, columnState, onColumnStateChange, columnMenu, sort, defaultSort, onSortChange, height, mobileLayout, mobileBreakpoint, groupSeparator, summary, emptyState, loading, loadingRows, rowActions, selectable, selectedKeys, defaultSelectedKeys, onSelectionChange, isRowSelectable, }: TableLayoutProps<T>) => React.JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { TableLayout } from './TableLayout';
|
|
2
2
|
export { ColumnMenu } from './ColumnMenu';
|
|
3
3
|
export { useTableSortApiParams, type UseTableSortApiParamsOptions, type TableSortApiParams } from './hooks/useTableSortApiParams';
|
|
4
|
-
export type { TableLayoutProps, TableLayoutColumn, TableLayoutColor, TableLayoutAlign, TableLayoutColumnState, TableLayoutCellProps, TableLayoutSort, TableLayoutSortDirection, TableLayoutRowAction } from './types';
|
|
4
|
+
export type { TableLayoutProps, TableLayoutColumn, TableLayoutColor, TableLayoutAlign, TableLayoutColumnState, TableLayoutCellProps, TableLayoutSort, TableLayoutSortDirection, TableLayoutRowKey, TableLayoutRowAction } from './types';
|
|
@@ -40,6 +40,8 @@ export interface TableLayoutSort {
|
|
|
40
40
|
key: string;
|
|
41
41
|
direction: TableLayoutSortDirection;
|
|
42
42
|
}
|
|
43
|
+
/** Key baris terpilih (row selection) — selaras dengan return type `getRowKey`. */
|
|
44
|
+
export type TableLayoutRowKey = string | number;
|
|
43
45
|
/**
|
|
44
46
|
* Atribut span/skip untuk satu cell body (kasus merge / rowspan-colspan).
|
|
45
47
|
* Consumer yang menghitung merge-nya; TableLayout hanya menerapkan.
|
|
@@ -151,6 +153,37 @@ export interface TableLayoutProps<T> {
|
|
|
151
153
|
rowActions?: TableLayoutRowAction<T>[];
|
|
152
154
|
/** key unik per row; default pakai index */
|
|
153
155
|
getRowKey?: (row: T, index: number) => string | number;
|
|
156
|
+
/**
|
|
157
|
+
* Aktifkan kolom checkbox di kiri untuk memilih baris (row selection).
|
|
158
|
+
* TableLayout HANYA mengelola state seleksi — checkbox per baris + select-all
|
|
159
|
+
* di header (berlaku untuk halaman yang sedang dirender saja, indeterminate
|
|
160
|
+
* saat sebagian terpilih). TIDAK ada bulk-action toolbar bawaan; consumer
|
|
161
|
+
* merender toolbar-nya sendiri dari `selectedKeys` / `onSelectionChange`.
|
|
162
|
+
* Toggle hanya lewat klik checkbox — klik row tidak mengubah seleksi.
|
|
163
|
+
*
|
|
164
|
+
* ⚠️ Saat dipakai dengan pagination/server data, WAJIB beri `getRowKey` yang
|
|
165
|
+
* stabil (mis. `r => r.id`) — default index membuat seleksi menempel ke
|
|
166
|
+
* POSISI baris, bukan ke datanya, saat data berganti halaman.
|
|
167
|
+
*/
|
|
168
|
+
selectable?: boolean;
|
|
169
|
+
/**
|
|
170
|
+
* Baris terpilih (controlled). Isi dengan key hasil `getRowKey`; pasangkan
|
|
171
|
+
* dengan `onSelectionChange`. Tanpa ini → uncontrolled.
|
|
172
|
+
*/
|
|
173
|
+
selectedKeys?: TableLayoutRowKey[];
|
|
174
|
+
/** seleksi awal (uncontrolled) */
|
|
175
|
+
defaultSelectedKeys?: TableLayoutRowKey[];
|
|
176
|
+
/**
|
|
177
|
+
* Dipanggil saat seleksi berubah. `keys` = SELURUH key terpilih (termasuk
|
|
178
|
+
* dari halaman lain pada mode controlled); `rows` = baris terpilih yang ada
|
|
179
|
+
* di `data` saat ini saja.
|
|
180
|
+
*/
|
|
181
|
+
onSelectionChange?: (keys: TableLayoutRowKey[], rows: T[]) => void;
|
|
182
|
+
/**
|
|
183
|
+
* Return `false` → baris tidak bisa dipilih: checkbox-nya disabled dan
|
|
184
|
+
* dikecualikan dari hitungan/aksi select-all. Default: semua baris bisa.
|
|
185
|
+
*/
|
|
186
|
+
isRowSelectable?: (row: T, index: number) => boolean;
|
|
154
187
|
/**
|
|
155
188
|
* Warnai SELURUH row berdasarkan data; return token/undefined. Diterapkan
|
|
156
189
|
* sebagai background tint pada semua sel row (lewat CSS variable `--sa-tl-bg`,
|