@omnigrid/core 0.1.11 → 0.1.12

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/README.md CHANGED
@@ -71,6 +71,14 @@ interface ColumnLeafDef<T> {
71
71
  cellClass?: string | ((params: CellRenderParams<T>) => string | undefined);
72
72
  getCellClass?: (params: CellRenderParams<T>) => string | undefined;
73
73
  cellClassRules?: CellClassRules<T>;
74
+ getColumnStyle?: (params: ColumnStyleParams<T>) => ColumnStyle | undefined;
75
+ getColumnClass?: (params: ColumnStyleParams<T>) => string | undefined;
76
+ columnClassRules?: ColumnClassRules<T>;
77
+ headerStyle?: HeaderStyle;
78
+ getHeaderStyle?: (params: HeaderRenderParams<T>) => HeaderStyle | undefined;
79
+ headerClass?: string | ((params: HeaderRenderParams<T>) => string | undefined);
80
+ getHeaderClass?: (params: HeaderRenderParams<T>) => string | undefined;
81
+ headerClassRules?: HeaderClassRules<T>;
74
82
  headerRenderer?: (column: ColumnDef<T>) => unknown;
75
83
  stopRowClick?: boolean;
76
84
  stopHeaderClick?: boolean;
@@ -83,6 +91,11 @@ interface ColumnGroupDef<T> {
83
91
  pinned?: "left" | "right";
84
92
  collapsible?: boolean;
85
93
  defaultExpanded?: boolean;
94
+ headerStyle?: HeaderStyle;
95
+ getHeaderStyle?: (params: HeaderGroupRenderParams<T>) => HeaderStyle | undefined;
96
+ headerClass?: string | ((params: HeaderGroupRenderParams<T>) => string | undefined);
97
+ getHeaderClass?: (params: HeaderGroupRenderParams<T>) => string | undefined;
98
+ headerClassRules?: HeaderGroupClassRules<T>;
86
99
  headerRenderer?: (column: ColumnDef<T>) => unknown;
87
100
  }
88
101
  ```
package/dist/columns.d.ts CHANGED
@@ -31,3 +31,12 @@ export declare function flattenColumns<T>(columns: ColumnDef<T>[]): ColumnLeafDe
31
31
  * tree when rendering stacked header rows.
32
32
  */
33
33
  export declare function getColumnGroups<T>(columns: ColumnDef<T>[], isVisible?: (leaf: ColumnLeafDef<T>) => boolean): ColumnGroupViewport<T>[];
34
+ /**
35
+ * Resolves the raw cell value from a row object using `valueGetter` or `field`.
36
+ *
37
+ * @param row - The row data object.
38
+ * @param column - The leaf column definition.
39
+ * @returns The resolved cell value, or undefined if not accessible.
40
+ * @api
41
+ */
42
+ export declare function getCellValue<T>(row: T, column: ColumnLeafDef<T>): unknown;
package/dist/columns.js CHANGED
@@ -75,3 +75,18 @@ export function getColumnGroups(columns, isVisible = () => true) {
75
75
  walk(columns, 0);
76
76
  return result;
77
77
  }
78
+ /**
79
+ * Resolves the raw cell value from a row object using `valueGetter` or `field`.
80
+ *
81
+ * @param row - The row data object.
82
+ * @param column - The leaf column definition.
83
+ * @returns The resolved cell value, or undefined if not accessible.
84
+ * @api
85
+ */
86
+ export function getCellValue(row, column) {
87
+ if (column.valueGetter)
88
+ return column.valueGetter(row);
89
+ if (column.field)
90
+ return row[column.field];
91
+ return undefined;
92
+ }
package/dist/index.d.ts CHANGED
@@ -8,6 +8,6 @@ export { Grid as GridCore } from "./grid";
8
8
  export { SlotManager } from "./slots";
9
9
  export { Store } from "./store";
10
10
  export type { OverlayOptions, OverlayScope, OverlayState, OverlayType } from "./overlays";
11
- export type { BlockConfig, CellAlign, CellRenderParams, CellClassRules, CheckboxControl, CheckboxRenderParams, ColumnDef, ColumnGroupDef, ColumnGroupViewport, ColumnLeafDef, DataProcessor, DomPoolBindings, DomPoolUpdate, GridApi, GridEvents, GridOptions, GridPlugin, GridState, OverlayComponent, OverlayComponentProps, PooledRow, Range, RowClassRules, RowClickEvent, RowHost, RowHoverEvent, RowId, RowRenderParams, RowStyle, ScrollPosition, SlotComponentContent, SlotContent, SlotHtmlContent, SlotMount, SlotMountOptions, SlotName, SlotNodeContent, SlotNodeEvent, SlotNodeEventName, SlotPosition, SlotProvider, SlotRenderContext, SortDirection, ViewportData, ViewportState, VirtualItem, } from "./types";
12
- export { getColumnGroups, flattenColumns, isColumnGroup, isColumnLeaf } from "./columns";
11
+ export type { BlockConfig, CellAlign, CellRenderParams, CellClassRules, CheckboxControl, CheckboxRenderParams, ColumnClassRules, ColumnDef, ColumnGroupDef, ColumnGroupViewport, ColumnLeafDef, ColumnStyle, ColumnStyleParams, DataProcessor, DomPoolBindings, DomPoolUpdate, GridApi, GridEvents, GridOptions, GridPlugin, GridState, HeaderClassRules, HeaderGroupClassRules, HeaderGroupRenderParams, HeaderRenderParams, HeaderStyle, OverlayComponent, OverlayComponentProps, PooledRow, Range, RowClassRules, RowClickEvent, RowHost, RowHoverEvent, RowId, RowRenderParams, RowStyle, ScrollPosition, SlotComponentContent, SlotContent, SlotHtmlContent, SlotMount, SlotMountOptions, SlotName, SlotNodeContent, SlotNodeEvent, SlotNodeEventName, SlotPosition, SlotProvider, SlotRenderContext, SortDirection, ViewportData, ViewportState, VirtualItem, } from "./types";
12
+ export { getColumnGroups, flattenColumns, isColumnGroup, isColumnLeaf, getCellValue } from "./columns";
13
13
  export { Virtualizer } from "./virtualizer";
package/dist/index.js CHANGED
@@ -6,5 +6,5 @@ export { Grid } from "./grid";
6
6
  export { Grid as GridCore } from "./grid";
7
7
  export { SlotManager } from "./slots";
8
8
  export { Store } from "./store";
9
- export { getColumnGroups, flattenColumns, isColumnGroup, isColumnLeaf } from "./columns";
9
+ export { getColumnGroups, flattenColumns, isColumnGroup, isColumnLeaf, getCellValue } from "./columns";
10
10
  export { Virtualizer } from "./virtualizer";
package/dist/types.d.ts CHANGED
@@ -39,6 +39,84 @@ export interface CellRenderParams<T> {
39
39
  value?: unknown;
40
40
  }
41
41
  export type CellClassRules<T> = Record<string, (params: CellRenderParams<T>) => boolean>;
42
+ /**
43
+ * Inline styles applied to all cells in a column.
44
+ *
45
+ * @api
46
+ */
47
+ export interface ColumnStyle {
48
+ [property: string]: string | number | undefined;
49
+ }
50
+ /**
51
+ * Context passed to column-level presentation callbacks (`getColumnStyle`,
52
+ * `getColumnClass`, `columnClassRules`).
53
+ *
54
+ * Evaluated once per column across the dataset rather than per individual cell.
55
+ *
56
+ * @api
57
+ */
58
+ export interface ColumnStyleParams<T> {
59
+ /** The leaf column definition being evaluated. */
60
+ column: ColumnLeafDef<T>;
61
+ /** All visible/filtered values for this column. */
62
+ values: any[];
63
+ /** The grid API instance. */
64
+ api: GridApi<T>;
65
+ /** Current grid state. */
66
+ state: GridState<T>;
67
+ }
68
+ /**
69
+ * Dynamic rules for assigning CSS classes to a column as a whole.
70
+ *
71
+ * @api
72
+ */
73
+ export type ColumnClassRules<T> = Record<string, (params: ColumnStyleParams<T>) => boolean>;
74
+ /**
75
+ * Context passed to leaf header presentation callbacks.
76
+ *
77
+ * @api
78
+ */
79
+ export interface HeaderRenderParams<T> {
80
+ /** The leaf column definition being rendered. */
81
+ column: ColumnLeafDef<T>;
82
+ /** Zero-based index of the leaf column in the visible layout. */
83
+ index?: number;
84
+ }
85
+ /**
86
+ * Inline styles applied to a column or group header.
87
+ *
88
+ * @api
89
+ */
90
+ export interface HeaderStyle {
91
+ [property: string]: string | number | undefined;
92
+ }
93
+ /**
94
+ * Dynamic rules for assigning CSS classes to a leaf column header.
95
+ *
96
+ * @api
97
+ */
98
+ export type HeaderClassRules<T> = Record<string, (params: HeaderRenderParams<T>) => boolean>;
99
+ /**
100
+ * Context passed to column group header presentation callbacks.
101
+ *
102
+ * @api
103
+ */
104
+ export interface HeaderGroupRenderParams<T> {
105
+ /** The column group definition being rendered. */
106
+ group: ColumnGroupDef<T>;
107
+ /** Alias for `group` providing uniform access to the column definition. */
108
+ column: ColumnGroupDef<T>;
109
+ /** Depth of the group in the stacked header hierarchy (0 = topmost). */
110
+ depth?: number;
111
+ /** Number of leaf columns spanned by this group segment. */
112
+ columnCount?: number;
113
+ }
114
+ /**
115
+ * Dynamic rules for assigning CSS classes to a column group header.
116
+ *
117
+ * @api
118
+ */
119
+ export type HeaderGroupClassRules<T> = Record<string, (params: HeaderGroupRenderParams<T>) => boolean>;
42
120
  export interface CheckboxRenderParams {
43
121
  checked: boolean;
44
122
  indeterminate: boolean;
@@ -107,6 +185,22 @@ export interface ColumnLeafDef<T> extends BaseColumnDef<T> {
107
185
  getCellClass?: (params: CellRenderParams<T>) => string | undefined;
108
186
  /** Maps CSS class names to predicates evaluated for each rendered cell. */
109
187
  cellClassRules?: CellClassRules<T>;
188
+ /** Computes inline styles for the entire column body once per column evaluation across dataset. */
189
+ getColumnStyle?: (params: ColumnStyleParams<T>) => ColumnStyle | undefined;
190
+ /** Computes a CSS class for the entire column body across dataset. */
191
+ getColumnClass?: (params: ColumnStyleParams<T>) => string | undefined;
192
+ /** Maps CSS class names to predicates evaluated once for the entire column body across dataset. */
193
+ columnClassRules?: ColumnClassRules<T>;
194
+ /** Static inline styles applied to the leaf header cell of this column. */
195
+ headerStyle?: HeaderStyle;
196
+ /** Computes inline styles for the leaf header cell of this column. */
197
+ getHeaderStyle?: (params: HeaderRenderParams<T>) => HeaderStyle | undefined;
198
+ /** Static CSS class or resolver applied to the leaf header cell of this column. */
199
+ headerClass?: string | ((params: HeaderRenderParams<T>) => string | undefined);
200
+ /** Computes a CSS class for the leaf header cell of this column. */
201
+ getHeaderClass?: (params: HeaderRenderParams<T>) => string | undefined;
202
+ /** Maps CSS class names to predicates evaluated for the leaf header cell of this column. */
203
+ headerClassRules?: HeaderClassRules<T>;
110
204
  }
111
205
  export interface ColumnGroupDef<T> extends BaseColumnDef<T> {
112
206
  /** Child column definitions nested under this group. */
@@ -115,6 +209,16 @@ export interface ColumnGroupDef<T> extends BaseColumnDef<T> {
115
209
  collapsible?: boolean;
116
210
  /** Whether this group starts expanded when it is collapsible. */
117
211
  defaultExpanded?: boolean;
212
+ /** Static inline styles applied to this group header cell. */
213
+ headerStyle?: HeaderStyle;
214
+ /** Computes inline styles for this group header cell. */
215
+ getHeaderStyle?: (params: HeaderGroupRenderParams<T>) => HeaderStyle | undefined;
216
+ /** Static CSS class or resolver applied to this group header cell. */
217
+ headerClass?: string | ((params: HeaderGroupRenderParams<T>) => string | undefined);
218
+ /** Computes a CSS class for this group header cell. */
219
+ getHeaderClass?: (params: HeaderGroupRenderParams<T>) => string | undefined;
220
+ /** Maps CSS class names to predicates evaluated for this group header cell. */
221
+ headerClassRules?: HeaderGroupClassRules<T>;
118
222
  }
119
223
  /** Leaf or grouped column definition accepted by the grid. */
120
224
  export type ColumnDef<T> = ColumnLeafDef<T> | ColumnGroupDef<T>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnigrid/core",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "description": "Framework-agnostic core engine for OmniGrid",
5
5
  "keywords": [
6
6
  "omnigrid",