@alaarab/ogrid-angular 2.0.2
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/empty-state.component.js +39 -0
- package/dist/esm/components/grid-context-menu.component.js +117 -0
- package/dist/esm/components/marching-ants-overlay.component.js +155 -0
- package/dist/esm/components/ogrid-layout.component.js +96 -0
- package/dist/esm/components/sidebar.component.js +229 -0
- package/dist/esm/components/status-bar.component.js +48 -0
- package/dist/esm/index.js +13 -0
- package/dist/esm/services/datagrid-state.service.js +1268 -0
- package/dist/esm/services/ogrid.service.js +619 -0
- package/dist/esm/types/columnTypes.js +1 -0
- package/dist/esm/types/dataGridTypes.js +1 -0
- package/dist/esm/types/index.js +1 -0
- package/dist/types/components/empty-state.component.d.ts +6 -0
- package/dist/types/components/grid-context-menu.component.d.ts +32 -0
- package/dist/types/components/marching-ants-overlay.component.d.ts +23 -0
- package/dist/types/components/ogrid-layout.component.d.ts +9 -0
- package/dist/types/components/sidebar.component.d.ts +42 -0
- package/dist/types/components/status-bar.component.d.ts +21 -0
- package/dist/types/index.d.ts +16 -0
- package/dist/types/services/datagrid-state.service.d.ts +237 -0
- package/dist/types/services/ogrid.service.d.ts +191 -0
- package/dist/types/types/columnTypes.d.ts +27 -0
- package/dist/types/types/dataGridTypes.d.ts +126 -0
- package/dist/types/types/index.d.ts +3 -0
- package/package.json +42 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ISelectionRange } from '../types';
|
|
2
|
+
interface OverlayRect {
|
|
3
|
+
top: number;
|
|
4
|
+
left: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
}
|
|
8
|
+
export declare class MarchingAntsOverlayComponent {
|
|
9
|
+
private destroyRef;
|
|
10
|
+
readonly containerEl: import("@angular/core").InputSignal<HTMLElement | null>;
|
|
11
|
+
readonly selectionRange: import("@angular/core").InputSignal<ISelectionRange | null>;
|
|
12
|
+
readonly copyRange: import("@angular/core").InputSignal<ISelectionRange | null>;
|
|
13
|
+
readonly cutRange: import("@angular/core").InputSignal<ISelectionRange | null>;
|
|
14
|
+
readonly colOffset: import("@angular/core").InputSignal<number>;
|
|
15
|
+
readonly selRect: import("@angular/core").WritableSignal<OverlayRect | null>;
|
|
16
|
+
readonly clipRect: import("@angular/core").WritableSignal<OverlayRect | null>;
|
|
17
|
+
private rafId;
|
|
18
|
+
private resizeObserver;
|
|
19
|
+
constructor();
|
|
20
|
+
clipRangeMatchesSel(): boolean;
|
|
21
|
+
max0(n: number): number;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SideBarProps } from './sidebar.component';
|
|
2
|
+
export declare class OGridLayoutComponent {
|
|
3
|
+
readonly className: import("@angular/core").InputSignal<string | undefined>;
|
|
4
|
+
readonly hasToolbar: import("@angular/core").InputSignal<boolean>;
|
|
5
|
+
readonly hasToolbarBelow: import("@angular/core").InputSignal<boolean>;
|
|
6
|
+
readonly hasPagination: import("@angular/core").InputSignal<boolean>;
|
|
7
|
+
readonly sideBar: import("@angular/core").InputSignal<SideBarProps | null>;
|
|
8
|
+
readonly borderRadius = 6;
|
|
9
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { IColumnDefinition, SideBarPanelId, IFilters, FilterValue } from '../types';
|
|
2
|
+
/** Describes a filterable column for the sidebar filters panel. */
|
|
3
|
+
export interface SideBarFilterColumn {
|
|
4
|
+
columnId: string;
|
|
5
|
+
name: string;
|
|
6
|
+
filterField: string;
|
|
7
|
+
filterType: 'text' | 'multiSelect' | 'people' | 'date';
|
|
8
|
+
}
|
|
9
|
+
export interface SideBarProps {
|
|
10
|
+
activePanel: SideBarPanelId | null;
|
|
11
|
+
onPanelChange: (panel: SideBarPanelId | null) => void;
|
|
12
|
+
panels: SideBarPanelId[];
|
|
13
|
+
position: 'left' | 'right';
|
|
14
|
+
columns: IColumnDefinition[];
|
|
15
|
+
visibleColumns: Set<string>;
|
|
16
|
+
onVisibilityChange: (columnKey: string, visible: boolean) => void;
|
|
17
|
+
onSetVisibleColumns: (columns: Set<string>) => void;
|
|
18
|
+
filterableColumns: SideBarFilterColumn[];
|
|
19
|
+
filters: IFilters;
|
|
20
|
+
onFilterChange: (key: string, value: FilterValue | undefined) => void;
|
|
21
|
+
filterOptions: Record<string, string[]>;
|
|
22
|
+
}
|
|
23
|
+
export declare class SideBarComponent {
|
|
24
|
+
readonly sideBarProps: import("@angular/core").InputSignal<SideBarProps | null>;
|
|
25
|
+
readonly panelLabels: Record<SideBarPanelId, string>;
|
|
26
|
+
readonly tabWidth = 36;
|
|
27
|
+
readonly panelWidth = 240;
|
|
28
|
+
onTabClick(panel: SideBarPanelId): void;
|
|
29
|
+
allVisible(): boolean;
|
|
30
|
+
onSelectAll(): void;
|
|
31
|
+
onClearAll(): void;
|
|
32
|
+
onVisibilityChange(columnKey: string, visible: boolean): void;
|
|
33
|
+
getTextFilterValue(filterField: string): string;
|
|
34
|
+
onTextFilterChange(filterField: string, value: string): void;
|
|
35
|
+
getDateFrom(filterField: string): string;
|
|
36
|
+
getDateTo(filterField: string): string;
|
|
37
|
+
onDateFromChange(filterField: string, value: string): void;
|
|
38
|
+
onDateToChange(filterField: string, value: string): void;
|
|
39
|
+
getFilterOptions(filterField: string): string[];
|
|
40
|
+
isMultiSelectChecked(filterField: string, opt: string): boolean;
|
|
41
|
+
onMultiSelectChange(filterField: string, opt: string, checked: boolean): void;
|
|
42
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare class StatusBarComponent {
|
|
2
|
+
readonly totalCount: import("@angular/core").InputSignal<number>;
|
|
3
|
+
readonly filteredCount: import("@angular/core").InputSignal<number | undefined>;
|
|
4
|
+
readonly selectedCount: import("@angular/core").InputSignal<number | undefined>;
|
|
5
|
+
readonly selectedCellCount: import("@angular/core").InputSignal<number | undefined>;
|
|
6
|
+
readonly aggregation: import("@angular/core").InputSignal<{
|
|
7
|
+
sum: number;
|
|
8
|
+
avg: number;
|
|
9
|
+
min: number;
|
|
10
|
+
max: number;
|
|
11
|
+
count: number;
|
|
12
|
+
} | null | undefined>;
|
|
13
|
+
readonly suppressRowCount: import("@angular/core").InputSignal<boolean | undefined>;
|
|
14
|
+
readonly classNames: import("@angular/core").InputSignal<{
|
|
15
|
+
statusBar?: string;
|
|
16
|
+
statusBarItem?: string;
|
|
17
|
+
statusBarLabel?: string;
|
|
18
|
+
statusBarValue?: string;
|
|
19
|
+
} | undefined>;
|
|
20
|
+
protected readonly parts: () => import("@alaarab/ogrid-core").StatusBarPart[];
|
|
21
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from '@alaarab/ogrid-core';
|
|
2
|
+
export type { IColumnDef, IColumnGroupDef, IColumnDefinition, ICellEditorProps, } from './types';
|
|
3
|
+
export type { IOGridProps, IOGridClientProps, IOGridServerProps, IOGridDataGridProps, } from './types';
|
|
4
|
+
export type { ColumnFilterType, IColumnFilterDef, IColumnMeta, ICellValueChangedEvent, CellEditorParams, IValueParserParams, IDateFilterValue, HeaderCell, HeaderRow, RowId, UserLike, UserLikeInput, FilterValue, IFilters, IFetchParams, IPageResult, IDataSource, IGridColumnState, IOGridApi, RowSelectionMode, IRowSelectionChangeEvent, StatusBarPanel, IStatusBarProps, IActiveCell, ISelectionRange, SideBarPanelId, ISideBarDef, } from './types';
|
|
5
|
+
export { toUserLike, isInSelectionRange, normalizeSelectionRange } from './types';
|
|
6
|
+
export { OGridService } from './services/ogrid.service';
|
|
7
|
+
export type { ColumnChooserPlacement, OGridPagination, OGridColumnChooser, OGridFilters, OGridSideBarState, } from './services/ogrid.service';
|
|
8
|
+
export { DataGridStateService } from './services/datagrid-state.service';
|
|
9
|
+
export type { DataGridLayoutState, DataGridRowSelectionState, DataGridEditingState, DataGridCellInteractionState, DataGridContextMenuState, DataGridViewModelState, DataGridStateResult, } from './services/datagrid-state.service';
|
|
10
|
+
export { OGridLayoutComponent } from './components/ogrid-layout.component';
|
|
11
|
+
export { StatusBarComponent } from './components/status-bar.component';
|
|
12
|
+
export { GridContextMenuComponent } from './components/grid-context-menu.component';
|
|
13
|
+
export { SideBarComponent } from './components/sidebar.component';
|
|
14
|
+
export type { SideBarProps, SideBarFilterColumn } from './components/sidebar.component';
|
|
15
|
+
export { MarchingAntsOverlayComponent } from './components/marching-ants-overlay.component';
|
|
16
|
+
export { EmptyStateComponent } from './components/empty-state.component';
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import type { RowId, IActiveCell, ISelectionRange, IStatusBarProps, IFilters, FilterValue, UserLike, ICellValueChangedEvent } from '../types';
|
|
2
|
+
import type { IColumnDef as IAngularColumnDef } from '../types';
|
|
3
|
+
import type { IOGridDataGridProps } from '../types';
|
|
4
|
+
type IColumnDef<T> = IAngularColumnDef<T>;
|
|
5
|
+
export interface DataGridLayoutState<T> {
|
|
6
|
+
flatColumns: IColumnDef<T>[];
|
|
7
|
+
visibleCols: IColumnDef<T>[];
|
|
8
|
+
visibleColumnCount: number;
|
|
9
|
+
totalColCount: number;
|
|
10
|
+
colOffset: number;
|
|
11
|
+
hasCheckboxCol: boolean;
|
|
12
|
+
rowIndexByRowId: Map<RowId, number>;
|
|
13
|
+
containerWidth: number;
|
|
14
|
+
minTableWidth: number;
|
|
15
|
+
desiredTableWidth: number;
|
|
16
|
+
columnSizingOverrides: Record<string, {
|
|
17
|
+
widthPx: number;
|
|
18
|
+
}>;
|
|
19
|
+
setColumnSizingOverrides: (overrides: Record<string, {
|
|
20
|
+
widthPx: number;
|
|
21
|
+
}>) => void;
|
|
22
|
+
onColumnResized?: (columnId: string, width: number) => void;
|
|
23
|
+
}
|
|
24
|
+
export interface DataGridRowSelectionState {
|
|
25
|
+
selectedRowIds: Set<RowId>;
|
|
26
|
+
updateSelection: (newSelectedIds: Set<RowId>) => void;
|
|
27
|
+
handleRowCheckboxChange: (rowId: RowId, checked: boolean, rowIndex: number, shiftKey: boolean) => void;
|
|
28
|
+
handleSelectAll: (checked: boolean) => void;
|
|
29
|
+
allSelected: boolean;
|
|
30
|
+
someSelected: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface DataGridEditingState<T> {
|
|
33
|
+
editingCell: {
|
|
34
|
+
rowId: RowId;
|
|
35
|
+
columnId: string;
|
|
36
|
+
} | null;
|
|
37
|
+
setEditingCell: (cell: {
|
|
38
|
+
rowId: RowId;
|
|
39
|
+
columnId: string;
|
|
40
|
+
} | null) => void;
|
|
41
|
+
pendingEditorValue: unknown;
|
|
42
|
+
setPendingEditorValue: (value: unknown) => void;
|
|
43
|
+
commitCellEdit: (item: T, columnId: string, oldValue: unknown, newValue: unknown, rowIndex: number, globalColIndex: number) => void;
|
|
44
|
+
cancelPopoverEdit: () => void;
|
|
45
|
+
popoverAnchorEl: HTMLElement | null;
|
|
46
|
+
setPopoverAnchorEl: (el: HTMLElement | null) => void;
|
|
47
|
+
}
|
|
48
|
+
export interface DataGridCellInteractionState {
|
|
49
|
+
activeCell: IActiveCell | null;
|
|
50
|
+
setActiveCell: (cell: IActiveCell | null) => void;
|
|
51
|
+
selectionRange: ISelectionRange | null;
|
|
52
|
+
setSelectionRange: (range: ISelectionRange | null) => void;
|
|
53
|
+
handleCellMouseDown: (e: MouseEvent, rowIndex: number, globalColIndex: number) => void;
|
|
54
|
+
handleSelectAllCells: () => void;
|
|
55
|
+
hasCellSelection: boolean;
|
|
56
|
+
handleGridKeyDown: (e: KeyboardEvent) => void;
|
|
57
|
+
handleFillHandleMouseDown: (e: MouseEvent) => void;
|
|
58
|
+
handleCopy: () => void;
|
|
59
|
+
handleCut: () => void;
|
|
60
|
+
handlePaste: () => Promise<void>;
|
|
61
|
+
cutRange: ISelectionRange | null;
|
|
62
|
+
copyRange: ISelectionRange | null;
|
|
63
|
+
clearClipboardRanges: () => void;
|
|
64
|
+
canUndo: boolean;
|
|
65
|
+
canRedo: boolean;
|
|
66
|
+
onUndo?: () => void;
|
|
67
|
+
onRedo?: () => void;
|
|
68
|
+
isDragging: boolean;
|
|
69
|
+
}
|
|
70
|
+
export interface DataGridContextMenuState {
|
|
71
|
+
menuPosition: {
|
|
72
|
+
x: number;
|
|
73
|
+
y: number;
|
|
74
|
+
} | null;
|
|
75
|
+
setMenuPosition: (pos: {
|
|
76
|
+
x: number;
|
|
77
|
+
y: number;
|
|
78
|
+
} | null) => void;
|
|
79
|
+
handleCellContextMenu: (e: {
|
|
80
|
+
clientX: number;
|
|
81
|
+
clientY: number;
|
|
82
|
+
preventDefault?: () => void;
|
|
83
|
+
}) => void;
|
|
84
|
+
closeContextMenu: () => void;
|
|
85
|
+
}
|
|
86
|
+
export interface DataGridViewModelState<T> {
|
|
87
|
+
headerFilterInput: {
|
|
88
|
+
sortBy?: string;
|
|
89
|
+
sortDirection: 'asc' | 'desc';
|
|
90
|
+
onColumnSort: (columnKey: string) => void;
|
|
91
|
+
filters: IFilters;
|
|
92
|
+
onFilterChange: (key: string, value: FilterValue | undefined) => void;
|
|
93
|
+
filterOptions: Record<string, string[]>;
|
|
94
|
+
loadingFilterOptions: Record<string, boolean>;
|
|
95
|
+
peopleSearch?: (query: string) => Promise<UserLike[]>;
|
|
96
|
+
};
|
|
97
|
+
cellDescriptorInput: {
|
|
98
|
+
editingCell: {
|
|
99
|
+
rowId: RowId;
|
|
100
|
+
columnId: string;
|
|
101
|
+
} | null;
|
|
102
|
+
activeCell: IActiveCell | null;
|
|
103
|
+
selectionRange: ISelectionRange | null;
|
|
104
|
+
cutRange: ISelectionRange | null;
|
|
105
|
+
copyRange: ISelectionRange | null;
|
|
106
|
+
colOffset: number;
|
|
107
|
+
itemsLength: number;
|
|
108
|
+
getRowId: (item: T) => RowId;
|
|
109
|
+
editable?: boolean;
|
|
110
|
+
onCellValueChanged?: (event: ICellValueChangedEvent<T>) => void;
|
|
111
|
+
isDragging: boolean;
|
|
112
|
+
};
|
|
113
|
+
statusBarConfig: IStatusBarProps | null;
|
|
114
|
+
showEmptyInGrid: boolean;
|
|
115
|
+
onCellError?: (error: Error) => void;
|
|
116
|
+
}
|
|
117
|
+
export interface DataGridStateResult<T> {
|
|
118
|
+
layout: DataGridLayoutState<T>;
|
|
119
|
+
rowSelection: DataGridRowSelectionState;
|
|
120
|
+
editing: DataGridEditingState<T>;
|
|
121
|
+
interaction: DataGridCellInteractionState;
|
|
122
|
+
contextMenu: DataGridContextMenuState;
|
|
123
|
+
viewModels: DataGridViewModelState<T>;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Single orchestration service for DataGridTable. Takes grid props,
|
|
127
|
+
* returns all derived state and handlers so Angular UI packages can be thin view layers.
|
|
128
|
+
*
|
|
129
|
+
* Port of React's useDataGridState hook.
|
|
130
|
+
*/
|
|
131
|
+
export declare class DataGridStateService<T> {
|
|
132
|
+
private destroyRef;
|
|
133
|
+
readonly props: import("@angular/core").WritableSignal<IOGridDataGridProps<T> | null>;
|
|
134
|
+
readonly wrapperEl: import("@angular/core").WritableSignal<HTMLElement | null>;
|
|
135
|
+
private readonly editingCellSig;
|
|
136
|
+
private readonly pendingEditorValueSig;
|
|
137
|
+
private readonly activeCellSig;
|
|
138
|
+
private readonly selectionRangeSig;
|
|
139
|
+
private readonly isDraggingSig;
|
|
140
|
+
private readonly contextMenuPositionSig;
|
|
141
|
+
private readonly internalSelectedRows;
|
|
142
|
+
private readonly popoverAnchorElSig;
|
|
143
|
+
private readonly containerWidthSig;
|
|
144
|
+
private readonly columnSizingOverridesSig;
|
|
145
|
+
private readonly cutRangeSig;
|
|
146
|
+
private readonly copyRangeSig;
|
|
147
|
+
private internalClipboard;
|
|
148
|
+
private undoHistory;
|
|
149
|
+
private redoStack;
|
|
150
|
+
private batch;
|
|
151
|
+
private readonly undoLengthSig;
|
|
152
|
+
private readonly redoLengthSig;
|
|
153
|
+
private fillDragStart;
|
|
154
|
+
private lastClickedRow;
|
|
155
|
+
private dragStartPos;
|
|
156
|
+
private dragMoved;
|
|
157
|
+
private isDraggingRef;
|
|
158
|
+
private liveDragRange;
|
|
159
|
+
private rafId;
|
|
160
|
+
private lastMousePos;
|
|
161
|
+
private autoScrollInterval;
|
|
162
|
+
private windowCleanups;
|
|
163
|
+
private resizeObserver;
|
|
164
|
+
private readonly propsResolved;
|
|
165
|
+
readonly cellSelection: import("@angular/core").Signal<boolean>;
|
|
166
|
+
private readonly wrappedOnCellValueChanged;
|
|
167
|
+
readonly flatColumnsRaw: import("@angular/core").Signal<IColumnDef<T>[]>;
|
|
168
|
+
readonly flatColumns: import("@angular/core").Signal<IColumnDef<T>[]>;
|
|
169
|
+
readonly visibleCols: import("@angular/core").Signal<IColumnDef<T>[]>;
|
|
170
|
+
readonly visibleColumnCount: import("@angular/core").Signal<number>;
|
|
171
|
+
readonly hasCheckboxCol: import("@angular/core").Signal<boolean>;
|
|
172
|
+
readonly totalColCount: import("@angular/core").Signal<number>;
|
|
173
|
+
readonly colOffset: import("@angular/core").Signal<0 | 1>;
|
|
174
|
+
readonly rowIndexByRowId: import("@angular/core").Signal<Map<RowId, number>>;
|
|
175
|
+
readonly selectedRowIds: import("@angular/core").Signal<Set<RowId>>;
|
|
176
|
+
readonly allSelected: import("@angular/core").Signal<boolean>;
|
|
177
|
+
readonly someSelected: import("@angular/core").Signal<boolean>;
|
|
178
|
+
readonly hasCellSelection: import("@angular/core").Signal<boolean>;
|
|
179
|
+
readonly canUndo: import("@angular/core").Signal<boolean>;
|
|
180
|
+
readonly canRedo: import("@angular/core").Signal<boolean>;
|
|
181
|
+
readonly minTableWidth: import("@angular/core").Signal<number>;
|
|
182
|
+
readonly desiredTableWidth: import("@angular/core").Signal<number>;
|
|
183
|
+
readonly aggregation: import("@angular/core").Signal<import("@alaarab/ogrid-core").AggregationResult | null>;
|
|
184
|
+
readonly statusBarConfig: import("@angular/core").Signal<{
|
|
185
|
+
aggregation: import("@alaarab/ogrid-core").AggregationResult | undefined;
|
|
186
|
+
totalCount: number;
|
|
187
|
+
filteredCount?: number;
|
|
188
|
+
selectedCount?: number;
|
|
189
|
+
panels?: import("@alaarab/ogrid-core").StatusBarPanel[];
|
|
190
|
+
suppressRowCount?: boolean;
|
|
191
|
+
} | null>;
|
|
192
|
+
readonly showEmptyInGrid: import("@angular/core").Signal<boolean>;
|
|
193
|
+
constructor();
|
|
194
|
+
updateSelection(newSelectedIds: Set<RowId>): void;
|
|
195
|
+
handleRowCheckboxChange(rowId: RowId, checked: boolean, rowIndex: number, shiftKey: boolean): void;
|
|
196
|
+
handleSelectAll(checked: boolean): void;
|
|
197
|
+
setEditingCell(cell: {
|
|
198
|
+
rowId: RowId;
|
|
199
|
+
columnId: string;
|
|
200
|
+
} | null): void;
|
|
201
|
+
setPendingEditorValue(value: unknown): void;
|
|
202
|
+
setActiveCell(cell: IActiveCell | null): void;
|
|
203
|
+
setSelectionRange(range: ISelectionRange | null): void;
|
|
204
|
+
commitCellEdit(item: T, columnId: string, oldValue: unknown, newValue: unknown, rowIndex: number, globalColIndex: number): void;
|
|
205
|
+
cancelPopoverEdit(): void;
|
|
206
|
+
handleCellMouseDown(e: MouseEvent, rowIndex: number, globalColIndex: number): void;
|
|
207
|
+
handleSelectAllCells(): void;
|
|
208
|
+
setContextMenuPosition(pos: {
|
|
209
|
+
x: number;
|
|
210
|
+
y: number;
|
|
211
|
+
} | null): void;
|
|
212
|
+
handleCellContextMenu(e: {
|
|
213
|
+
clientX: number;
|
|
214
|
+
clientY: number;
|
|
215
|
+
preventDefault?: () => void;
|
|
216
|
+
}): void;
|
|
217
|
+
closeContextMenu(): void;
|
|
218
|
+
handleCopy(): void;
|
|
219
|
+
handleCut(): void;
|
|
220
|
+
handlePaste(): Promise<void>;
|
|
221
|
+
clearClipboardRanges(): void;
|
|
222
|
+
beginBatch(): void;
|
|
223
|
+
endBatch(): void;
|
|
224
|
+
undo(): void;
|
|
225
|
+
redo(): void;
|
|
226
|
+
handleGridKeyDown(e: KeyboardEvent): void;
|
|
227
|
+
handleFillHandleMouseDown(e: MouseEvent): void;
|
|
228
|
+
getState(): DataGridStateResult<T>;
|
|
229
|
+
private getEffectiveRange;
|
|
230
|
+
private onWindowMouseMove;
|
|
231
|
+
private onWindowMouseUp;
|
|
232
|
+
private resolveRangeFromMouse;
|
|
233
|
+
private applyDragAttrs;
|
|
234
|
+
private clearDragAttrs;
|
|
235
|
+
private setupFillHandleDrag;
|
|
236
|
+
}
|
|
237
|
+
export {};
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import type { RowId, IOGridApi, IFilters, FilterValue, IRowSelectionChangeEvent, IStatusBarProps, IColumnDefinition, IDataSource, ISideBarDef, SideBarPanelId } from '../types';
|
|
2
|
+
import type { IOGridProps, IOGridDataGridProps } from '../types';
|
|
3
|
+
import type { IColumnDef, IColumnGroupDef, ICellValueChangedEvent } from '../types';
|
|
4
|
+
/** Resolved column chooser placement. */
|
|
5
|
+
export type ColumnChooserPlacement = 'toolbar' | 'sidebar' | 'none';
|
|
6
|
+
/** Pagination state and handlers. */
|
|
7
|
+
export interface OGridPagination {
|
|
8
|
+
page: number;
|
|
9
|
+
pageSize: number;
|
|
10
|
+
displayTotalCount: number;
|
|
11
|
+
setPage: (p: number) => void;
|
|
12
|
+
setPageSize: (size: number) => void;
|
|
13
|
+
pageSizeOptions?: number[];
|
|
14
|
+
entityLabelPlural: string;
|
|
15
|
+
}
|
|
16
|
+
/** Column chooser state and handlers. */
|
|
17
|
+
export interface OGridColumnChooser {
|
|
18
|
+
columns: IColumnDefinition[];
|
|
19
|
+
visibleColumns: Set<string>;
|
|
20
|
+
onVisibilityChange: (columnKey: string, isVisible: boolean) => void;
|
|
21
|
+
placement: ColumnChooserPlacement;
|
|
22
|
+
}
|
|
23
|
+
/** Filter state. */
|
|
24
|
+
export interface OGridFilters {
|
|
25
|
+
hasActiveFilters: boolean;
|
|
26
|
+
setFilters: (f: IFilters) => void;
|
|
27
|
+
}
|
|
28
|
+
/** Side bar state. */
|
|
29
|
+
export interface OGridSideBarState {
|
|
30
|
+
isEnabled: boolean;
|
|
31
|
+
activePanel: SideBarPanelId | null;
|
|
32
|
+
setActivePanel: (panel: SideBarPanelId | null) => void;
|
|
33
|
+
panels: SideBarPanelId[];
|
|
34
|
+
position: 'left' | 'right';
|
|
35
|
+
isOpen: boolean;
|
|
36
|
+
toggle: (panel: SideBarPanelId) => void;
|
|
37
|
+
close: () => void;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Top-level orchestration service for OGrid: manages pagination, sorting, filtering,
|
|
41
|
+
* column visibility, sidebar, and server-side data fetching via Angular signals.
|
|
42
|
+
*
|
|
43
|
+
* Port of React's useOGrid hook.
|
|
44
|
+
*/
|
|
45
|
+
export declare class OGridService<T> {
|
|
46
|
+
private destroyRef;
|
|
47
|
+
readonly columnsProp: import("@angular/core").WritableSignal<(IColumnDef<T> | IColumnGroupDef<T>)[]>;
|
|
48
|
+
readonly getRowId: import("@angular/core").WritableSignal<(item: T) => RowId>;
|
|
49
|
+
readonly data: import("@angular/core").WritableSignal<T[] | undefined>;
|
|
50
|
+
readonly dataSource: import("@angular/core").WritableSignal<IDataSource<T> | undefined>;
|
|
51
|
+
readonly controlledPage: import("@angular/core").WritableSignal<number | undefined>;
|
|
52
|
+
readonly controlledPageSize: import("@angular/core").WritableSignal<number | undefined>;
|
|
53
|
+
readonly controlledSort: import("@angular/core").WritableSignal<{
|
|
54
|
+
field: string;
|
|
55
|
+
direction: "asc" | "desc";
|
|
56
|
+
} | undefined>;
|
|
57
|
+
readonly controlledFilters: import("@angular/core").WritableSignal<IFilters | undefined>;
|
|
58
|
+
readonly controlledVisibleColumns: import("@angular/core").WritableSignal<Set<string> | undefined>;
|
|
59
|
+
readonly controlledLoading: import("@angular/core").WritableSignal<boolean | undefined>;
|
|
60
|
+
readonly onPageChange: import("@angular/core").WritableSignal<((page: number) => void) | undefined>;
|
|
61
|
+
readonly onPageSizeChange: import("@angular/core").WritableSignal<((size: number) => void) | undefined>;
|
|
62
|
+
readonly onSortChange: import("@angular/core").WritableSignal<((sort: {
|
|
63
|
+
field: string;
|
|
64
|
+
direction: "asc" | "desc";
|
|
65
|
+
}) => void) | undefined>;
|
|
66
|
+
readonly onFiltersChange: import("@angular/core").WritableSignal<((filters: IFilters) => void) | undefined>;
|
|
67
|
+
readonly onVisibleColumnsChange: import("@angular/core").WritableSignal<((cols: Set<string>) => void) | undefined>;
|
|
68
|
+
readonly columnOrder: import("@angular/core").WritableSignal<string[] | undefined>;
|
|
69
|
+
readonly onColumnOrderChange: import("@angular/core").WritableSignal<((order: string[]) => void) | undefined>;
|
|
70
|
+
readonly onColumnResized: import("@angular/core").WritableSignal<((columnId: string, width: number) => void) | undefined>;
|
|
71
|
+
readonly onColumnPinned: import("@angular/core").WritableSignal<((columnId: string, pinned: "left" | "right" | null) => void) | undefined>;
|
|
72
|
+
readonly freezeRows: import("@angular/core").WritableSignal<number | undefined>;
|
|
73
|
+
readonly freezeCols: import("@angular/core").WritableSignal<number | undefined>;
|
|
74
|
+
readonly defaultPageSize: import("@angular/core").WritableSignal<number>;
|
|
75
|
+
readonly defaultSortBy: import("@angular/core").WritableSignal<string | undefined>;
|
|
76
|
+
readonly defaultSortDirection: import("@angular/core").WritableSignal<"asc" | "desc">;
|
|
77
|
+
readonly toolbar: import("@angular/core").WritableSignal<unknown>;
|
|
78
|
+
readonly toolbarBelow: import("@angular/core").WritableSignal<unknown>;
|
|
79
|
+
readonly emptyState: import("@angular/core").WritableSignal<{
|
|
80
|
+
message?: string;
|
|
81
|
+
render?: unknown;
|
|
82
|
+
} | undefined>;
|
|
83
|
+
readonly entityLabelPlural: import("@angular/core").WritableSignal<string>;
|
|
84
|
+
readonly className: import("@angular/core").WritableSignal<string | undefined>;
|
|
85
|
+
readonly layoutMode: import("@angular/core").WritableSignal<"content" | "fill">;
|
|
86
|
+
readonly suppressHorizontalScroll: import("@angular/core").WritableSignal<boolean | undefined>;
|
|
87
|
+
readonly editable: import("@angular/core").WritableSignal<boolean | undefined>;
|
|
88
|
+
readonly cellSelection: import("@angular/core").WritableSignal<boolean | undefined>;
|
|
89
|
+
readonly onCellValueChanged: import("@angular/core").WritableSignal<((event: ICellValueChangedEvent<T>) => void) | undefined>;
|
|
90
|
+
readonly onUndo: import("@angular/core").WritableSignal<(() => void) | undefined>;
|
|
91
|
+
readonly onRedo: import("@angular/core").WritableSignal<(() => void) | undefined>;
|
|
92
|
+
readonly canUndo: import("@angular/core").WritableSignal<boolean | undefined>;
|
|
93
|
+
readonly canRedo: import("@angular/core").WritableSignal<boolean | undefined>;
|
|
94
|
+
readonly rowSelection: import("@angular/core").WritableSignal<"none" | "single" | "multiple">;
|
|
95
|
+
readonly selectedRows: import("@angular/core").WritableSignal<Set<RowId> | undefined>;
|
|
96
|
+
readonly onSelectionChange: import("@angular/core").WritableSignal<((event: IRowSelectionChangeEvent<T>) => void) | undefined>;
|
|
97
|
+
readonly statusBar: import("@angular/core").WritableSignal<boolean | IStatusBarProps | undefined>;
|
|
98
|
+
readonly pageSizeOptions: import("@angular/core").WritableSignal<number[] | undefined>;
|
|
99
|
+
readonly sideBarConfig: import("@angular/core").WritableSignal<boolean | ISideBarDef | undefined>;
|
|
100
|
+
readonly onFirstDataRendered: import("@angular/core").WritableSignal<(() => void) | undefined>;
|
|
101
|
+
readonly onError: import("@angular/core").WritableSignal<((error: unknown) => void) | undefined>;
|
|
102
|
+
readonly columnChooserProp: import("@angular/core").WritableSignal<boolean | "toolbar" | "sidebar" | undefined>;
|
|
103
|
+
readonly ariaLabel: import("@angular/core").WritableSignal<string | undefined>;
|
|
104
|
+
readonly ariaLabelledBy: import("@angular/core").WritableSignal<string | undefined>;
|
|
105
|
+
private readonly internalData;
|
|
106
|
+
private readonly internalLoading;
|
|
107
|
+
private readonly internalPage;
|
|
108
|
+
private readonly internalPageSize;
|
|
109
|
+
private readonly internalSort;
|
|
110
|
+
private readonly internalFilters;
|
|
111
|
+
private readonly internalVisibleColumns;
|
|
112
|
+
private readonly internalSelectedRows;
|
|
113
|
+
private readonly columnWidthOverrides;
|
|
114
|
+
private readonly pinnedOverrides;
|
|
115
|
+
private readonly serverItems;
|
|
116
|
+
private readonly serverTotalCount;
|
|
117
|
+
private readonly serverLoading;
|
|
118
|
+
private fetchId;
|
|
119
|
+
private readonly refreshCounter;
|
|
120
|
+
private firstDataRendered;
|
|
121
|
+
private readonly sideBarActivePanel;
|
|
122
|
+
private readonly serverFilterOptions;
|
|
123
|
+
private readonly loadingFilterOptions;
|
|
124
|
+
private sortInitialized;
|
|
125
|
+
private visibleColumnsInitialized;
|
|
126
|
+
private pageSizeInitialized;
|
|
127
|
+
readonly columns: import("@angular/core").Signal<IColumnDef<T>[]>;
|
|
128
|
+
readonly isServerSide: import("@angular/core").Signal<boolean>;
|
|
129
|
+
readonly isClientSide: import("@angular/core").Signal<boolean>;
|
|
130
|
+
readonly displayData: import("@angular/core").Signal<T[]>;
|
|
131
|
+
readonly displayLoading: import("@angular/core").Signal<boolean>;
|
|
132
|
+
readonly defaultSortField: import("@angular/core").Signal<string>;
|
|
133
|
+
readonly page: import("@angular/core").Signal<number>;
|
|
134
|
+
readonly pageSize: import("@angular/core").Signal<number>;
|
|
135
|
+
readonly sort: import("@angular/core").Signal<{
|
|
136
|
+
field: string;
|
|
137
|
+
direction: "asc" | "desc";
|
|
138
|
+
}>;
|
|
139
|
+
readonly filters: import("@angular/core").Signal<IFilters>;
|
|
140
|
+
readonly visibleColumns: import("@angular/core").Signal<Set<string>>;
|
|
141
|
+
readonly effectiveSelectedRows: import("@angular/core").Signal<Set<RowId>>;
|
|
142
|
+
readonly columnChooserPlacement: import("@angular/core").Signal<ColumnChooserPlacement>;
|
|
143
|
+
readonly multiSelectFilterFields: import("@angular/core").Signal<string[]>;
|
|
144
|
+
readonly hasServerFilterOptions: import("@angular/core").Signal<boolean>;
|
|
145
|
+
readonly clientFilterOptions: import("@angular/core").Signal<Record<string, string[]>>;
|
|
146
|
+
readonly clientItemsAndTotal: import("@angular/core").Signal<{
|
|
147
|
+
items: T[];
|
|
148
|
+
totalCount: number;
|
|
149
|
+
} | null>;
|
|
150
|
+
readonly displayItems: import("@angular/core").Signal<T[]>;
|
|
151
|
+
readonly displayTotalCount: import("@angular/core").Signal<number>;
|
|
152
|
+
readonly hasActiveFilters: import("@angular/core").Signal<boolean>;
|
|
153
|
+
readonly columnChooserColumns: import("@angular/core").Signal<IColumnDefinition[]>;
|
|
154
|
+
readonly statusBarConfig: import("@angular/core").Signal<IStatusBarProps | undefined>;
|
|
155
|
+
readonly isLoadingResolved: import("@angular/core").Signal<boolean>;
|
|
156
|
+
readonly sideBarEnabled: import("@angular/core").Signal<boolean>;
|
|
157
|
+
readonly sideBarParsed: import("@angular/core").Signal<{
|
|
158
|
+
panels: SideBarPanelId[];
|
|
159
|
+
position: "left" | "right";
|
|
160
|
+
defaultPanel: SideBarPanelId | null;
|
|
161
|
+
}>;
|
|
162
|
+
readonly filterableColumns: import("@angular/core").Signal<{
|
|
163
|
+
columnId: string;
|
|
164
|
+
name: string;
|
|
165
|
+
filterField: string;
|
|
166
|
+
filterType: "text" | "multiSelect" | "people" | "date";
|
|
167
|
+
}[]>;
|
|
168
|
+
readonly sideBarState: import("@angular/core").Signal<OGridSideBarState>;
|
|
169
|
+
readonly dataGridProps: import("@angular/core").Signal<IOGridDataGridProps<T>>;
|
|
170
|
+
readonly pagination: import("@angular/core").Signal<OGridPagination>;
|
|
171
|
+
readonly columnChooser: import("@angular/core").Signal<OGridColumnChooser>;
|
|
172
|
+
readonly filtersResult: import("@angular/core").Signal<OGridFilters>;
|
|
173
|
+
readonly sideBarProps: import("@angular/core").Signal<unknown>;
|
|
174
|
+
constructor();
|
|
175
|
+
setPage(p: number): void;
|
|
176
|
+
setPageSize(size: number): void;
|
|
177
|
+
setSort(s: {
|
|
178
|
+
field: string;
|
|
179
|
+
direction: 'asc' | 'desc';
|
|
180
|
+
}): void;
|
|
181
|
+
setFilters(f: IFilters): void;
|
|
182
|
+
setVisibleColumns(cols: Set<string>): void;
|
|
183
|
+
handleSort(columnKey: string): void;
|
|
184
|
+
handleFilterChange(key: string, value: FilterValue | undefined): void;
|
|
185
|
+
handleVisibilityChange(columnKey: string, isVisible: boolean): void;
|
|
186
|
+
handleSelectionChange(event: IRowSelectionChangeEvent<T>): void;
|
|
187
|
+
handleColumnResized(columnId: string, width: number): void;
|
|
188
|
+
handleColumnPinned(columnId: string, pinned: 'left' | 'right' | null): void;
|
|
189
|
+
configure(props: IOGridProps<T>): void;
|
|
190
|
+
getApi(): IOGridApi<T>;
|
|
191
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Type, TemplateRef } from '@angular/core';
|
|
2
|
+
import type { IColumnDef as ICoreColumnDef, CellEditorParams } from '@alaarab/ogrid-core';
|
|
3
|
+
export type { ColumnFilterType, IDateFilterValue, IColumnFilterDef, IColumnMeta, IValueParserParams, ICellValueChangedEvent, CellEditorParams, IColumnGroupDef, HeaderCell, HeaderRow, IColumnDefinition, } from '@alaarab/ogrid-core';
|
|
4
|
+
/** Props passed to custom cell editor components. */
|
|
5
|
+
export interface ICellEditorProps<T = unknown> {
|
|
6
|
+
value: unknown;
|
|
7
|
+
onValueChange: (value: unknown) => void;
|
|
8
|
+
onCommit: () => void;
|
|
9
|
+
onCancel: () => void;
|
|
10
|
+
item: T;
|
|
11
|
+
column: IColumnDef<T>;
|
|
12
|
+
cellEditorParams?: CellEditorParams;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Angular-specific column definition. Extends core's framework-agnostic IColumnDef
|
|
16
|
+
* with renderCell, cellStyle, and a narrowed cellEditor type.
|
|
17
|
+
*/
|
|
18
|
+
export interface IColumnDef<T = unknown> extends ICoreColumnDef<T> {
|
|
19
|
+
/** Custom cell renderer — TemplateRef or string function (Angular-specific). */
|
|
20
|
+
renderCell?: TemplateRef<{
|
|
21
|
+
$implicit: T;
|
|
22
|
+
}> | ((item: T) => string);
|
|
23
|
+
/** Static or per-row cell inline styles (Angular-specific). */
|
|
24
|
+
cellStyle?: Record<string, string> | ((item: T) => Record<string, string>);
|
|
25
|
+
/** Built-in editor type or custom Angular component class. */
|
|
26
|
+
cellEditor?: 'text' | 'select' | 'checkbox' | 'richSelect' | 'date' | Type<unknown>;
|
|
27
|
+
}
|