@genesislcap/grid-pro 15.21.1 → 15.22.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.
@@ -95,6 +95,11 @@ import { ICellRendererComp } from '@ag-grid-community/core';
95
95
  import { ICellRendererFunc } from '@ag-grid-community/core';
96
96
  import { ICellRendererParams } from '@ag-grid-community/core';
97
97
  import type { IDatasource } from 'ag-grid-community';
98
+ import type { IDoesFilterPassParams } from 'ag-grid-community';
99
+ import type { IFilterComp } from 'ag-grid-community';
100
+ import type { IFilterParams } from 'ag-grid-community';
101
+ import type { IFloatingFilterComp } from 'ag-grid-community';
102
+ import type { IFloatingFilterParams } from 'ag-grid-community';
98
103
  import type { IGetRowsParams } from 'ag-grid-community';
99
104
  import { ILoadingCellRendererSelectorFunc } from 'ag-grid-community';
100
105
  import { IndexDetail } from '@genesislcap/foundation-comms';
@@ -726,6 +731,15 @@ export declare const convertToKebabCase: (value: string) => string;
726
731
  */
727
732
  export declare function copyAttributesToGridOptions(gridOptions: any, component: Record<string, any>): any;
728
733
 
734
+ /**
735
+ * Builds the value-to-label formatter for an enum filter, honouring `valueFormatter` from the
736
+ * filter params and labelling `null` (blanks) consistently.
737
+ * @remarks Shared by {@link EnumColumnFilter} and the floating filter so both render the same
738
+ * labels from `ColDef.filterParams` alone.
739
+ * @public
740
+ */
741
+ export declare function createEnumValueLabelFormatter(params: (Pick<EnumColumnFilterParams, 'valueFormatter'> & Partial<Pick<EnumColumnFilterValueFormatterParams, 'api' | 'colDef' | 'column' | 'context'>>) | undefined): (value: string | null) => string;
742
+
729
743
  /**
730
744
  * Builds the class rules that flash rows matching `criteria`, together with the context menu
731
745
  * that lets a user recolor, retime, or narrow that flash to a single cell.
@@ -1091,6 +1105,212 @@ export declare class EditableRenderer extends FoundationElement implements ICell
1091
1105
  */
1092
1106
  export declare const EDITED_COLUMN_FIELD = "__editedColumn";
1093
1107
 
