@toolbox-web/grid 1.25.2 → 1.26.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.
@@ -196,8 +196,28 @@ export interface EditCloseDetail<TRow = unknown> {
196
196
  */
197
197
  declare module '../../core/types' {
198
198
  interface BaseColumnConfig<TRow, TValue> {
199
- /** Whether the field is editable (enables editors). Requires EditingPlugin. */
200
- editable?: boolean;
199
+ /**
200
+ * Whether the field is editable (enables editors). Requires EditingPlugin.
201
+ *
202
+ * - `true` — editable for all rows
203
+ * - `false` / omitted — not editable
204
+ * - `(row: TRow) => boolean` — conditionally editable per row
205
+ *
206
+ * When a function is provided it is evaluated each time the grid needs to
207
+ * determine if a specific cell can enter edit mode (click, keyboard, grid
208
+ * mode render, tab navigation, etc.). Keep the function fast — it runs on
209
+ * hot render paths.
210
+ *
211
+ * @example
212
+ * ```typescript
213
+ * // Always editable
214
+ * { field: 'name', editable: true }
215
+ *
216
+ * // Conditionally editable
217
+ * { field: 'price', editable: (row) => row.status !== 'locked' }
218
+ * ```
219
+ */
220
+ editable?: boolean | ((row: TRow) => boolean);
201
221
  /** Optional custom editor factory or element tag name. Requires EditingPlugin. */
202
222
  editor?: ColumnEditorSpec<TRow, TValue>;
203
223
  /**
@@ -306,7 +326,7 @@ declare module '../../core/types' {
306
326
  */
307
327
  editorParams?: Record<string, unknown>;
308
328
  }
309
- interface GridConfig {
329
+ interface GridConfig<TRow = any> {
310
330
  /**
311
331
  * Edit trigger mode. Requires `EditingPlugin` to be loaded.
312
332
  *
@@ -319,6 +339,32 @@ declare module '../../core/types' {
319
339
  * - `false`: Disable editing entirely
320
340
  */
321
341
  editOn?: 'click' | 'dblclick' | 'manual' | false;
342
+ /**
343
+ * Row-level editability gate. Requires `EditingPlugin` to be loaded.
344
+ *
345
+ * When provided, this function is called **before** the column-level
346
+ * `editable` check. If it returns `false` for a given row, **no cell** in
347
+ * that row can be edited regardless of the column configuration.
348
+ *
349
+ * Omitting this property (or returning `true`) defers to per-column
350
+ * `editable` settings.
351
+ *
352
+ * Keep the callback fast — it is invoked on every editability check
353
+ * (click, keyboard, grid-mode render, tab navigation).
354
+ *
355
+ * @example
356
+ * ```typescript
357
+ * // Block editing for archived rows
358
+ * gridConfig = {
359
+ * rowEditable: (row) => !row.archived,
360
+ * columns: [
361
+ * { field: 'name', editable: true },
362
+ * { field: 'price', editable: (row) => row.status === 'draft' },
363
+ * ],
364
+ * };
365
+ * ```
366
+ */
367
+ rowEditable?: (row: TRow) => boolean;
322
368
  }
323
369
  interface DataGridEventMap<TRow = unknown> {
324
370
  /** Fired when a cell edit is canceled (Escape key). The cell reverts to its previous value. @group Editing Events */