@alaarab/ogrid-core 1.2.1 → 1.3.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/esm/components/GridContextMenu.js +12 -3
- package/dist/esm/components/MarchingAntsOverlay.js +109 -0
- package/dist/esm/hooks/useCellSelection.js +4 -0
- package/dist/esm/hooks/useClipboard.js +41 -8
- package/dist/esm/hooks/useColumnHeaderFilterState.js +11 -12
- package/dist/esm/hooks/useContextMenu.js +1 -0
- package/dist/esm/hooks/useDataGridState.js +74 -30
- package/dist/esm/hooks/useFillHandle.js +16 -3
- package/dist/esm/hooks/useInlineCellEditorState.js +2 -0
- package/dist/esm/hooks/useKeyboardNavigation.js +22 -2
- package/dist/esm/hooks/useOGrid.js +4 -1
- package/dist/esm/hooks/useUndoRedo.js +44 -14
- package/dist/esm/index.js +2 -1
- package/dist/esm/utils/dataGridViewModel.js +7 -1
- package/dist/esm/utils/gridContextMenuHelpers.js +20 -5
- package/dist/esm/utils/index.js +2 -1
- package/dist/esm/utils/valueParsers.js +107 -0
- package/dist/types/components/GridContextMenu.d.ts +4 -0
- package/dist/types/components/MarchingAntsOverlay.d.ts +15 -0
- package/dist/types/hooks/useCellSelection.d.ts +2 -0
- package/dist/types/hooks/useClipboard.d.ts +7 -0
- package/dist/types/hooks/useContextMenu.d.ts +1 -0
- package/dist/types/hooks/useDataGridState.d.ts +12 -0
- package/dist/types/hooks/useFillHandle.d.ts +3 -0
- package/dist/types/hooks/useKeyboardNavigation.d.ts +2 -1
- package/dist/types/hooks/useUndoRedo.d.ts +5 -1
- package/dist/types/index.d.ts +5 -3
- package/dist/types/types/columnTypes.d.ts +17 -0
- package/dist/types/types/dataGridTypes.d.ts +8 -0
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/utils/dataGridViewModel.d.ts +9 -0
- package/dist/types/utils/gridContextMenuHelpers.d.ts +8 -0
- package/dist/types/utils/index.d.ts +3 -1
- package/dist/types/utils/valueParsers.d.ts +37 -0
- package/package.json +1 -1
|
@@ -63,11 +63,19 @@ export interface CellRenderDescriptorInput<T> {
|
|
|
63
63
|
endRow: number;
|
|
64
64
|
endCol: number;
|
|
65
65
|
} | null;
|
|
66
|
+
copyRange: {
|
|
67
|
+
startRow: number;
|
|
68
|
+
startCol: number;
|
|
69
|
+
endRow: number;
|
|
70
|
+
endCol: number;
|
|
71
|
+
} | null;
|
|
66
72
|
colOffset: number;
|
|
67
73
|
itemsLength: number;
|
|
68
74
|
getRowId: (item: T) => RowId;
|
|
69
75
|
editable?: boolean;
|
|
70
76
|
onCellValueChanged?: (event: import('../types/columnTypes').ICellValueChangedEvent<T>) => void;
|
|
77
|
+
/** True while user is drag-selecting cells — hides fill handle during drag. */
|
|
78
|
+
isDragging?: boolean;
|
|
71
79
|
}
|
|
72
80
|
export interface CellRenderDescriptor {
|
|
73
81
|
mode: CellRenderMode;
|
|
@@ -76,6 +84,7 @@ export interface CellRenderDescriptor {
|
|
|
76
84
|
isActive: boolean;
|
|
77
85
|
isInRange: boolean;
|
|
78
86
|
isInCutRange: boolean;
|
|
87
|
+
isInCopyRange: boolean;
|
|
79
88
|
isSelectionEndCell: boolean;
|
|
80
89
|
canEditAny: boolean;
|
|
81
90
|
isPinned: boolean;
|
|
@@ -4,16 +4,24 @@
|
|
|
4
4
|
export interface GridContextMenuItem {
|
|
5
5
|
id: string;
|
|
6
6
|
label: string;
|
|
7
|
+
/** Keyboard shortcut text displayed in the menu (e.g. 'Ctrl+Z'). Ctrl is swapped to ⌘ on Mac at render time. */
|
|
8
|
+
shortcut?: string;
|
|
7
9
|
/** When true, the item is disabled when there is no cell selection (e.g. Copy, Cut). */
|
|
8
10
|
disabledWhenNoSelection?: boolean;
|
|
11
|
+
/** When true, a divider is rendered before this item. */
|
|
12
|
+
dividerBefore?: boolean;
|
|
9
13
|
}
|
|
10
14
|
export declare const GRID_CONTEXT_MENU_ITEMS: GridContextMenuItem[];
|
|
15
|
+
/** Returns the shortcut string with Ctrl swapped to ⌘ on Mac. */
|
|
16
|
+
export declare function formatShortcut(shortcut: string): string;
|
|
11
17
|
/** Props passed to getContextMenuHandlers (callbacks + onClose). */
|
|
12
18
|
export interface GridContextMenuHandlerProps {
|
|
13
19
|
onCopy: () => void;
|
|
14
20
|
onCut: () => void;
|
|
15
21
|
onPaste: () => void;
|
|
16
22
|
onSelectAll: () => void;
|
|
23
|
+
onUndo: () => void;
|
|
24
|
+
onRedo: () => void;
|
|
17
25
|
onClose: () => void;
|
|
18
26
|
}
|
|
19
27
|
/**
|
|
@@ -6,9 +6,11 @@ export { getStatusBarParts } from './statusBarHelpers';
|
|
|
6
6
|
export { getDataGridStatusBarConfig } from './dataGridStatusBar';
|
|
7
7
|
export { getPaginationViewModel, PAGE_SIZE_OPTIONS, MAX_PAGE_BUTTONS, } from './paginationHelpers';
|
|
8
8
|
export type { PaginationViewModel } from './paginationHelpers';
|
|
9
|
-
export { GRID_CONTEXT_MENU_ITEMS, getContextMenuHandlers } from './gridContextMenuHelpers';
|
|
9
|
+
export { GRID_CONTEXT_MENU_ITEMS, getContextMenuHandlers, formatShortcut } from './gridContextMenuHelpers';
|
|
10
10
|
export { getHeaderFilterConfig, getCellRenderDescriptor, } from './dataGridViewModel';
|
|
11
11
|
export type { HeaderFilterConfigInput, HeaderFilterConfig, CellRenderDescriptorInput, CellRenderDescriptor, CellRenderMode, } from './dataGridViewModel';
|
|
12
12
|
export type { CsvColumn } from './exportToCsv';
|
|
13
13
|
export type { StatusBarPart, StatusBarPartsInput } from './statusBarHelpers';
|
|
14
14
|
export type { GridContextMenuItem, GridContextMenuHandlerProps } from './gridContextMenuHelpers';
|
|
15
|
+
export { parseValue, numberParser, currencyParser, dateParser, emailParser, booleanParser, } from './valueParsers';
|
|
16
|
+
export type { ParseValueResult } from './valueParsers';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { IColumnDef, IValueParserParams } from '../types/columnTypes';
|
|
2
|
+
/**
|
|
3
|
+
* Result of parsing a cell value. When `valid` is false the change should be skipped.
|
|
4
|
+
*/
|
|
5
|
+
export interface ParseValueResult {
|
|
6
|
+
valid: boolean;
|
|
7
|
+
value: unknown;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Run the column's valueParser (if any), or auto-validate select columns.
|
|
11
|
+
* Returns `{ valid: true, value }` with the parsed value, or `{ valid: false }` to reject.
|
|
12
|
+
*/
|
|
13
|
+
export declare function parseValue<T>(newValue: unknown, oldValue: unknown, item: T, col: IColumnDef<T>): ParseValueResult;
|
|
14
|
+
/**
|
|
15
|
+
* Parses a value as a number. Strips whitespace and commas.
|
|
16
|
+
* Returns `undefined` (reject) if result is NaN.
|
|
17
|
+
*/
|
|
18
|
+
export declare function numberParser<T>(params: IValueParserParams<T>): unknown;
|
|
19
|
+
/**
|
|
20
|
+
* Parses a currency string. Strips currency symbols ($, €, £, ¥), whitespace, commas.
|
|
21
|
+
* Returns `undefined` (reject) if result is NaN.
|
|
22
|
+
*/
|
|
23
|
+
export declare function currencyParser<T>(params: IValueParserParams<T>): unknown;
|
|
24
|
+
/**
|
|
25
|
+
* Parses a date string via `new Date()`. Returns ISO string or `undefined` if invalid.
|
|
26
|
+
*/
|
|
27
|
+
export declare function dateParser<T>(params: IValueParserParams<T>): unknown;
|
|
28
|
+
/**
|
|
29
|
+
* Validates an email address with a basic regex.
|
|
30
|
+
* Returns the trimmed string or `undefined` if invalid.
|
|
31
|
+
*/
|
|
32
|
+
export declare function emailParser<T>(params: IValueParserParams<T>): unknown;
|
|
33
|
+
/**
|
|
34
|
+
* Parses boolean-like values: true/false/yes/no/1/0.
|
|
35
|
+
* Returns `undefined` if not recognized.
|
|
36
|
+
*/
|
|
37
|
+
export declare function booleanParser<T>(params: IValueParserParams<T>): unknown;
|
package/package.json
CHANGED