1108
+ /**
1109
+ * An Excel AutoFilter-inspired set filter for enum columns, built on AG Grid Community only.
1110
+ * @remarks
1111
+ * Renders a searchable checkbox list of the column's enum options (from `filterParams.values`,
1112
+ * fed by the resource field metadata or a values getter — the option list is defined by the enum,
1113
+ * never scanned from row data) with a tri-state "(Select All)" toggle scoped to the search
1114
+ * results, a `(Blanks)` entry shown by default, human-readable labels, and arrow-key navigation —
1115
+ * applying on every change. Emits the same `{ filterType: 'set', values }` model as the
1116
+ * enterprise `agSetColumnFilter`, so it is a drop-in replacement for filter-model persistence and
1117
+ * the Genesis server-side criteria building — without requiring the enterprise `SetFilterModule`.
1118
+ * @public
1119
+ */
1120
+ export declare class EnumColumnFilter implements IFilterComp {
1121
+ protected params: IFilterParams & EnumColumnFilterParams;
1122
+ private eGui;
1123
+ /** The GUI's shadow root — hosts the content and the shared FAST stylesheet. */
1124
+ private eRoot;
1125
+ private eSearch;
1126
+ private eSelectAll;
1127
+ private eList;
1128
+ /** Rendered value checkboxes keyed by value; `null` keys the blanks entry. */
1129
+ private itemInputs;
1130
+ /** All selectable values, in the order the metadata/getter provided them. */
1131
+ private allValues;
1132
+ /** Whether the `(Blanks)` entry is offered — on unless `filterParams.blanks` is `false`. */
1133
+ private includeBlanks;
1134
+ /** Guards async values resolution against out-of-date responses and use after destroy. */
1135
+ private valuesRequestId;
1136
+ private loading;
1137
+ /** Whether this instance installed the header tooltip getter (so destroy removes only its own). */
1138
+ private ownsHeaderTooltip;
1139
+ private formatLabel;
1140
+ /**
1141
+ * `null` while inactive (everything passes); otherwise the selected values, with `null`
1142
+ * standing for blanks. May contain values absent from `allValues` (e.g. a restored model
1143
+ * referencing rows not loaded yet) — those are preserved and rendered as extra list entries
1144
+ * so restoring a persisted model never silently narrows it, while still letting the user
1145
+ * deselect them.
1146
+ */
1147
+ private model;
1148
+ private searchTerm;
1149
+ init(params: IFilterParams & EnumColumnFilterParams): void;
1150
+ getGui(): HTMLElement;
1151
+ isFilterActive(): boolean;
1152
+ doesFilterPass(params: IDoesFilterPassParams): boolean;
1153
+ getModel(): EnumColumnFilterModel | null;
1154
+ setModel(model: EnumColumnFilterModel | null): void;
1155
+ getModelAsString(model: EnumColumnFilterModel | null): string;
1156
+ /** Clears the filter back to inactive and notifies the grid; used by the floating filter. */
1157
+ clear(): void;
1158
+ /**
1159
+ * Surfaces the active selection in the column's header tooltip (alongside AG's native header
1160
+ * filter icon), so the filter state is inspectable from the header without the layout-changing
1161
+ * floating filter row. Installed as a `headerTooltipValueGetter`, which AG evaluates lazily on
1162
+ * hover — no header refresh needed when the model changes. While inactive it returns
1163
+ * `undefined`, which falls back to the consumer's own `headerTooltip`; when active, that
1164
+ * tooltip is kept as the prefix. A consumer-provided getter is left untouched.
1165
+ */
1166
+ private installHeaderTooltip;
1167
+ afterGuiAttached(params?: {
1168
+ suppressFocus?: boolean;
1169
+ }): void;
1170
+ refresh(params: IFilterParams & EnumColumnFilterParams): boolean;
1171
+ destroy(): void;
1172
+ /** Resolves the option list (values array or getter) and re-renders. */
1173
+ private resolveState;
1174
+ private loadAsyncValues;
1175
+ /** The raw field read covers params without `getValue` (e.g. stripped-down test params). */
1176
+ private getCellValue;
1177
+ /** Model values that are not in the option list, e.g. from a restored persisted model. */
1178
+ private extraModelValues;
1179
+ /**
1180
+ * All offered entry keys: the option list, then any off-list model values (rendered so they can
1181
+ * be deselected rather than being stuck in the model forever), then `null` (blanks) last like
1182
+ * Excel. The blanks entry is also offered whenever the model references it, so a restored
1183
+ * blanks selection stays visible and removable even before blank rows are detected.
1184
+ */
1185
+ private allKeys;
1186
+ private isSelected;
1187
+ private visibleKeys;
1188
+ /**
1189
+ * Applies a new selection. Collapses back to the inactive (`null`) model when every offered
1190
+ * entry is selected, so a fully re-selected filter reports inactive exactly like the
1191
+ * enterprise set filter. Selected values beyond the offered keys don't restrict anything an
1192
+ * inactive filter would pass, so a superset selection collapses too.
1193
+ */
1194
+ private updateSelection;
1195
+ private currentSelection;
1196
+ private toggleValue;
1197
+ /** Select-all acts on the searched subset only, mirroring Excel's AutoFilter. */
1198
+ private toggleAllVisible;
1199
+ private createGui;
1200
+ private createItem;
1201
+ /** Rebuilds the value list; used when the values or the search term change. */
1202
+ private renderList;
1203
+ /** Refreshes checkbox states in place, preserving DOM (and keyboard focus) on toggles. */
1204
+ private syncCheckedStates;
1205
+ private focusables;
1206
+ /**
1207
+ * Arrow keys walk search box, "(Select All)" and the visible entries; Enter toggles the
1208
+ * focused entry (Space is the checkbox's native toggle). Tab wraps within the popup: AG's own
1209
+ * popup focus trap collects focusable elements with `querySelectorAll`, which does not pierce
1210
+ * the shadow root, so the trap must live here.
1211
+ */
1212
+ private handleKeyDown;
1213
+ }
1214
+
1215
+ /**
1216
+ * The filter model produced by {@link EnumColumnFilter}.
1217
+ * @remarks Shape-compatible with AG Grid's `agSetColumnFilter` model — including `null` standing
1218
+ * for blanks — so persisted filter models and the datasource `CRITERIA_MATCH` translation treat
1219
+ * both filters identically.
1220
+ * @public
1221
+ */
1222
+ export declare interface EnumColumnFilterModel {
1223
+ filterType: 'set';
1224
+ values: (string | null)[];
1225
+ }
1226
+
1227
+ /**
1228
+ * Parameters used to configure {@link EnumColumnFilter}.
1229
+ * @remarks Provided via `ColDef.filterParams`. The option list is defined by the enum — the
1230
+ * field metadata's `enumOptions`, a plain array, or a getter — never derived from row data;
1231
+ * omitting `values` logs a warning and offers only the `(Blanks)` entry.
1232
+ * @public
1233
+ */
1234
+ export declare interface EnumColumnFilterParams {
1235
+ /**
1236
+ * The selectable values — typically the `enumOptions` from the field metadata — or a function
1237
+ * resolving them at runtime (see {@link EnumColumnFilterValuesGetter}).
1238
+ */
1239
+ values?: string[] | EnumColumnFilterValuesGetter;
1240
+ /**
1241
+ * Formats a raw value into the label shown in the list, the floating filter, and the filter
1242
+ * summary. Receives `value` plus `api`/`colDef`/`column`/`context`, so an `agSetColumnFilter`
1243
+ * formatter that reads those keeps working when the column is downgraded — but never `node` or
1244
+ * `data`, since these labels are not row-bound. Defaults to capital case (`PENDING_APPROVAL`
1245
+ * becomes `Pending Approval`).
1246
+ */
1247
+ valueFormatter?: (params: EnumColumnFilterValueFormatterParams) => string;
1248
+ /**
1249
+ * Whether to show the `(Blanks)` entry, which matches rows with a `null`/empty cell value.
1250
+ * Shown by default, so a nullable enum column's blank rows are always filterable; set `false`
1251
+ * to hide it (e.g. on a field that can never be blank).
1252
+ */
1253
+ blanks?: boolean;
1254
+ }
1255
+
1256
+ /**
1257
+ * Parameters passed to {@link EnumColumnFilterParams.valueFormatter} — the subset of AG's
1258
+ * `ValueFormatterParams` that is available in every context the formatter runs in (the filter
1259
+ * list, the floating filter summary, and the header tooltip). Row-specific fields (`node`,
1260
+ * `data`) are never provided, since these labels are not tied to a row.
1261
+ * @public
1262
+ */
1263
+ export declare interface EnumColumnFilterValueFormatterParams {
1264
+ value: string;
1265
+ api?: IFilterParams['api'];
1266
+ colDef?: IFilterParams['colDef'];
1267
+ column?: IFilterParams['column'];
1268
+ context?: unknown;
1269
+ }
1270
+
1271
+ /**
1272
+ * Resolves the selectable values at runtime, e.g. from a request-reply resource: return them
1273
+ * (directly or as a promise), or call `params.success` with them, AG set-filter style.
1274
+ * @public
1275
+ */
1276
+ export declare type EnumColumnFilterValuesGetter = (params: EnumColumnFilterValuesGetterParams) => string[] | Promise<string[]> | void;
1277
+
1278
+ /**
1279
+ * Parameters handed to an {@link EnumColumnFilterValuesGetter}.
1280
+ * @public
1281
+ */
1282
+ export declare interface EnumColumnFilterValuesGetterParams {
1283
+ colDef: IFilterParams['colDef'];
1284
+ api: IFilterParams['api'];
1285
+ /**
1286
+ * Resolves the values via callback instead of a return value — the contract of AG Grid's
1287
+ * `SetFilterValuesFunc`, so an `agSetColumnFilter` values function keeps working when the
1288
+ * column is downgraded to this filter.
1289
+ */
1290
+ success: (values: string[]) => void;
1291
+ }
1292
+
1293
+ /**
1294
+ * Floating filter companion for {@link EnumColumnFilter}: shows the current selection as a
1295
+ * compact summary (e.g. `(2) Active, Pending`), opens the parent filter on click, and offers a
1296
+ * one-click clear. Set via `ColDef.floatingFilterComponent` (see
1297
+ * {@link GridProFilterTypes.enumFloatingFilter}); shown when the column enables `floatingFilter`.
1298
+ * @public
1299
+ */
1300
+ export declare class EnumColumnFloatingFilter implements IFloatingFilterComp {
1301
+ private params;
1302
+ private eGui;
1303
+ /** The GUI's shadow root — hosts the content and the shared FAST stylesheet. */
1304
+ private eRoot;
1305
+ private eSummary;
1306
+ private eClear;
1307
+ private formatLabel;
1308
+ init(params: IFloatingFilterParams): void;
1309
+ getGui(): HTMLElement;
1310
+ onParentModelChanged(model: EnumColumnFilterModel | null): void;
1311
+ destroy(): void;
1312
+ }
1313
+
1094
1314
  /**
1095
1315
  * Key used to store error details (column, message) when inline edit fails sync with server side data
1096
1316
  * @public
@@ -1133,6 +1353,12 @@ export declare const foregroundSwatch: SwatchRGB;
1133
1353
  */
