@linzjs/step-ag-grid 7.11.8 → 7.11.10

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/index.js CHANGED
@@ -1448,8 +1448,8 @@ var ControlledMenuFr = function (_a, externalRef) {
1448
1448
  if (activeElement !== firstInputEl && activeElement !== lastInputEl)
1449
1449
  return;
1450
1450
  var isTextArea = activeElement.nodeName === "TEXTAREA";
1451
- var suppressEnterAutoSave = activeElement.getAttribute("data-disableenterautosave") || isTextArea;
1452
- var allowTabToSave = activeElement.getAttribute("data-allowtabtosave");
1451
+ var suppressEnterAutoSave = activeElement.getAttribute("data-disableenterautosave") == "true" || isTextArea;
1452
+ var allowTabToSave = activeElement.getAttribute("data-allowtabtosave") == "true";
1453
1453
  var invokeSave = function (reason) {
1454
1454
  var _a, _b;
1455
1455
  if (!(saveButtonRef === null || saveButtonRef === void 0 ? void 0 : saveButtonRef.current))
@@ -2081,68 +2081,68 @@ var GridContextProvider = function (props) {
2081
2081
  var _b = React.useState(false), gridReady = _b[0], setGridReady = _b[1];
2082
2082
  var idsBeforeUpdate = React.useRef([]);
2083
2083
  var externallySelectedItemsAreInSync = React.useRef(false);
2084
- var setGridApi = function (gridApi) {
2084
+ var setGridApi = React.useCallback(function (gridApi) {
2085
2085
  _setGridApi(gridApi);
2086
2086
  setGridReady(!!gridApi);
2087
- };
2087
+ }, []);
2088
2088
  /**
2089
2089
  * Wraps things that require gridApi in common handling, for when gridApi not present.
2090
2090
  *
2091
2091
  * @param hasApiFn Execute when api is ready.
2092
2092
  * @param noApiFn Execute if api is not ready.
2093
2093
  */
2094
- var gridApiOp = function (hasApiFn, noApiFn) {
2094
+ var gridApiOp = React.useCallback(function (hasApiFn, noApiFn) {
2095
2095
  if (!noApiFn) {
2096
2096
  noApiFn = (function () { });
2097
2097
  }
2098
2098
  return gridApi ? hasApiFn(gridApi) : noApiFn();
2099
- };
2099
+ }, [gridApi]);
2100
2100
  /**
2101
2101
  * Set the quick filter value to grid.
2102
2102
  */
2103
- var setQuickFilter = function (quickFilter) {
2103
+ var setQuickFilter = React.useCallback(function (quickFilter) {
2104
2104
  gridApiOp(function (gridApi) { return gridApi.setQuickFilter(quickFilter); });
2105
- };
2105
+ }, [gridApiOp]);
2106
2106
  /**
2107
2107
  * Get all row id's in grid.
2108
2108
  */
2109
- var _getAllRowIds = function () {
2109
+ var _getAllRowIds = React.useCallback(function () {
2110
2110
  var result = [];
2111
2111
  return gridApiOp(function (gridApi) {
2112
2112
  gridApi.forEachNode(function (node) { return result.push(node.data.id); });
2113
2113
  return result;
2114
2114
  }, function () { return result; });
2115
- };
2115
+ }, [gridApiOp]);
2116
2116
  /**
2117
2117
  * Record all row id's before update so that we can select/flash the new rows after update.
2118
2118
  */
2119
- var beforeUpdate = function () {
2119
+ var beforeUpdate = React.useCallback(function () {
2120
2120
  idsBeforeUpdate.current = _getAllRowIds();
2121
- };
2121
+ }, [_getAllRowIds]);
2122
2122
  /**
2123
2123
  * Find new row ids
2124
2124
  * Uses beforeUpdate ids to find new nodes.
2125
2125
  */
2126
- var _getNewNodes = function () {
2126
+ var _getNewNodes = React.useCallback(function () {
2127
2127
  return gridApiOp(function (gridApi) {
2128
2128
  return lodashEs.difference(_getAllRowIds(), idsBeforeUpdate.current)
2129
2129
  .map(function (rowId) { return gridApi.getRowNode("" + rowId); }) //
2130
2130
  .filter(function (r) { return r; });
2131
2131
  }, function () { return []; });
2132
- };
2132
+ }, [_getAllRowIds, gridApiOp]);
2133
2133
  /**
2134
2134
  * Get grid nodes via rowIds. If rowIds has no matching node the result may be smaller than expected.
2135
2135
  * This can happen if the grid has not re-rendered yet.
2136
2136
  *
2137
2137
  * @param rowIds Row ids to get from grid.
2138
2138
  */
2139
- var _rowIdsToNodes = function (rowIds) {
2139
+ var _rowIdsToNodes = React.useCallback(function (rowIds) {
2140
2140
  return gridApiOp(function (gridApi) {
2141
2141
  return rowIds
2142
2142
  .map(function (rowId) { return gridApi.getRowNode("" + rowId); }) //
2143
2143
  .filter(function (r) { return r; });
2144
2144
  }, function () { return []; });
2145
- };
2145
+ }, [gridApiOp]);
2146
2146
  /**
2147
2147
  * Internal method for selecting and flashing rows.
2148
2148
  *
@@ -2151,7 +2151,7 @@ var GridContextProvider = function (props) {
2151
2151
  * @param flash Whether to flash rows
2152
2152
  * @param retryCount Table updates may not be present when this is called, so retry is needed.
2153
2153
  */
2154
- var _selectRowsWithOptionalFlash = function (rowIds, select, flash, retryCount) {
2154
+ var _selectRowsWithOptionalFlash = React.useCallback(function (rowIds, select, flash, retryCount) {
2155
2155
  if (retryCount === void 0) { retryCount = 15; }
2156
2156
  return gridApiOp(function (gridApi) {
2157
2157
  var _a;
@@ -2176,7 +2176,8 @@ var GridContextProvider = function (props) {
2176
2176
  var colId_1 = col.colId;
2177
2177
  // We need to make sure we aren't currently editing a cell otherwise tests will fail
2178
2178
  // as they will start to edit the cell before this stuff has a chance to run
2179
- colId_1 != null && lodashEs.defer(function () { return lodashEs.isEmpty(gridApi.getEditingCells()) && gridApi.setFocusedCell(rowIndex_1, colId_1); });
2179
+ colId_1 != null &&
2180
+ lodashEs.defer(function () { return lodashEs.isEmpty(gridApi.getEditingCells()) && gridApi.setFocusedCell(rowIndex_1, colId_1); });
2180
2181
  }
2181
2182
  }
2182
2183
  }
@@ -2201,11 +2202,11 @@ var GridContextProvider = function (props) {
2201
2202
  }, 250);
2202
2203
  }
2203
2204
  });
2204
- };
2205
- var selectRowsById = function (rowIds) { return _selectRowsWithOptionalFlash(rowIds, true, false); };
2206
- var selectRowsByIdWithFlash = function (rowIds) { return _selectRowsWithOptionalFlash(rowIds, true, true); };
2207
- var flashRows = function (rowIds) { return _selectRowsWithOptionalFlash(rowIds, false, true); };
2208
- var selectRowsDiff = function (fn) { return __awaiter(void 0, void 0, void 0, function () {
2205
+ }, [_getNewNodes, _rowIdsToNodes, gridApiOp]);
2206
+ var selectRowsById = React.useCallback(function (rowIds) { return _selectRowsWithOptionalFlash(rowIds, true, false); }, [_selectRowsWithOptionalFlash]);
2207
+ var selectRowsByIdWithFlash = React.useCallback(function (rowIds) { return _selectRowsWithOptionalFlash(rowIds, true, true); }, [_selectRowsWithOptionalFlash]);
2208
+ var flashRows = React.useCallback(function (rowIds) { return _selectRowsWithOptionalFlash(rowIds, false, true); }, [_selectRowsWithOptionalFlash]);
2209
+ var selectRowsDiff = React.useCallback(function (fn) { return __awaiter(void 0, void 0, void 0, function () {
2209
2210
  return __generator(this, function (_a) {
2210
2211
  switch (_a.label) {
2211
2212
  case 0:
@@ -2217,8 +2218,8 @@ var GridContextProvider = function (props) {
2217
2218
  return [2 /*return*/];
2218
2219
  }
2219
2220
  });
2220
- }); };
2221
- var selectRowsWithFlashDiff = function (fn) { return __awaiter(void 0, void 0, void 0, function () {
2221
+ }); }, [_selectRowsWithOptionalFlash, beforeUpdate]);
2222
+ var selectRowsWithFlashDiff = React.useCallback(function (fn) { return __awaiter(void 0, void 0, void 0, function () {
2222
2223
  return __generator(this, function (_a) {
2223
2224
  switch (_a.label) {
2224
2225
  case 0:
@@ -2230,8 +2231,8 @@ var GridContextProvider = function (props) {
2230
2231
  return [2 /*return*/];
2231
2232
  }
2232
2233
  });
2233
- }); };
2234
- var flashRowsDiff = function (fn) { return __awaiter(void 0, void 0, void 0, function () {
2234
+ }); }, [_selectRowsWithOptionalFlash, beforeUpdate]);
2235
+ var flashRowsDiff = React.useCallback(function (fn) { return __awaiter(void 0, void 0, void 0, function () {
2235
2236
  return __generator(this, function (_a) {
2236
2237
  switch (_a.label) {
2237
2238
  case 0:
@@ -2243,15 +2244,15 @@ var GridContextProvider = function (props) {
2243
2244
  return [2 /*return*/];
2244
2245
  }
2245
2246
  });
2246
- }); };
2247
- var getSelectedRows = function () {
2247
+ }); }, [_selectRowsWithOptionalFlash, beforeUpdate]);
2248
+ var getSelectedRows = React.useCallback(function () {
2248
2249
  return gridApiOp(function (gridApi) { return gridApi.getSelectedRows(); }, function () { return []; });
2249
- };
2250
- var getSelectedRowIds = function () { return getSelectedRows().map(function (row) { return row.id; }); };
2251
- var editingCells = function () {
2250
+ }, [gridApiOp]);
2251
+ var getSelectedRowIds = React.useCallback(function () { return getSelectedRows().map(function (row) { return row.id; }); }, [getSelectedRows]);
2252
+ var editingCells = React.useCallback(function () {
2252
2253
  return gridApiOp(function (gridApi) { return isNotEmpty(gridApi.getEditingCells()); }, function () { return false; });
2253
- };
2254
- var ensureRowVisible = function (id) {
2254
+ }, [gridApiOp]);
2255
+ var ensureRowVisible = React.useCallback(function (id) {
2255
2256
  return gridApiOp(function (gridApi) {
2256
2257
  var node = gridApi.getRowNode("".concat(id));
2257
2258
  if (!node)
@@ -2259,29 +2260,38 @@ var GridContextProvider = function (props) {
2259
2260
  gridApi.ensureNodeVisible(node);
2260
2261
  return true;
2261
2262
  });
2262
- };
2263
+ }, [gridApiOp]);
2263
2264
  /**
2264
2265
  * Scroll last selected row into view on grid sort change
2265
2266
  */
2266
- var ensureSelectedRowIsVisible = function () {
2267
+ var ensureSelectedRowIsVisible = React.useCallback(function () {
2267
2268
  gridApiOp(function (gridApi) {
2268
2269
  var selectedNodes = gridApi.getSelectedNodes();
2269
2270
  if (lodashEs.isEmpty(selectedNodes))
2270
2271
  return;
2271
2272
  gridApi.ensureNodeVisible(lodashEs.last(selectedNodes));
2272
2273
  });
2273
- };
2274
+ }, [gridApiOp]);
2274
2275
  /**
2275
2276
  * Resize columns to fit container
2276
2277
  */
2277
- var sizeColumnsToFit = function () {
2278
+ var sizeColumnsToFit = React.useCallback(function () {
2278
2279
  gridApiOp(function (gridApi) {
2279
2280
  // Hide size columns to fit errors in tests
2280
2281
  document.body.clientWidth && gridApi.sizeColumnsToFit();
2281
2282
  });
2282
- };
2283
- var stopEditing = function () { return gridApiOp(function (gridApi) { return gridApi.stopEditing(); }); };
2284
- var updatingCells = function (props, fnUpdate, setSaving, tabDirection) { return __awaiter(void 0, void 0, void 0, function () {
2283
+ }, [gridApiOp]);
2284
+ var stopEditing = React.useCallback(function () { return gridApiOp(function (gridApi) { return gridApi.stopEditing(); }); }, [gridApiOp]);
2285
+ var selectNextCell = React.useCallback(function (tabDirection) {
2286
+ if (tabDirection === void 0) { tabDirection = 0; }
2287
+ gridApiOp(function (gridApi) {
2288
+ if (tabDirection == 1)
2289
+ gridApi.tabToNextCell();
2290
+ if (tabDirection == -1)
2291
+ gridApi.tabToPreviousCell();
2292
+ });
2293
+ }, [gridApiOp]);
2294
+ var updatingCells = React.useCallback(function (props, fnUpdate, setSaving, tabDirection) { return __awaiter(void 0, void 0, void 0, function () {
2285
2295
  return __generator(this, function (_a) {
2286
2296
  switch (_a.label) {
2287
2297
  case 0:
@@ -2342,25 +2352,16 @@ var GridContextProvider = function (props) {
2342
2352
  case 1: return [2 /*return*/, _a.sent()];
2343
2353
  }
2344
2354
  });
2345
- }); };
2346
- var redrawRows = function (rowNodes) {
2355
+ }); }, [gridApiOp, modifyUpdating, selectNextCell]);
2356
+ var redrawRows = React.useCallback(function (rowNodes) {
2347
2357
  gridApiOp(function (gridApi) {
2348
2358
  gridApi.redrawRows(rowNodes ? { rowNodes: rowNodes } : undefined);
2349
2359
  });
2350
- };
2351
- var selectNextCell = function (tabDirection) {
2352
- if (tabDirection === void 0) { tabDirection = 0; }
2353
- gridApiOp(function (gridApi) {
2354
- if (tabDirection == 1)
2355
- gridApi.tabToNextCell();
2356
- if (tabDirection == -1)
2357
- gridApi.tabToPreviousCell();
2358
- });
2359
- };
2360
- var setExternallySelectedItemsAreInSync = function (inSync) {
2360
+ }, [gridApiOp]);
2361
+ var setExternallySelectedItemsAreInSync = React.useCallback(function (inSync) {
2361
2362
  externallySelectedItemsAreInSync.current = inSync;
2362
- };
2363
- var waitForExternallySelectedItemsToBeInSync = function () { return __awaiter(void 0, void 0, void 0, function () {
2363
+ }, []);
2364
+ var waitForExternallySelectedItemsToBeInSync = React.useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
2364
2365
  var i;
2365
2366
  return __generator(this, function (_a) {
2366
2367
  switch (_a.label) {
@@ -2379,7 +2380,7 @@ var GridContextProvider = function (props) {
2379
2380
  case 4: return [2 /*return*/];
2380
2381
  }
2381
2382
  });
2382
- }); };
2383
+ }); }, []);
2383
2384
  return (jsxRuntime.jsx(GridContext.Provider, __assign({ value: {
2384
2385
  gridReady: gridReady,
2385
2386
  setGridApi: setGridApi,
@@ -3238,8 +3239,7 @@ var fieldToString = function (field) {
3238
3239
  return typeof field == "symbol" ? field.toString() : "".concat(field);
3239
3240
  };
3240
3241
  var GridFormDropDown = function (props) {
3241
- var stopEditing = React.useContext(GridContext).stopEditing;
3242
- var _a = useGridPopoverContext(), selectedRows = _a.selectedRows, field = _a.field, updateValue = _a.updateValue, data = _a.data;
3242
+ var _a = useGridPopoverContext(), selectedRows = _a.selectedRows, field = _a.field, data = _a.data;
3243
3243
  // Save triggers during async action processing which triggers another selectItem(), this ref blocks that
3244
3244
  var _b = React.useState(""), filter = _b[0], setFilter = _b[1];
3245
3245
  var _c = React.useState([]), filteredValues = _c[0], setFilteredValues = _c[1];
@@ -3248,7 +3248,8 @@ var GridFormDropDown = function (props) {
3248
3248
  var subComponentIsValid = React.useRef(false);
3249
3249
  var subComponentInitialValue = React.useRef(null);
3250
3250
  var _e = React.useState(null), subSelectedValue = _e[0], setSubSelectedValue = _e[1];
3251
- var _f = React.useState(null), selectedSubComponent = _f[0], setSelectedSubComponent = _f[1];
3251
+ // Note: null is assumed to be the filter
3252
+ var _f = React.useState(null), selectedItem = _f[0], setSelectedItem = _f[1];
3252
3253
  var selectItemHandler = React.useCallback(function (value, subComponentValue) { return __awaiter(void 0, void 0, void 0, function () {
3253
3254
  var hasChanged;
3254
3255
  return __generator(this, function (_a) {
@@ -3269,45 +3270,6 @@ var GridFormDropDown = function (props) {
3269
3270
  }
3270
3271
  });
3271
3272
  }); }, [field, props, selectedRows]);
3272
- var clickItemHandler = React.useCallback(function (value, subComponentValue, reason) { return __awaiter(void 0, void 0, void 0, function () {
3273
- return __generator(this, function (_a) {
3274
- if (subComponentValue !== undefined && !subComponentIsValid.current)
3275
- return [2 /*return*/, false];
3276
- return [2 /*return*/, updateValue(function () { return __awaiter(void 0, void 0, void 0, function () {
3277
- return __generator(this, function (_a) {
3278
- switch (_a.label) {
3279
- case 0: return [4 /*yield*/, selectItemHandler(value, subComponentValue)];
3280
- case 1: return [2 /*return*/, _a.sent()];
3281
- }
3282
- });
3283
- }); }, reason === CloseReason.TAB_FORWARD ? 1 : reason === CloseReason.TAB_BACKWARD ? -1 : 0)];
3284
- });
3285
- }); }, [selectItemHandler, updateValue]);
3286
- var selectFilterHandler = React.useCallback(function (value) { return __awaiter(void 0, void 0, void 0, function () {
3287
- return __generator(this, function (_a) {
3288
- switch (_a.label) {
3289
- case 0: return [4 /*yield*/, updateValue(function (selectedRows) { return __awaiter(void 0, void 0, void 0, function () {
3290
- var _a;
3291
- return __generator(this, function (_b) {
3292
- switch (_b.label) {
3293
- case 0:
3294
- _a = props.onSelectFilter;
3295
- if (!_a) return [3 /*break*/, 2];
3296
- return [4 /*yield*/, props.onSelectFilter({ selectedRows: selectedRows, value: value })];
3297
- case 1:
3298
- _a = (_b.sent());
3299
- _b.label = 2;
3300
- case 2:
3301
- return [2 /*return*/, true];
3302
- }
3303
- });
3304
- }); }, 0)];
3305
- case 1:
3306
- _a.sent();
3307
- return [2 /*return*/];
3308
- }
3309
- });
3310
- }); }, [props, updateValue]);
3311
3273
  // Load up options list if it's async function
3312
3274
  React.useEffect(function () {
3313
3275
  var _a;
@@ -3361,7 +3323,7 @@ var GridFormDropDown = function (props) {
3361
3323
  return undefined;
3362
3324
  }
3363
3325
  var str = option.label || "";
3364
- return str.toLowerCase().indexOf(filter.toLowerCase()) === -1 ? option.value : undefined;
3326
+ return str.toLowerCase().indexOf(filter.toLowerCase()) !== -1 ? option : undefined;
3365
3327
  })
3366
3328
  .filter(function (r) { return r !== undefined; }));
3367
3329
  }
@@ -3382,83 +3344,67 @@ var GridFormDropDown = function (props) {
3382
3344
  * Saves are wrapped in updateValue and triggered by blur events
3383
3345
  */
3384
3346
  var save = React.useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
3347
+ var onSelectFilter;
3385
3348
  return __generator(this, function (_a) {
3386
3349
  switch (_a.label) {
3387
3350
  case 0:
3388
3351
  if (!options)
3389
3352
  return [2 /*return*/, true];
3390
- // Handler for sub-selected value
3391
- if (!selectedSubComponent)
3392
- return [2 /*return*/, true];
3393
- if (selectedSubComponent.subComponent && !subComponentIsValid.current)
3394
- return [2 /*return*/, false];
3395
- return [4 /*yield*/, selectItemHandler(selectedSubComponent.value, subSelectedValue)];
3353
+ if (!(selectedItem === null)) return [3 /*break*/, 5];
3354
+ if (!props.onSelectFilter) return [3 /*break*/, 2];
3355
+ onSelectFilter = props.onSelectFilter;
3356
+ return [4 /*yield*/, onSelectFilter({ selectedRows: selectedRows, value: filter })];
3396
3357
  case 1:
3397
3358
  _a.sent();
3398
3359
  return [2 /*return*/, true];
3360
+ case 2:
3361
+ if (!(filteredValues.length === 1)) return [3 /*break*/, 4];
3362
+ if (filteredValues[0].subComponent)
3363
+ return [2 /*return*/, false];
3364
+ return [4 /*yield*/, selectItemHandler(filteredValues[0].value, null)];
3365
+ case 3: return [2 /*return*/, _a.sent()];
3366
+ case 4: return [2 /*return*/, false];
3367
+ case 5:
3368
+ if (selectedItem.subComponent && !subComponentIsValid.current)
3369
+ return [2 /*return*/, false];
3370
+ return [4 /*yield*/, selectItemHandler(selectedItem.value, subSelectedValue)];
3371
+ case 6:
3372
+ _a.sent();
3373
+ return [2 /*return*/, true];
3399
3374
  }
3400
3375
  });
3401
- }); }, [options, selectItemHandler, selectedSubComponent, subSelectedValue]);
3376
+ }); }, [filter, filteredValues, options, props, selectItemHandler, selectedItem, selectedRows, subSelectedValue]);
3402
3377
  var popoverWrapper = useGridPopoverHook({
3403
3378
  className: props.className,
3404
- invalid: function () { return !!(selectedSubComponent && !subComponentIsValid.current); },
3379
+ invalid: function () { return !!(selectedItem && !subComponentIsValid.current); },
3405
3380
  save: save
3406
3381
  }).popoverWrapper;
