gm-datagrid 0.1.23 → 0.1.24

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/README.md CHANGED
@@ -88,6 +88,10 @@ export default function ProductsPage() {
88
88
  | `onRowDetail` | `(row) => void` | — | Called when the user opens a row detail (double-click or menu action) |
89
89
  | `checkboxSelection` | `boolean` | `false` | Prepend a checkbox column for row selection |
90
90
  | `onRowSelectionChange` | `(rows: Row[]) => void` | — | Fires on every selection change with the full array of selected rows |
91
+ | `slot` | `GridToolbarSlots` | — | Toolbar components: `bulkAction`, `creator`, `synchronizer`, `actions` (see `docs/TOOLBAR_SLOTS.md`) |
92
+ | `slotProps` | `GridToolbarSlotProps` | — | Props merged into each slot component |
93
+ | `statusSwitch` | `StatusSwitchConfig` | — | Grid defaults for inline STATUS toggles (see `docs/STATUS_SWITCH.md`) |
94
+ | `autoCheckboxSelection` | `boolean` | `true` | Enable checkboxes when `slot.bulkAction` is set |
91
95
  | `locale` | `'es' \| 'en'` | `'es'` | Built-in UI language. See [Internationalisation](#internationalisation-locale) |
92
96
 
93
97
  ### Pagination props
@@ -1,16 +1,18 @@
1
1
  import { default as React } from 'react';
2
- import { ColumnDef } from '../types';
2
+ import { ColumnDef, EditMode } from '../types';
3
3
  interface EditCellProps {
4
4
  rowId: string;
5
5
  field: string;
6
6
  column: ColumnDef;
7
7
  editValue: string;
8
8
  onEditValueChange: (v: string) => void;
9
- onStopEditing: (save: boolean) => Promise<void>;
9
+ onStopEditing: (save: boolean) => Promise<void> | void;
10
+ editMode?: EditMode;
11
+ autoFocus?: boolean;
10
12
  }
11
13
  /**
12
14
  * Inline edit cell — renders an <input> or <select> depending on column type.
13
- * Controlled by the parent via editValue/onEditValueChange.
15
+ * Adapts blur and key behavior based on editMode ('cell' | 'row' | 'complete').
14
16
  */
15
17
  declare const EditCell: React.NamedExoticComponent<EditCellProps>;
16
18
  export default EditCell;
@@ -0,0 +1,14 @@
1
+ import { default as React } from 'react';
2
+ import { Row, StatusSwitchConfig } from '../types';
3
+ export interface RecordStatusSwitchCellProps extends StatusSwitchConfig {
4
+ row: Row;
5
+ value?: string | null;
6
+ statusField?: string;
7
+ }
8
+ /**
9
+ * Agnostic inline A/I (or custom active/inactive) toggle for STATUS columns.
10
+ */
11
+ declare const RecordStatusSwitchCell: React.NamedExoticComponent<RecordStatusSwitchCellProps & {
12
+ apiContext?: Record<string, unknown>;
13
+ }>;
14
+ export default RecordStatusSwitchCell;
@@ -0,0 +1,5 @@
1
+ import { ColumnDef, StatusSwitchConfig } from '../types';
2
+ /**
3
+ * Merges grid-level defaults with per-column `statusSwitch` config.
4
+ */
5
+ export declare function resolveColumnStatusSwitchConfig(column: ColumnDef, gridStatusSwitch?: StatusSwitchConfig): StatusSwitchConfig | null;
@@ -0,0 +1,5 @@
1
+ import { ColumnDef, StatusSwitchConfig } from '../types';
2
+ /**
3
+ * Attaches status-switch renderers to STATUS columns when configured.
4
+ */
5
+ export declare function useResolvedColumns(columns: ColumnDef[], gridStatusSwitch?: StatusSwitchConfig): ColumnDef[];
@@ -28,6 +28,11 @@ interface GridContextValue extends DataSetState {
28
28
  isSomeSelected: boolean;
29
29
  textSearch: string;
30
30
  setTextSearch: (v: string) => void;
31
+ /** All rows in the current dataset (alias for rows). */
32
+ data: Row[];
33
+ getRows: () => Row[];
34
+ getSelectedRows: () => Row[];
35
+ selectedCount: number;
31
36
  }
32
37
  interface GridProviderProps {
33
38
  dataset: DataSetState;