beautiful-grid 1.0.0-rc.1
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/LICENSE +202 -0
- package/NOTICE +6 -0
- package/README.md +977 -0
- package/TRADEMARK.md +17 -0
- package/cjs/BGrid.js +503 -0
- package/cjs/components/CellEditorIcon.js +209 -0
- package/cjs/components/CellNavigationDomSync.js +117 -0
- package/cjs/components/CellTextEditorGateway.js +393 -0
- package/cjs/components/ColResizer.js +144 -0
- package/cjs/components/EditorPortalRoot.js +96 -0
- package/cjs/components/GridOptionalSurfaces.js +47 -0
- package/cjs/components/GripVertical.js +48 -0
- package/cjs/components/Loading.js +76 -0
- package/cjs/components/Pagination.js +93 -0
- package/cjs/components/PluginCellEditor.js +258 -0
- package/cjs/components/RowSelector.js +74 -0
- package/cjs/components/Table.js +2572 -0
- package/cjs/components/TableBody.js +446 -0
- package/cjs/components/TableBodyCell.js +112 -0
- package/cjs/components/TableBodyFrozen.js +44 -0
- package/cjs/components/TableColGroup.js +48 -0
- package/cjs/components/TableColGroupFrozen.js +57 -0
- package/cjs/components/TableFooter.js +70 -0
- package/cjs/components/TableHead.js +195 -0
- package/cjs/components/TableHeadColumn.js +124 -0
- package/cjs/components/TableHeadFrozen.js +165 -0
- package/cjs/components/TableSummary.js +133 -0
- package/cjs/components/TableSummaryFronzen.js +105 -0
- package/cjs/components/columnSortableRuntime.js +46 -0
- package/cjs/components/context-menu/GridContextMenu.js +174 -0
- package/cjs/components/context-menu/index.js +17 -0
- package/cjs/components/scrollbar/CustomScrollbar.js +58 -0
- package/cjs/components/scrollbar/ScrollbarButton.js +69 -0
- package/cjs/components/scrollbar/ScrollbarTrack.js +106 -0
- package/cjs/components/scrollbar/index.js +20 -0
- package/cjs/components/scrollbar/useScrollbarMetrics.js +103 -0
- package/cjs/components/search/GridSearchController.js +170 -0
- package/cjs/components/search/GridSearchPopover.js +163 -0
- package/cjs/components/search/index.js +18 -0
- package/cjs/components/selection/CellSelectionOverlay.js +52 -0
- package/cjs/components/selection/CellSelectionOverlayLayer.js +65 -0
- package/cjs/components/selection/index.js +18 -0
- package/cjs/components/toolbox/TableHeadToolbox.js +308 -0
- package/cjs/components/toolbox/ToolboxCustomSection.js +55 -0
- package/cjs/components/toolbox/ToolboxNumberFilterSection.js +151 -0
- package/cjs/components/toolbox/ToolboxSortSection.js +68 -0
- package/cjs/components/toolbox/ToolboxTextFilterSection.js +114 -0
- package/cjs/components/toolbox/ToolboxValueFilterSection.js +250 -0
- package/cjs/components/toolbox/index.js +22 -0
- package/cjs/components/useColumnSortable.js +70 -0
- package/cjs/editors/createDateEditorPlugin.js +88 -0
- package/cjs/editors/createSelectEditorPlugin.js +98 -0
- package/cjs/editors/defineEditorPlugin.js +17 -0
- package/cjs/editors/index.js +19 -0
- package/cjs/index.js +19 -0
- package/cjs/store/createAppStore.js +1645 -0
- package/cjs/store/index.js +17 -0
- package/cjs/types.js +14 -0
- package/cjs/utils/buildHeaderMatrix.js +265 -0
- package/cjs/utils/cellEditState.js +71 -0
- package/cjs/utils/cellEditTransaction.js +138 -0
- package/cjs/utils/cellSelectionGeometry.js +179 -0
- package/cjs/utils/common.js +154 -0
- package/cjs/utils/coordinate.js +125 -0
- package/cjs/utils/createPivotData.js +271 -0
- package/cjs/utils/delay.js +7 -0
- package/cjs/utils/filterData.js +182 -0
- package/cjs/utils/getCellSelectionAxisState.js +39 -0
- package/cjs/utils/getCellValue.js +21 -0
- package/cjs/utils/getColumnId.js +60 -0
- package/cjs/utils/getFrozenColumnsWidth.js +21 -0
- package/cjs/utils/getLineNumber.js +7 -0
- package/cjs/utils/getVisibleScrollableRowRange.js +24 -0
- package/cjs/utils/gridSearch.js +135 -0
- package/cjs/utils/index.js +39 -0
- package/cjs/utils/mergedCells.js +76 -0
- package/cjs/utils/mouseEventSubscribe.js +119 -0
- package/cjs/utils/number/index.js +19 -0
- package/cjs/utils/number/toFixed.js +6 -0
- package/cjs/utils/number/toMoney.js +13 -0
- package/cjs/utils/number/toNumber.js +12 -0
- package/cjs/utils/processDataQuery.js +126 -0
- package/cjs/utils/rowReorder.js +131 -0
- package/cjs/utils/scrollbar.js +62 -0
- package/cjs/utils/updateDataQuery.js +147 -0
- package/cjs/utils/useBodyData.js +277 -0
- package/cjs/utils/useForceUpdate.js +57 -0
- package/cjs/utils/useRowReorderController.js +666 -0
- package/esm/BGrid.js +466 -0
- package/esm/components/CellEditorIcon.js +115 -0
- package/esm/components/CellNavigationDomSync.js +80 -0
- package/esm/components/CellTextEditorGateway.js +275 -0
- package/esm/components/ColResizer.js +60 -0
- package/esm/components/EditorPortalRoot.js +57 -0
- package/esm/components/GridOptionalSurfaces.js +10 -0
- package/esm/components/GripVertical.js +11 -0
- package/esm/components/Loading.js +24 -0
- package/esm/components/Pagination.js +44 -0
- package/esm/components/PluginCellEditor.js +110 -0
- package/esm/components/RowSelector.js +38 -0
- package/esm/components/Table.js +2347 -0
- package/esm/components/TableBody.js +315 -0
- package/esm/components/TableBodyCell.js +73 -0
- package/esm/components/TableBodyFrozen.js +6 -0
- package/esm/components/TableColGroup.js +10 -0
- package/esm/components/TableColGroupFrozen.js +19 -0
- package/esm/components/TableFooter.js +30 -0
- package/esm/components/TableHead.js +114 -0
- package/esm/components/TableHeadColumn.js +86 -0
- package/esm/components/TableHeadFrozen.js +102 -0
- package/esm/components/TableSummary.js +66 -0
- package/esm/components/TableSummaryFronzen.js +62 -0
- package/esm/components/columnSortableRuntime.js +38 -0
- package/esm/components/context-menu/GridContextMenu.js +115 -0
- package/esm/components/context-menu/index.js +1 -0
- package/esm/components/scrollbar/CustomScrollbar.js +21 -0
- package/esm/components/scrollbar/ScrollbarButton.js +32 -0
- package/esm/components/scrollbar/ScrollbarTrack.js +66 -0
- package/esm/components/scrollbar/index.js +4 -0
- package/esm/components/scrollbar/useScrollbarMetrics.js +74 -0
- package/esm/components/search/GridSearchController.js +98 -0
- package/esm/components/search/GridSearchPopover.js +109 -0
- package/esm/components/search/index.js +2 -0
- package/esm/components/selection/CellSelectionOverlay.js +5 -0
- package/esm/components/selection/CellSelectionOverlayLayer.js +28 -0
- package/esm/components/selection/index.js +2 -0
- package/esm/components/toolbox/TableHeadToolbox.js +223 -0
- package/esm/components/toolbox/ToolboxCustomSection.js +18 -0
- package/esm/components/toolbox/ToolboxNumberFilterSection.js +98 -0
- package/esm/components/toolbox/ToolboxSortSection.js +31 -0
- package/esm/components/toolbox/ToolboxTextFilterSection.js +61 -0
- package/esm/components/toolbox/ToolboxValueFilterSection.js +195 -0
- package/esm/components/toolbox/index.js +6 -0
- package/esm/components/useColumnSortable.js +33 -0
- package/esm/editors/createDateEditorPlugin.js +48 -0
- package/esm/editors/createSelectEditorPlugin.js +60 -0
- package/esm/editors/defineEditorPlugin.js +6 -0
- package/esm/editors/index.js +3 -0
- package/esm/index.js +3 -0
- package/esm/store/createAppStore.js +1483 -0
- package/esm/store/index.js +1 -0
- package/esm/types.js +11 -0
- package/esm/utils/buildHeaderMatrix.js +231 -0
- package/esm/utils/cellEditState.js +32 -0
- package/esm/utils/cellEditTransaction.js +96 -0
- package/esm/utils/cellSelectionGeometry.js +166 -0
- package/esm/utils/common.js +145 -0
- package/esm/utils/coordinate.js +112 -0
- package/esm/utils/createPivotData.js +226 -0
- package/esm/utils/delay.js +1 -0
- package/esm/utils/filterData.js +176 -0
- package/esm/utils/getCellSelectionAxisState.js +34 -0
- package/esm/utils/getCellValue.js +18 -0
- package/esm/utils/getColumnId.js +52 -0
- package/esm/utils/getFrozenColumnsWidth.js +16 -0
- package/esm/utils/getLineNumber.js +3 -0
- package/esm/utils/getVisibleScrollableRowRange.js +20 -0
- package/esm/utils/gridSearch.js +127 -0
- package/esm/utils/index.js +23 -0
- package/esm/utils/mergedCells.js +70 -0
- package/esm/utils/mouseEventSubscribe.js +113 -0
- package/esm/utils/number/index.js +3 -0
- package/esm/utils/number/toFixed.js +3 -0
- package/esm/utils/number/toMoney.js +10 -0
- package/esm/utils/number/toNumber.js +9 -0
- package/esm/utils/processDataQuery.js +119 -0
- package/esm/utils/rowReorder.js +85 -0
- package/esm/utils/scrollbar.js +51 -0
- package/esm/utils/updateDataQuery.js +130 -0
- package/esm/utils/useBodyData.js +153 -0
- package/esm/utils/useForceUpdate.js +5 -0
- package/esm/utils/useRowReorderController.js +603 -0
- package/package.json +54 -0
- package/style.css +2508 -0
- package/types/BGrid.d.ts +3 -0
- package/types/components/CellEditorIcon.d.ts +13 -0
- package/types/components/CellNavigationDomSync.d.ts +17 -0
- package/types/components/CellTextEditorGateway.d.ts +20 -0
- package/types/components/ColResizer.d.ts +12 -0
- package/types/components/EditorPortalRoot.d.ts +8 -0
- package/types/components/GridOptionalSurfaces.d.ts +10 -0
- package/types/components/GripVertical.d.ts +6 -0
- package/types/components/Loading.d.ts +7 -0
- package/types/components/Pagination.d.ts +5 -0
- package/types/components/PluginCellEditor.d.ts +13 -0
- package/types/components/RowSelector.d.ts +10 -0
- package/types/components/Table.d.ts +61 -0
- package/types/components/TableBody.d.ts +39 -0
- package/types/components/TableBodyCell.d.ts +20 -0
- package/types/components/TableBodyFrozen.d.ts +15 -0
- package/types/components/TableColGroup.d.ts +3 -0
- package/types/components/TableColGroupFrozen.d.ts +5 -0
- package/types/components/TableFooter.d.ts +9 -0
- package/types/components/TableHead.d.ts +21 -0
- package/types/components/TableHeadColumn.d.ts +8 -0
- package/types/components/TableHeadFrozen.d.ts +7 -0
- package/types/components/TableSummary.d.ts +13 -0
- package/types/components/TableSummaryFronzen.d.ts +7 -0
- package/types/components/columnSortableRuntime.d.ts +12 -0
- package/types/components/context-menu/GridContextMenu.d.ts +6 -0
- package/types/components/context-menu/index.d.ts +1 -0
- package/types/components/scrollbar/CustomScrollbar.d.ts +11 -0
- package/types/components/scrollbar/ScrollbarButton.d.ts +9 -0
- package/types/components/scrollbar/ScrollbarTrack.d.ts +11 -0
- package/types/components/scrollbar/index.d.ts +4 -0
- package/types/components/scrollbar/useScrollbarMetrics.d.ts +12 -0
- package/types/components/search/GridSearchController.d.ts +1 -0
- package/types/components/search/GridSearchPopover.d.ts +6 -0
- package/types/components/search/index.d.ts +2 -0
- package/types/components/selection/CellSelectionOverlay.d.ts +17 -0
- package/types/components/selection/CellSelectionOverlayLayer.d.ts +18 -0
- package/types/components/selection/index.d.ts +2 -0
- package/types/components/toolbox/TableHeadToolbox.d.ts +13 -0
- package/types/components/toolbox/ToolboxCustomSection.d.ts +11 -0
- package/types/components/toolbox/ToolboxNumberFilterSection.d.ts +8 -0
- package/types/components/toolbox/ToolboxSortSection.d.ts +8 -0
- package/types/components/toolbox/ToolboxTextFilterSection.d.ts +8 -0
- package/types/components/toolbox/ToolboxValueFilterSection.d.ts +8 -0
- package/types/components/toolbox/index.d.ts +6 -0
- package/types/components/useColumnSortable.d.ts +13 -0
- package/types/editors/createDateEditorPlugin.d.ts +8 -0
- package/types/editors/createSelectEditorPlugin.d.ts +15 -0
- package/types/editors/defineEditorPlugin.d.ts +2 -0
- package/types/editors/index.d.ts +3 -0
- package/types/index.d.ts +3 -0
- package/types/store/createAppStore.d.ts +13 -0
- package/types/store/index.d.ts +1 -0
- package/types/types.d.ts +864 -0
- package/types/utils/buildHeaderMatrix.d.ts +32 -0
- package/types/utils/cellEditState.d.ts +12 -0
- package/types/utils/cellEditTransaction.d.ts +14 -0
- package/types/utils/cellSelectionGeometry.d.ts +34 -0
- package/types/utils/common.d.ts +3 -0
- package/types/utils/coordinate.d.ts +29 -0
- package/types/utils/createPivotData.d.ts +12 -0
- package/types/utils/delay.d.ts +1 -0
- package/types/utils/filterData.d.ts +18 -0
- package/types/utils/getCellSelectionAxisState.d.ts +12 -0
- package/types/utils/getCellValue.d.ts +2 -0
- package/types/utils/getColumnId.d.ts +19 -0
- package/types/utils/getFrozenColumnsWidth.d.ts +12 -0
- package/types/utils/getLineNumber.d.ts +6 -0
- package/types/utils/getVisibleScrollableRowRange.d.ts +20 -0
- package/types/utils/gridSearch.d.ts +18 -0
- package/types/utils/index.d.ts +23 -0
- package/types/utils/mergedCells.d.ts +14 -0
- package/types/utils/mouseEventSubscribe.d.ts +18 -0
- package/types/utils/number/index.d.ts +3 -0
- package/types/utils/number/toFixed.d.ts +1 -0
- package/types/utils/number/toMoney.d.ts +1 -0
- package/types/utils/number/toNumber.d.ts +1 -0
- package/types/utils/processDataQuery.d.ts +19 -0
- package/types/utils/rowReorder.d.ts +24 -0
- package/types/utils/scrollbar.d.ts +13 -0
- package/types/utils/updateDataQuery.d.ts +28 -0
- package/types/utils/useBodyData.d.ts +9 -0
- package/types/utils/useForceUpdate.d.ts +1 -0
- package/types/utils/useRowReorderController.d.ts +19 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { AlignDirection, AppModelColumn, BGridColumnGroup, BGridColumnGroupNode } from '../types';
|
|
2
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
3
|
+
export interface HeaderCellDescriptor<T> {
|
|
4
|
+
key: string;
|
|
5
|
+
type: 'group' | 'column';
|
|
6
|
+
columnIndex?: number;
|
|
7
|
+
startColumnIndex: number;
|
|
8
|
+
endColumnIndex: number;
|
|
9
|
+
rowSpan: number;
|
|
10
|
+
colSpan: number;
|
|
11
|
+
depth: number;
|
|
12
|
+
label: ReactNode;
|
|
13
|
+
headerAlign?: AlignDirection;
|
|
14
|
+
className?: string;
|
|
15
|
+
headerStyle?: CSSProperties;
|
|
16
|
+
groupId?: string;
|
|
17
|
+
parentGroupId?: string;
|
|
18
|
+
column?: AppModelColumn<T>;
|
|
19
|
+
}
|
|
20
|
+
export interface BuildHeaderMatrixOptions<T> {
|
|
21
|
+
columns: AppModelColumn<T>[];
|
|
22
|
+
columnGroups?: BGridColumnGroupNode[];
|
|
23
|
+
columnsGroup?: BGridColumnGroup[];
|
|
24
|
+
startColumnIndex?: number;
|
|
25
|
+
endColumnIndex?: number;
|
|
26
|
+
}
|
|
27
|
+
export interface HeaderMatrix<T> {
|
|
28
|
+
rows: HeaderCellDescriptor<T>[][];
|
|
29
|
+
rowCount: number;
|
|
30
|
+
errors: string[];
|
|
31
|
+
}
|
|
32
|
+
export declare function buildHeaderMatrix<T>({ columns, columnGroups, columnsGroup, startColumnIndex, endColumnIndex, }: BuildHeaderMatrixOptions<T>): HeaderMatrix<T>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BGridColumn, BGridDataItem } from '../types';
|
|
2
|
+
type ResolvedColumnKey<T> = BGridColumn<T> & {
|
|
3
|
+
keyToken?: string;
|
|
4
|
+
};
|
|
5
|
+
export declare function markCellEdited<T>(item: BGridDataItem<T>, column: BGridColumn<T>): void;
|
|
6
|
+
export declare function isCellEdited<T>(item: BGridDataItem<T>, column: BGridColumn<T>): boolean;
|
|
7
|
+
export declare function markCellValueChanged<T>(item: BGridDataItem<T>, column: ResolvedColumnKey<T>): void;
|
|
8
|
+
export declare function isCellValueChanged<T>(item: BGridDataItem<T>, column: ResolvedColumnKey<T>): boolean;
|
|
9
|
+
export declare function clearEditedCells<T>(item: BGridDataItem<T>): void;
|
|
10
|
+
export declare function clearChangedValues<T>(item: BGridDataItem<T>): void;
|
|
11
|
+
export declare function clearCellChangeState<T>(item: BGridDataItem<T>): void;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AppModelColumn, BGridCellValueChange, BGridColumn, BGridDataItem } from '../types';
|
|
2
|
+
export interface BGridResolvedCellValueChange<T> {
|
|
3
|
+
column: AppModelColumn<T>;
|
|
4
|
+
change: BGridCellValueChange<T>;
|
|
5
|
+
}
|
|
6
|
+
export interface BGridAppliedRowChanges<T> {
|
|
7
|
+
item: BGridDataItem<T>;
|
|
8
|
+
changes: BGridCellValueChange<T>[];
|
|
9
|
+
columns: AppModelColumn<T>[];
|
|
10
|
+
}
|
|
11
|
+
export declare function resolveCellValueChanges<T>(changes: readonly BGridCellValueChange<T>[], columns: AppModelColumn<T>[]): BGridResolvedCellValueChange<T>[];
|
|
12
|
+
export declare function setCellValueImmutable<T>(values: T, key: BGridColumn<T>['key'], value: unknown): T;
|
|
13
|
+
export declare function createNextValues<T>(values: T, changes: readonly BGridResolvedCellValueChange<T>[]): T;
|
|
14
|
+
export declare function applyChangesToItem<T>(item: BGridDataItem<T>, changes: readonly BGridResolvedCellValueChange<T>[]): BGridAppliedRowChanges<T>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { AppModelColumn, BGridCellSelectionRange } from '../types';
|
|
2
|
+
export type BGridSelectionQuadrant = 'top-left' | 'top-main' | 'body-left' | 'body-main';
|
|
3
|
+
export interface BGridSelectionFragmentEdges {
|
|
4
|
+
top: boolean;
|
|
5
|
+
right: boolean;
|
|
6
|
+
bottom: boolean;
|
|
7
|
+
left: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface BGridSelectionFragment {
|
|
10
|
+
rangeIndex: number;
|
|
11
|
+
quadrant: BGridSelectionQuadrant;
|
|
12
|
+
left: number;
|
|
13
|
+
top: number;
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
edges: BGridSelectionFragmentEdges;
|
|
17
|
+
}
|
|
18
|
+
export interface BGridSelectionGeometryParams {
|
|
19
|
+
ranges: readonly BGridCellSelectionRange[];
|
|
20
|
+
columns: readonly AppModelColumn<any>[];
|
|
21
|
+
rowCount: number;
|
|
22
|
+
rowHeight: number;
|
|
23
|
+
frozenColumnCount: number;
|
|
24
|
+
frozenRowCount: number;
|
|
25
|
+
frozenColumnsWidth: number;
|
|
26
|
+
}
|
|
27
|
+
export declare function getCellSelectionFragments({ ranges, columns, rowCount, rowHeight, frozenColumnCount, frozenRowCount, frozenColumnsWidth, }: BGridSelectionGeometryParams): BGridSelectionFragment[];
|
|
28
|
+
export declare function clipCellSelectionFragment(fragment: BGridSelectionFragment, viewport: {
|
|
29
|
+
left: number;
|
|
30
|
+
top: number;
|
|
31
|
+
width: number;
|
|
32
|
+
height: number;
|
|
33
|
+
}): BGridSelectionFragment | undefined;
|
|
34
|
+
export declare function normalizeCellSelectionRange(range: BGridCellSelectionRange): BGridCellSelectionRange;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AppModelColumn, BGridCellAddress } from '../types';
|
|
2
|
+
export declare function clamp(value: number, min: number, max: number): number;
|
|
3
|
+
export declare function clampCellAddress(address: BGridCellAddress, rowCount: number, columnCount: number): BGridCellAddress;
|
|
4
|
+
export declare function getColumnLeft(columnIndex: number, columns: AppModelColumn<any>[]): number;
|
|
5
|
+
export declare function getColumnRight(columnIndex: number, columns: AppModelColumn<any>[]): number;
|
|
6
|
+
export declare function getRowTop(rowIndex: number, rowHeight: number): number;
|
|
7
|
+
export declare function getRowBottom(rowIndex: number, rowHeight: number): number;
|
|
8
|
+
export interface EnsureCellVisibleParams {
|
|
9
|
+
cell: BGridCellAddress;
|
|
10
|
+
scrollContainer: HTMLElement | null;
|
|
11
|
+
frozenColumnCount?: number;
|
|
12
|
+
frozenRowCount?: number;
|
|
13
|
+
columns: AppModelColumn<any>[];
|
|
14
|
+
rowHeight: number;
|
|
15
|
+
viewportInsets?: {
|
|
16
|
+
top?: number;
|
|
17
|
+
right?: number;
|
|
18
|
+
bottom?: number;
|
|
19
|
+
left?: number;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export interface EnsureCellVisibleResult {
|
|
23
|
+
scrollTop: number;
|
|
24
|
+
scrollLeft: number;
|
|
25
|
+
didScroll: boolean;
|
|
26
|
+
didScrollTop: boolean;
|
|
27
|
+
didScrollLeft: boolean;
|
|
28
|
+
}
|
|
29
|
+
export declare function ensureCellVisible({ cell, scrollContainer, frozenColumnCount, frozenRowCount, columns, rowHeight, viewportInsets, }: EnsureCellVisibleParams): EnsureCellVisibleResult;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BGridColumnGroup, BGridColumnWithOptionalWidth, BGridDataItem, BGridPivotOptions } from '../types';
|
|
2
|
+
interface CreatePivotDataParams<T> {
|
|
3
|
+
data: BGridDataItem<T>[];
|
|
4
|
+
pivot?: BGridPivotOptions<T>;
|
|
5
|
+
}
|
|
6
|
+
export interface PivotDataResult {
|
|
7
|
+
data: BGridDataItem<Record<string, any>>[];
|
|
8
|
+
columns: BGridColumnWithOptionalWidth<Record<string, any>>[];
|
|
9
|
+
columnsGroup: BGridColumnGroup[];
|
|
10
|
+
}
|
|
11
|
+
export declare function createPivotData<T>({ data, pivot }: CreatePivotDataParams<T>): PivotDataResult | undefined;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const delay: <T>(ms: number, result?: T) => Promise<T>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BGridColumn, BGridDataItem, BGridFilterParam } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Normalizes a raw cell value for values-based filtering.
|
|
4
|
+
* undefined is normalized to null and Date is serialized to an ISO string so
|
|
5
|
+
* values-filter candidates and row comparisons share the public primitive type.
|
|
6
|
+
*/
|
|
7
|
+
export declare function normalizeValueForFilter(value: unknown): unknown;
|
|
8
|
+
/**
|
|
9
|
+
* Evaluates whether a single row matches the filter condition for a column.
|
|
10
|
+
*/
|
|
11
|
+
export declare function matchColumnFilter<T>(item: BGridDataItem<T>, column: BGridColumn<T>, filter: BGridFilterParam): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Filters rows against all active filter parameters (AND combination).
|
|
14
|
+
*/
|
|
15
|
+
export declare function filterRows<T>(data: BGridDataItem<T>[], columns: BGridColumn<T>[], filterParams: BGridFilterParam[]): {
|
|
16
|
+
item: BGridDataItem<T>;
|
|
17
|
+
sourceIndex: number;
|
|
18
|
+
}[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BGridCellAddress, BGridCellSelectionRange } from '../types';
|
|
2
|
+
export interface BGridCellSelectionAxisState {
|
|
3
|
+
rowIndexes: Set<number>;
|
|
4
|
+
columnIndexes: Set<number>;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Collects the row and column indexes represented by the active cell and every
|
|
8
|
+
* selection range. The returned sets are shared by the header and line-number
|
|
9
|
+
* renderers so frozen and scrollable regions use identical selection semantics.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getCellSelectionAxisState(activeCell: BGridCellAddress | undefined, ranges: BGridCellSelectionRange[]): BGridCellSelectionAxisState;
|
|
12
|
+
export declare function isColumnAxisRangeActive(columnIndexes: Set<number>, startColumnIndex: number, columnSpan?: number): boolean;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BGridColumn } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Returns a stable identifier for the data field referenced by a column.
|
|
4
|
+
* Unlike getColumnId, explicit column ids do not affect this token, so columns
|
|
5
|
+
* that render the same key share the same value-change identity.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getColumnKeyToken<T>(key: BGridColumn<T>['key']): string;
|
|
8
|
+
/**
|
|
9
|
+
* Returns a stable unique column identifier.
|
|
10
|
+
* If column.id is explicitly provided, it is returned as is.
|
|
11
|
+
* Otherwise, column.key is serialized in a conflict-free manner.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getColumnId<T>(column: BGridColumn<T>): string;
|
|
14
|
+
/**
|
|
15
|
+
* Checks for duplicate column IDs in development mode.
|
|
16
|
+
* If onlyToolbox is true, only returns duplicates among toolbox-enabled columns.
|
|
17
|
+
* Returns a Set of duplicated IDs if any.
|
|
18
|
+
*/
|
|
19
|
+
export declare function findDuplicateColumnIds<T>(columns: BGridColumn<T>[], onlyToolbox?: boolean): Set<string>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BGridColumn, BGridRowChecked } from '../types';
|
|
2
|
+
interface Props<T> {
|
|
3
|
+
showLineNumber?: boolean;
|
|
4
|
+
rowChecked?: BGridRowChecked<T>;
|
|
5
|
+
itemHeight: number;
|
|
6
|
+
frozenColumnIndex: number;
|
|
7
|
+
columns: BGridColumn<T>[];
|
|
8
|
+
dataLength: number;
|
|
9
|
+
reorderable?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function getFrozenColumnsWidth<T>({ showLineNumber, rowChecked, itemHeight, frozenColumnIndex, columns, dataLength, reorderable, }: Props<T>): number;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface VisibleScrollableRowRangeParams {
|
|
2
|
+
scrollTop: number;
|
|
3
|
+
viewportHeight: number;
|
|
4
|
+
rowHeight: number;
|
|
5
|
+
frozenRowCount: number;
|
|
6
|
+
totalRowCount: number;
|
|
7
|
+
overscan?: number;
|
|
8
|
+
windowSize?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface VisibleScrollableRowRange {
|
|
11
|
+
startRowIndex: number;
|
|
12
|
+
endRowIndex: number;
|
|
13
|
+
paddingTop: number;
|
|
14
|
+
scrollContentHeight: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Maps the scrollable body's physical scroll offset to logical data row indexes.
|
|
18
|
+
* The returned end index is exclusive.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getVisibleScrollableRowRange({ scrollTop, viewportHeight, rowHeight, frozenRowCount, totalRowCount, overscan, windowSize, }: VisibleScrollableRowRangeParams): VisibleScrollableRowRange;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import { AppModelColumn, BGridDataItem, BGridProps, BGridSearchMatch, BGridSearchOptions } from '../types';
|
|
3
|
+
export declare function normalizeSearchText(value: unknown): string;
|
|
4
|
+
export interface FindGridSearchMatchesParams<T> {
|
|
5
|
+
data: BGridDataItem<T>[];
|
|
6
|
+
columns: AppModelColumn<T>[];
|
|
7
|
+
sourceIndexByVisibleIndex: number[];
|
|
8
|
+
rowKey?: React.Key | React.Key[];
|
|
9
|
+
cellMergeOptions?: BGridProps<T>['cellMergeOptions'];
|
|
10
|
+
searchOptions?: BGridSearchOptions<T>;
|
|
11
|
+
query: string;
|
|
12
|
+
startRowIndex?: number;
|
|
13
|
+
endRowIndex?: number;
|
|
14
|
+
onGetSearchTextError?: (columnId: string, error: unknown) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare function findGridSearchMatches<T>({ data, columns, sourceIndexByVisibleIndex, rowKey, cellMergeOptions, searchOptions, query, startRowIndex, endRowIndex, onGetSearchTextError, }: FindGridSearchMatchesParams<T>): BGridSearchMatch[];
|
|
17
|
+
export declare function dedupeSearchMatches(matches: BGridSearchMatch[]): BGridSearchMatch[];
|
|
18
|
+
export declare function findMatchingSearchResultIndex(matches: BGridSearchMatch[], previous?: BGridSearchMatch, previousIndex?: number): number | undefined;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export * from './getCellValue';
|
|
2
|
+
export * from './getFrozenColumnsWidth';
|
|
3
|
+
export * from './mouseEventSubscribe';
|
|
4
|
+
export * from './common';
|
|
5
|
+
export * from './useForceUpdate';
|
|
6
|
+
export * from './delay';
|
|
7
|
+
export * from './getLineNumber';
|
|
8
|
+
export * from './useBodyData';
|
|
9
|
+
export * from './createPivotData';
|
|
10
|
+
export * from './getColumnId';
|
|
11
|
+
export * from './updateDataQuery';
|
|
12
|
+
export * from './filterData';
|
|
13
|
+
export * from './processDataQuery';
|
|
14
|
+
export * from './scrollbar';
|
|
15
|
+
export * from './number';
|
|
16
|
+
export * from './buildHeaderMatrix';
|
|
17
|
+
export * from './getVisibleScrollableRowRange';
|
|
18
|
+
export * from './cellEditState';
|
|
19
|
+
export * from './getCellSelectionAxisState';
|
|
20
|
+
export * from './mergedCells';
|
|
21
|
+
export * from './gridSearch';
|
|
22
|
+
export * from './cellEditTransaction';
|
|
23
|
+
export * from './rowReorder';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BGridCellAddress, BGridDataItem, BGridProps } from '../types';
|
|
2
|
+
export interface BGridMergedRowRange {
|
|
3
|
+
startRowIndex: number;
|
|
4
|
+
endRowIndex: number;
|
|
5
|
+
}
|
|
6
|
+
export interface BGridLogicalCell {
|
|
7
|
+
cell: BGridCellAddress;
|
|
8
|
+
rowRange: BGridMergedRowRange;
|
|
9
|
+
rowIndexes: number[];
|
|
10
|
+
merged: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function getMergedRowRange<T>(data: BGridDataItem<T>[], mergeBy: string | string[], requestedRowIndex: number): BGridMergedRowRange;
|
|
13
|
+
export declare function resolveLogicalCell<T>(data: BGridDataItem<T>[], cellMergeOptions: BGridProps<T>['cellMergeOptions'], requestedCell: BGridCellAddress): BGridLogicalCell;
|
|
14
|
+
export declare function isRowInLogicalCell(logicalCell: BGridLogicalCell, rowIndex: number): boolean;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface IMousePosition {
|
|
2
|
+
pageX: number;
|
|
3
|
+
pageY: number;
|
|
4
|
+
clientX: number;
|
|
5
|
+
clientY: number;
|
|
6
|
+
}
|
|
7
|
+
export type MouseEventSubscribeCallbackFn = (mousePosition: IMousePosition, stopEvent: () => void) => void;
|
|
8
|
+
export interface IMouseEventSubscribeOptions {
|
|
9
|
+
interval?: number;
|
|
10
|
+
target?: EventTarget & {
|
|
11
|
+
ownerDocument?: Document;
|
|
12
|
+
setPointerCapture?: (pointerId: number) => void;
|
|
13
|
+
releasePointerCapture?: (pointerId: number) => void;
|
|
14
|
+
};
|
|
15
|
+
pointerId?: number;
|
|
16
|
+
initialClientX?: number;
|
|
17
|
+
}
|
|
18
|
+
export declare const mouseEventSubscribe: (callBack: MouseEventSubscribeCallbackFn, onEnd?: () => void, options?: IMouseEventSubscribeOptions) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function toFixed(value: number): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function toMoney(value: unknown): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function toNumber(value: unknown): number;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BGridColumn, BGridDataItem, BGridDataQuery, BGridProcessedRow, BGridProps } from '../types';
|
|
2
|
+
export interface BGridProcessDataQueryParams<T> {
|
|
3
|
+
data: BGridDataItem<T>[];
|
|
4
|
+
columns: BGridColumn<T>[];
|
|
5
|
+
query: BGridDataQuery;
|
|
6
|
+
rowKey?: BGridProps<T>['rowKey'];
|
|
7
|
+
/** Skip BGridProcessedRow metadata when the caller only needs data and index mappings. */
|
|
8
|
+
includeRows?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface BGridProcessDataQueryResult<T> {
|
|
11
|
+
rows: BGridProcessedRow<T>[];
|
|
12
|
+
data: BGridDataItem<T>[];
|
|
13
|
+
sourceIndexByVisibleIndex: number[];
|
|
14
|
+
visibleIndexBySourceIndex: Map<number, number>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Pure data processing pipeline: filter then stable multi-sort.
|
|
18
|
+
*/
|
|
19
|
+
export declare function processDataQuery<T>(params: BGridProcessDataQueryParams<T>): BGridProcessDataQueryResult<T>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BGridDataItem } from '../types';
|
|
2
|
+
export type BGridRowReorderPhase = 'dragging' | 'settling' | 'cancelling';
|
|
3
|
+
export type BGridRowReorderRole = 'source' | 'shift' | 'target' | undefined;
|
|
4
|
+
export declare function moveRowItem<T>(items: readonly BGridDataItem<T>[], fromIndex: number, toIndex: number): BGridDataItem<T>[];
|
|
5
|
+
export declare function remapRowIndex(index: number, fromIndex: number, toIndex: number): number;
|
|
6
|
+
export declare function remapCheckedIndexesMap(checkedIndexesMap: ReadonlyMap<number, any>, fromIndex: number, toIndex: number): Map<number, any>;
|
|
7
|
+
export declare function getRowReorderTargetIndex(params: {
|
|
8
|
+
fromIndex: number;
|
|
9
|
+
pointerOffsetY: number;
|
|
10
|
+
rowHeight: number;
|
|
11
|
+
rowCount: number;
|
|
12
|
+
}): number;
|
|
13
|
+
export declare function getRowReorderOffset(params: {
|
|
14
|
+
rowIndex: number;
|
|
15
|
+
fromIndex: number;
|
|
16
|
+
toIndex: number;
|
|
17
|
+
rowHeight: number;
|
|
18
|
+
}): number;
|
|
19
|
+
export declare function getRowReorderRole(params: {
|
|
20
|
+
rowIndex: number;
|
|
21
|
+
fromIndex: number;
|
|
22
|
+
toIndex: number;
|
|
23
|
+
}): BGridRowReorderRole;
|
|
24
|
+
export declare function getMaxTransitionTimeMs(style: Pick<CSSStyleDeclaration, 'transitionDelay' | 'transitionDuration'>): number;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BGridPaginationViewOptions, BGridResolvedPaginationViewOptions, BGridResolvedScrollbarOptions, BGridResolvedStatusOptions, BGridScrollbarOptions, BGridStatusOptions, BGridStatusContent, BGridStatusContext } from '../types';
|
|
3
|
+
export declare function resolveStatusOptions(options?: BGridStatusOptions): BGridResolvedStatusOptions;
|
|
4
|
+
export declare function resolvePaginationViewOptions(options?: BGridPaginationViewOptions): BGridResolvedPaginationViewOptions;
|
|
5
|
+
export declare function resolveScrollbarOptions(options: BGridScrollbarOptions | undefined): BGridResolvedScrollbarOptions;
|
|
6
|
+
export declare function shouldRenderBottomBar(params: {
|
|
7
|
+
hasPage: boolean;
|
|
8
|
+
hasHorizontalOverflow?: boolean;
|
|
9
|
+
scrollbar: BGridResolvedScrollbarOptions;
|
|
10
|
+
status: BGridResolvedStatusOptions;
|
|
11
|
+
pagination: BGridResolvedPaginationViewOptions;
|
|
12
|
+
}): boolean;
|
|
13
|
+
export declare function resolveStatusContent(content: BGridStatusContent | undefined, context: BGridStatusContext): React.ReactNode;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BGridDataQuery, BGridFilterParam, BGridSortParam } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Checks if a filter parameter has a valid, non-empty condition.
|
|
4
|
+
*/
|
|
5
|
+
export declare function isFilterParamActive(filter: BGridFilterParam | undefined | null): filter is BGridFilterParam;
|
|
6
|
+
/**
|
|
7
|
+
* Normalizes a text filter by trimming whitespace.
|
|
8
|
+
*/
|
|
9
|
+
export declare function normalizeFilterParam(filter: BGridFilterParam): BGridFilterParam | null;
|
|
10
|
+
/**
|
|
11
|
+
* Creates an immutable updated query while keeping sort and filter params sanitized.
|
|
12
|
+
*/
|
|
13
|
+
export declare function updateDataQuery(current: BGridDataQuery, updater: (draft: {
|
|
14
|
+
sortParams: BGridSortParam[];
|
|
15
|
+
filterParams: BGridFilterParam[];
|
|
16
|
+
}) => void): BGridDataQuery;
|
|
17
|
+
/**
|
|
18
|
+
* Sets or clears column sort on the query.
|
|
19
|
+
*/
|
|
20
|
+
export declare function applySortToQuery(query: BGridDataQuery, columnId: string, key: string | string[] | undefined, order: 'asc' | 'desc' | null, multiSort?: boolean): BGridDataQuery;
|
|
21
|
+
/**
|
|
22
|
+
* Sets or updates column filter on the query.
|
|
23
|
+
*/
|
|
24
|
+
export declare function applyFilterToQuery(query: BGridDataQuery, filter: BGridFilterParam): BGridDataQuery;
|
|
25
|
+
/**
|
|
26
|
+
* Clears column filter from the query.
|
|
27
|
+
*/
|
|
28
|
+
export declare function clearFilterFromQuery(query: BGridDataQuery, columnId: string): BGridDataQuery;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BGridColumn, BGridDataItem, MoveDirection } from '../types';
|
|
2
|
+
export declare function useBodyData(startIdx: number, endNumber: number, data: BGridDataItem<any>[]): {
|
|
3
|
+
dataSet: BGridDataItem<any>[];
|
|
4
|
+
setItemValue: (_ri: number, _ci: number, column: BGridColumn<any>, newValue: any) => Promise<void>;
|
|
5
|
+
handleMoveEditFocus: (rowIndex: number, columnIndex: number, columnDirection?: MoveDirection, rowDirection?: MoveDirection) => Promise<void>;
|
|
6
|
+
handleChangeChecked: (index: number, checked: boolean) => Promise<void>;
|
|
7
|
+
handleChangeCheckedRadio: (index: number) => Promise<void>;
|
|
8
|
+
getRowSpan: (rowIndex: number, columnIndex: number) => number;
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useForceUpdate(): () => void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface BGridRowReorderPreviewState {
|
|
3
|
+
text: string;
|
|
4
|
+
visible: boolean;
|
|
5
|
+
phase: 'dragging' | 'settling' | 'cancelling';
|
|
6
|
+
}
|
|
7
|
+
interface UseRowReorderControllerParams {
|
|
8
|
+
containerRef: React.RefObject<HTMLDivElement | null>;
|
|
9
|
+
bodyContainerRef: React.RefObject<HTMLDivElement | null>;
|
|
10
|
+
scrollContainerRef: React.RefObject<HTMLDivElement | null>;
|
|
11
|
+
rowHeight: number;
|
|
12
|
+
}
|
|
13
|
+
export declare function useRowReorderController<T>({ containerRef, bodyContainerRef, scrollContainerRef, rowHeight, }: UseRowReorderControllerParams): {
|
|
14
|
+
announcement: string;
|
|
15
|
+
onKeyDown: (event: React.KeyboardEvent<HTMLButtonElement>, rowIndex: number) => void;
|
|
16
|
+
onPointerDown: (event: React.PointerEvent<HTMLButtonElement>, rowIndex: number) => void;
|
|
17
|
+
preview: BGridRowReorderPreviewState | undefined;
|
|
18
|
+
};
|
|
19
|
+
export {};
|