3407
- var enterKeyPressedRef = React.useRef(false);
3408
- var handleKeyDown = React.useCallback(function (e) {
3409
- if (e.key === "Enter") {
3410
- e.stopPropagation();
3411
- e.preventDefault();
3412
- enterKeyPressedRef.current = true;
3413
- }
3414
- }, []);
3415
- var handleKeyUp = React.useCallback(function (e) { return __awaiter(void 0, void 0, void 0, function () {
3416
- var _a;
3417
- return __generator(this, function (_b) {
3418
- switch (_b.label) {
3419
- case 0:
3420
- if (!options)
3421
- return [2 /*return*/];
3422
- if (!(e.key === "Enter")) return [3 /*break*/, 3];
3423
- e.stopPropagation();
3424
- e.preventDefault();
3425
- if (!enterKeyPressedRef.current)
3426
- return [2 /*return*/];
3427
- _a = props.onSelectFilter;
3428
- if (!_a) return [3 /*break*/, 2];
3429
- return [4 /*yield*/, selectFilterHandler(filter)];
3430
- case 1:
3431
- _a = (_b.sent());
3432
- _b.label = 2;
3433
- case 2:
3434
- stopEditing();
3435
- _b.label = 3;
3436
- case 3: return [2 /*return*/];
3437
- }
3438
- });
3439
- }); }, [filter, options, props.onSelectFilter, selectFilterHandler, stopEditing]);
3440
- return popoverWrapper(jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [props.filtered && (jsxRuntime.jsxs("div", __assign({ className: "GridFormDropDown-filter" }, { children: [jsxRuntime.jsx(FocusableItem, __assign({ className: "filter-item" }, { children: function (_a) {
3382
+ return popoverWrapper(jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [props.filtered && (jsxRuntime.jsxs("div", __assign({ className: "GridFormDropDown-filter" }, { children: [jsxRuntime.jsx(FocusableItem, __assign({ className: "filter-item", onFocus: function () {
3383
+ setSelectedItem(null);
3384
+ setSubSelectedValue(null);
3385
+ subComponentIsValid.current = true;
3386
+ } }, { children: function (_a) {
3441
3387
  var _b;
3442
3388
  var ref = _a.ref;
3443
- return (jsxRuntime.jsxs("div", __assign({ style: { display: "flex", flexDirection: "column", width: "100%" } }, { children: [jsxRuntime.jsx("input", { autoFocus: true, className: "LuiTextInput-input", ref: ref, type: "text", placeholder: (_b = props.filterPlaceholder) !== null && _b !== void 0 ? _b : "Placeholder", "data-testid": "filteredMenu-free-text-input", defaultValue: filter, "data-disableenterautosave": true, "data-allowtabtosave": true, onChange: function (e) { return setFilter(e.target.value); }, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp }), props.filterHelpText && isNotEmpty(filter) && (jsxRuntime.jsx(FormError, { error: null, helpText: props.filterHelpText }))] })));
3444
- } })), jsxRuntime.jsx(MenuDivider, {}, "$$divider_filter")] }))), jsxRuntime.jsx(ComponentLoadingWrapper, __assign({ loading: !options, className: "GridFormDropDown-options" }, { children: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [options && options.length == (filteredValues === null || filteredValues === void 0 ? void 0 : filteredValues.length) && (jsxRuntime.jsx(MenuItem, __assign({ className: "GridPopoverEditDropDown-noOptions" }, { children: "No Options" }), "".concat(fieldToString(field), "-empty"))), options === null || options === void 0 ? void 0 : options.map(function (item, index) {
3389
+ return (jsxRuntime.jsxs("div", __assign({ style: { display: "flex", flexDirection: "column", width: "100%" } }, { children: [jsxRuntime.jsx("input", { className: "LuiTextInput-input", ref: ref, type: "text", placeholder: (_b = props.filterPlaceholder) !== null && _b !== void 0 ? _b : "Placeholder", "data-testid": "filteredMenu-free-text-input", defaultValue: filter, "data-allowtabtosave": true, "data-disableenterautosave": !props.onSelectFilter && !(filteredValues.length === 1 && !filteredValues[0].subComponent), onChange: function (e) { return setFilter(e.target.value); } }), props.filterHelpText && isNotEmpty(filter) && (jsxRuntime.jsx(FormError, { error: null, helpText: props.filterHelpText }))] })));
3390
+ } })), jsxRuntime.jsx(MenuDivider, {}, "$$divider_filter")] }))), jsxRuntime.jsx(ComponentLoadingWrapper, __assign({ loading: !options, className: "GridFormDropDown-options" }, { children: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [options && lodashEs.isEmpty(filteredValues) && (jsxRuntime.jsx(MenuItem, __assign({ className: "GridPopoverEditDropDown-noOptions" }, { children: "No Options" }), "".concat(fieldToString(field), "-empty"))), options === null || options === void 0 ? void 0 : options.map(function (item, index) {
3445
3391
  var _a;
3446
- return item.value === MenuSeparatorString ? (jsxRuntime.jsx(MenuDivider, {}, "$$divider_".concat(index))) : item.value === MenuHeaderString ? (jsxRuntime.jsx(MenuHeader, { children: item.label }, "$$header_".concat(index))) : filteredValues.includes(item.value) ? null : (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs(MenuItem, __assign({ disabled: !!item.disabled, title: item.disabled && typeof item.disabled !== "boolean" ? item.disabled : "", value: item.value, onClick: function (e) {
3392
+ return item.value === MenuSeparatorString ? (jsxRuntime.jsx(MenuDivider, {}, "$$divider_".concat(index))) : item.value === MenuHeaderString ? (jsxRuntime.jsx(MenuHeader, { children: item.label }, "$$header_".concat(index))) : (filteredValues.includes(item) && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs(MenuItem, __assign({ disabled: !!item.disabled, title: item.disabled && typeof item.disabled !== "boolean" ? item.disabled : "", value: item.value, onFocus: function () {
3393
+ setSelectedItem(item);
3447
3394
  if (item.subComponent) {
3448
- // toggle selection
3449
- setSelectedSubComponent(selectedSubComponent === item ? null : item);
3395
+ setSelectedItem(item);
3450
3396
  subComponentIsValid.current = true;
3451
3397
  subComponentInitialValue.current = null;
3452
- e.keepOpen = true;
3453
3398
  }
3454
3399
  else {
3455
- clickItemHandler(item.value, undefined, e.key === "Tab"
3456
- ? e.shiftKey
3457
- ? CloseReason.TAB_BACKWARD
3458
- : CloseReason.TAB_FORWARD
3459
- : CloseReason.CLICK).then();
3400
+ setSubSelectedValue(null);
3401
+ subComponentIsValid.current = true;
3402
+ }
3403
+ }, onClick: function (e) {
3404
+ if (item.subComponent) {
3405
+ e.keepOpen = true;
3460
3406
  }
3461
- } }, { children: [(_a = item.label) !== null && _a !== void 0 ? _a : (item.value == null ? "<".concat(item.value, ">") : "".concat(item.value)), item.subComponent ? "..." : ""] }), "".concat(fieldToString(field), "-").concat(index)), item.subComponent && selectedSubComponent === item && (jsxRuntime.jsx(FocusableItem, __assign({ className: "LuiDeprecatedForms" }, { children: function (ref) { return (jsxRuntime.jsx(GridSubComponentContext.Provider, __assign({ value: {
3407
+ } }, { children: [(_a = item.label) !== null && _a !== void 0 ? _a : (item.value == null ? "<".concat(item.value, ">") : "".concat(item.value)), item.subComponent ? "..." : ""] }), "".concat(fieldToString(field), "-").concat(index)), item.subComponent && selectedItem === item && (jsxRuntime.jsx(FocusableItem, __assign({ className: "LuiDeprecatedForms" }, { children: function (ref) { return (jsxRuntime.jsx(GridSubComponentContext.Provider, __assign({ value: {
3462
3408
  context: { options: options },
3463
3409
  data: data,
3464
3410
  value: subSelectedValue,
@@ -3478,7 +3424,7 @@ var GridFormDropDown = function (props) {
3478
3424
  return [2 /*return*/];
3479
3425
  });
3480
3426
  }); }
3481
- } }, { children: item.subComponent && (jsxRuntime.jsx("div", __assign({ className: "subComponent" }, { children: jsxRuntime.jsx(item.subComponent, {}, "".concat(fieldToString(field), "-").concat(index, "_subcomponent_inner")) }))) }))); } }), "".concat(item.label, "_subcomponent")))] }, "menu-wrapper-".concat(index)));
3427
+ } }, { children: item.subComponent && (jsxRuntime.jsx("div", __assign({ className: "subComponent" }, { children: jsxRuntime.jsx(item.subComponent, {}, "".concat(fieldToString(field), "-").concat(index, "_subcomponent_inner")) }))) }))); } }), "".concat(item.label, "_subcomponent")))] }, "menu-wrapper-".concat(index))));
3482
3428
  })] }) }))] }));
3483
3429
  };
3484
3430