1134
1354
  export declare function formatDateExtra(epoch: number): string;
1135
1355
 
1356
+ /**
1357
+ * Renders an enum filter model as a short summary, e.g. `(2) Active, Pending`.
1358
+ * @public
1359
+ */
1360
+ export declare function formatEnumFilterModelAsString(model: EnumColumnFilterModel | null, formatLabel: (value: string | null) => string): string;
1361
+
1136
1362
  /**
1137
1363
  * A function that returns a Foundation Boolean Renderer registration for configuring the component with a DesignSystem.
1138
1364
  *
@@ -3648,6 +3874,20 @@ export declare class GridProBeta extends GridProBeta_base {
3648
3874
  * @internal
3649
3875
  */
3650
3876
  private processSchemaUpdate;
3877
+ /**
3878
+ * Downgrades enterprise filters in metadata-generated colDefs when their modules are not
3879
+ * registered — from v35 AG Grid throws on unregistered filters instead of falling back.
3880
+ * Enum columns (recognised by their metadata-sourced set-filter values) keep those values by
3881
+ * falling back to the community `EnumColumnFilter` instead of a plain text filter.
3882
+ *
3883
+ * The enum floating filter is only wired as the column's component, not enabled: AG's floating
3884
+ * filter is a full-width header row, so enabling it for one column changes the layout of every
3885
+ * column. Active-filter state is surfaced instead by AG's native header filter icon plus the
3886
+ * header tooltip the enum filter maintains; consumers wanting the floating row opt in with
3887
+ * `floatingFilter: true`.
3888
+ * @internal
3889
+ */
3890
+ private applyCommunityFilterFallbacks;
3651
3891
  /**
3652
3892
  * Handles data clearing from datasource
3653
3893
  * @internal
@@ -4118,21 +4358,7 @@ declare const GridProBeta_base: (new (...args: any[]) => {
4118
4358
  removeAttributeNS(namespace: string | null, localName: string): void;
4119
4359
  removeAttributeNode(attr: Attr): Attr;
4120
4360
  requestFullscreen(options?: FullscreenOptions): Promise<void>;
4121
- requestPointerLock(options
4122
- /**
4123
- * Enables or disables the grid status bar.
4124
- * @remarks
4125
- * Default is false.
4126
- * When disabled, no status bar will be displayed regardless of statusBarConfig.
4127
- * This requires AG Grid Enterprise module to be available for the status bar to be displayed when enabled.
4128
- */
4129
- ? /**
4130
- * Enables or disables the grid status bar.
4131
- * @remarks
4132
- * Default is false.
4133
- * When disabled, no status bar will be displayed regardless of statusBarConfig.
4134
- * This requires AG Grid Enterprise module to be available for the status bar to be displayed when enabled.
4135
- */: PointerLockOptions): Promise<void>;
4361
+ requestPointerLock(options?: PointerLockOptions): Promise<void>;
4136
4362
  scroll(options?: ScrollToOptions): void;
