@bmsuisse/datagrid 0.30.0 → 0.31.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.
- package/dist/index.d.ts +21 -1
- package/dist/index.js +194 -89
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -863,6 +863,18 @@ interface CellEditingOptions<TRow> {
|
|
|
863
863
|
onCellsChange: (changes: CellChange<TRow>[]) => void | Promise<void>;
|
|
864
864
|
/** Disables all cell-editing interaction — e.g. while a previous gesture's `onCellsChange` is still in flight. Defaults to false. */
|
|
865
865
|
disabled?: boolean;
|
|
866
|
+
/**
|
|
867
|
+
* Renders every editable cell's editor directly, all the time — no click,
|
|
868
|
+
* double-click, F2, or typed character needed to open one first. Selection
|
|
869
|
+
* (drag/shift+click/shift+arrow), copy, paste, and the fill-handle all
|
|
870
|
+
* still work exactly as they do without this flag; only the single-cell
|
|
871
|
+
* "one cell editing at a time" gate is gone, since with this on every
|
|
872
|
+
* editable cell already IS its own editor. A buffered (string/number/
|
|
873
|
+
* currency) editor still only commits on blur/Enter/Tab, same as always —
|
|
874
|
+
* this flag just means it's already open, not that it types straight
|
|
875
|
+
* through to `onCellsChange` on every keystroke. Defaults to false.
|
|
876
|
+
*/
|
|
877
|
+
alwaysEdit?: boolean;
|
|
866
878
|
}
|
|
867
879
|
|
|
868
880
|
/** Maps each id to its position in `ids` — built once per (rowIds|columnIds) identity change, then reused for every lookup during a drag, rather than an O(n) `indexOf` per cell per mousemove. */
|
|
@@ -972,7 +984,11 @@ declare function useCellSelection({ rowIds, columnIds, onNavigateToRow }: CellSe
|
|
|
972
984
|
* table body.
|
|
973
985
|
*/
|
|
974
986
|
interface CellEditingCellContext<TRow> {
|
|
975
|
-
/**
|
|
987
|
+
/** Mirrors `CellEditingOptions.alwaysEdit` — every editable cell renders `AlwaysEditCell` instead of going through `editingCell`/`onBeginEdit` at all when this is set. */
|
|
988
|
+
alwaysEdit: boolean;
|
|
989
|
+
/** Mirrors `CellEditingOptions.disabled`. Click-to-edit mode blocks interaction by simply never opening an editor while this is set (see `onBeginEdit`'s own gate) — `AlwaysEditCell`'s editors are always open regardless, so it reads this directly to disable its rendered form control instead. */
|
|
990
|
+
disabled: boolean;
|
|
991
|
+
/** The one cell currently showing its editor, or `undefined` — at most one at a time, the same convention `EditingCellContext.activeRowId` uses at row granularity. Meaningless (always `undefined`) under `alwaysEdit`, where every editable cell already has its own editor. */
|
|
976
992
|
editingCell: CellAddress | undefined;
|
|
977
993
|
/** Replaces (doesn't append to) the editor's starting value when editing began by typing a printable character directly (Excel's "just start typing" gesture) rather than double-click/Enter/F2, which start from the cell's current value. `undefined` means "start from the current value." */
|
|
978
994
|
initialText: string | undefined;
|
|
@@ -1015,6 +1031,8 @@ interface CellEditingCellContext<TRow> {
|
|
|
1015
1031
|
*/
|
|
1016
1032
|
onCommitValue: (row: TRow, previousValue: unknown, value: unknown) => void;
|
|
1017
1033
|
onSetError: (rowId: string, columnId: string, message: string | undefined) => void;
|
|
1034
|
+
/** Commits one independently-managed cell's change directly — for `AlwaysEditCell`, which owns its own draft state locally rather than through `editingCell`/`onChangeDraft`/`onCommitEdit`'s single shared slot (every editable cell needs its own simultaneous editor under `alwaysEdit`, not just one at a time). */
|
|
1035
|
+
applyChange: (change: CellChange<TRow>) => void;
|
|
1018
1036
|
/**
|
|
1019
1037
|
* Reads (and clears) whether `onCommitEdit`/`onCommitValue` committed
|
|
1020
1038
|
* synchronously during the current call stack. `<DataGrid>`'s own keydown
|
|
@@ -1112,6 +1130,8 @@ declare function SelectionOverlay({ containerRef, range, fillPreviewRange, onFil
|
|
|
1112
1130
|
* `null` for `number`/`currency` (pasting a blank cell over a numeric one
|
|
1113
1131
|
* clears it, matching `NumberEditor`'s own null-for-cleared convention) —
|
|
1114
1132
|
* `string` columns instead treat an empty string as itself a valid value.
|
|
1133
|
+
* An Excel/Sheets error string (`#N/A`, `#DIV/0!`, etc.) pasted into any
|
|
1134
|
+
* column but `string` is likewise skipped rather than coerced.
|
|
1115
1135
|
*/
|
|
1116
1136
|
declare function coerceValueForColumn<TRow>(column: ColumnDef<TRow>, raw: string): {
|
|
1117
1137
|
value: unknown;
|