4137
4363
  scroll(x: number, y: number): void;
4138
4364
  scrollBy(options?: ScrollToOptions): void;
@@ -4367,12 +4593,7 @@ declare const GridProBeta_base: (new (...args: any[]) => {
4367
4593
  ontouchcancel?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
4368
4594
  ontouchend?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
4369
4595
  ontouchmove?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
4370
- ontouchstart
4371
- /**
4372
- * Handles schema updates from datasource
4373
- * @internal
4374
- */
4375
- ?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
4596
+ ontouchstart?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
4376
4597
  ontransitioncancel: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
4377
4598
  ontransitionend: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
4378
4599
  ontransitionrun: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
@@ -4893,6 +5114,17 @@ export declare type GridProEventsAndCallbacks = OnlyFunctions<UntypeNonFunctions
4893
5114
  */
4894
5115
  export declare type GridProEventsListeners = [string, (event: Event) => void][];
4895
5116
 
5117
+ /**
5118
+ * The available Grid Pro column filter component names.
5119
+ * @remarks Register-able via the grid `components` map; `enumFilter` is usable as a
5120
+ * `ColDef.filter` value and `enumFloatingFilter` as a `ColDef.floatingFilterComponent`.
5121
+ * @public
5122
+ */
5123
+ export declare enum GridProFilterTypes {
5124
+ enumFilter = "enumColumnFilter",
5125
+ enumFloatingFilter = "enumColumnFloatingFilter"
5126
+ }
5127
+
4896
5128
  /**
4897
5129
  * The Genesis Datasource element, for CSRM-compatible data fetching and used exclusively by the GridPro element.
4898
5130
  * @remarks Only supports Client-Side Row Model.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/grid-pro",
3
3
  "description": "Genesis Foundation AG Grid",
4
- "version": "15.21.1",
4
+ "version": "15.22.1",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -40,20 +40,20 @@
40
40
  }
41
41
  },
42
42
  "devDependencies": {
43
- "@genesislcap/foundation-testing": "15.21.1",
44
- "@genesislcap/genx": "15.21.1",
45
- "@genesislcap/rollup-builder": "15.21.1",
46
- "@genesislcap/ts-builder": "15.21.1",
47
- "@genesislcap/uvu-playwright-builder": "15.21.1",
48
- "@genesislcap/vite-builder": "15.21.1",
49
- "@genesislcap/webpack-builder": "15.21.1"
43
+ "@genesislcap/foundation-testing": "15.22.1",
44
+ "@genesislcap/genx": "15.22.1",
45
+ "@genesislcap/rollup-builder": "15.22.1",
46
+ "@genesislcap/ts-builder": "15.22.1",
47
+ "@genesislcap/uvu-playwright-builder": "15.22.1",
48
+ "@genesislcap/vite-builder": "15.22.1",
49
+ "@genesislcap/webpack-builder": "15.22.1"
50
50
  },
51
51
  "dependencies": {
52
- "@genesislcap/foundation-comms": "15.21.1",
53
- "@genesislcap/foundation-criteria": "15.21.1",
54
- "@genesislcap/foundation-logger": "15.21.1",
55
- "@genesislcap/foundation-ui": "15.21.1",
56
- "@genesislcap/foundation-utils": "15.21.1",
52
+ "@genesislcap/foundation-comms": "15.22.1",
53
+ "@genesislcap/foundation-criteria": "15.22.1",
54
+ "@genesislcap/foundation-logger": "15.22.1",
55
+ "@genesislcap/foundation-ui": "15.22.1",
56
+ "@genesislcap/foundation-utils": "15.22.1",
57
57
  "@microsoft/fast-colors": "5.3.1",
58
58
  "@microsoft/fast-components": "2.30.6",
59
59
  "@microsoft/fast-element": "1.14.0",