@linzjs/step-ag-grid 7.2.0 → 7.3.0

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
@@ -3365,7 +3365,7 @@ var GridFormDropDown = function (props) {
3365
3365
  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 }))] })));
3366
3366
  } })), 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) {
3367
3367
  var _a;
3368
- 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) {
3368
+ 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.jsx(MenuItem, __assign({ disabled: !!item.disabled, title: item.disabled && typeof item.disabled !== "boolean" ? item.disabled : "", value: item.value, onClick: function (e) {
3369
3369
  if (item.subComponent) {
3370
3370
  // toggle selection
3371
3371
  setSelectedSubComponent(selectedSubComponent === item ? null : item);
@@ -3380,7 +3380,8 @@ var GridFormDropDown = function (props) {
3380
3380
  : CloseReason.TAB_FORWARD
3381
3381
  : CloseReason.CLICK).then();
3382
3382
  }
3383
- } }, { 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: {
3383
+ } }, { children: ((_a = item.label) !== null && _a !== void 0 ? _a : (item.value == null ? "<".concat(item.value, ">") : "".concat(item.value))) +
3384
+ (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: {
3384
3385
  context: { options: options },
3385
3386
  data: data,
3386
3387
  value: subSelectedValue,
@@ -24256,6 +24257,12 @@ var queryAllBySelector = function (selector, container) {
24256
24257
  return Array.from(container.querySelectorAll(selector));
24257
24258
  };
24258
24259
  var escapeSelectorParam = function (param) { return param.replace(/["\\]/g, "\\$&"); };
24260
+ var getMatcher = function (matcherText) {
24261
+ var textMatcher = typeof matcherText === "string"
24262
+ ? function (text) { return text != null && text.toLowerCase() === matcherText.toLowerCase(); }
24263
+ : function (text) { return text != null && matcherText.test(text); };
24264
+ return function (e) { var _a, _b; return textMatcher((_a = e.innerHTML) === null || _a === void 0 ? void 0 : _a.trim()) || textMatcher((_b = e.innerText) === null || _b === void 0 ? void 0 : _b.trim()); };
24265
+ };
24259
24266
  /**
24260
24267
  * Build selector for quick operations.
24261
24268
  *
@@ -24263,7 +24270,6 @@ var escapeSelectorParam = function (param) { return param.replace(/["\\]/g, "\\$
24263
24270
  * @param container Optional container to search in.
24264
24271
  */
24265
24272
  var quickSelector = function (props, container) {
24266
- var _a, _b;
24267
24273
  var selector = "";
24268
24274
  var lastIQueryQuick = props;
24269
24275
  for (var loop = props; loop; loop = loop.child) {
@@ -24280,16 +24286,9 @@ var quickSelector = function (props, container) {
24280
24286
  throw "get/query/findQuick needs at least one defined parameter";
24281
24287
  }
24282
24288
  var els = queryAllBySelector(selector, container);
24283
- var textMatch = (_a = lastIQueryQuick.textEquals) === null || _a === void 0 ? void 0 : _a.toLowerCase();
24284
- if (textMatch != null) {
24285
- els = els.filter(function (el) { return el.innerHTML.toLowerCase() === textMatch || el.innerText.toLowerCase() === textMatch; });
24286
- }
24287
- var textContains = (_b = lastIQueryQuick.textContains) === null || _b === void 0 ? void 0 : _b.toLowerCase();
24288
- if (textContains != null) {
24289
- els = els.filter(function (el) {
24290
- return el.innerHTML.toLowerCase().indexOf(textContains) != -1 ||
24291
- el.innerText.toLowerCase().indexOf(textContains) != -1;
24292
- });
24289
+ if (lastIQueryQuick.text != null) {
24290
+ var matcher = getMatcher(lastIQueryQuick.text);
24291
+ els = els.filter(matcher);
24293
24292
  }
24294
24293
  return { selector: selector, els: els };
24295
24294
  };
@@ -24304,7 +24303,7 @@ var queryQuick = function (filter, container) {
24304
24303
  var _a;
24305
24304
  var _b = quickSelector(filter, container), els = _b.els, selector = _b.selector;
24306
24305
  if (els.length > 1) {
24307
- throw "Found multiple(".concat(els.length, ") elements by selector ").concat(selector);
24306
+ throw "Found multiple(".concat(els.length, ") elements by selector ").concat(selector, "\n").concat(els.map(function (el, index) { var _a; return "".concat(index, ": ").concat((_a = el.parentElement) === null || _a === void 0 ? void 0 : _a.innerHTML, "\n\n"); }));
24308
24307
  }
24309
24308
  return (_a = els[0]) !== null && _a !== void 0 ? _a : null;
24310
24309
  };
@@ -24424,6 +24423,25 @@ var findCell = function (rowId, colId, within) { return __awaiter(void 0, void 0
24424
24423
  }
24425
24424
  });
24426
24425
  }); };
24426
+ var cellContains = function (rowId, colId, text, within) { return __awaiter(void 0, void 0, void 0, function () {
24427
+ return __generator(this, function (_a) {
24428
+ switch (_a.label) {
24429
+ case 0: return [4 /*yield*/, waitForWrapper(function () { return __awaiter(void 0, void 0, void 0, function () {
24430
+ var row;
24431
+ return __generator(this, function (_a) {
24432
+ switch (_a.label) {
24433
+ case 0: return [4 /*yield*/, findRow(rowId, within)];
24434
+ case 1:
24435
+ row = _a.sent();
24436
+ return [4 /*yield*/, findQuick({ tagName: "[col-id='".concat(colId, "']"), text: text }, row)];
24437
+ case 2: return [2 /*return*/, _a.sent()];
24438
+ }
24439
+ });
24440
+ }); })];
24441
+ case 1: return [2 /*return*/, _a.sent()];
24442
+ }
24443
+ });
24444
+ }); };
24427
24445
  var selectCell = function (rowId, colId, within) { return __awaiter(void 0, void 0, void 0, function () {
24428
24446
  return __generator(this, function (_a) {
24429
24447
  switch (_a.label) {
@@ -24473,7 +24491,7 @@ var findOpenMenu = function () { return __awaiter(void 0, void 0, void 0, functi
24473
24491
  return [2 /*return*/, findQuick({ classes: ".szh-menu--state-open" })];
24474
24492
  }); }); };
24475
24493
  var queryMenuOption = function (menuOptionText) { return __awaiter(void 0, void 0, void 0, function () {
24476
- var openMenu, els, result;
24494
+ var openMenu, els, matcher, result;
24477
24495
  return __generator(this, function (_a) {
24478
24496
  switch (_a.label) {
24479
24497
  case 0: return [4 /*yield*/, findOpenMenu()];
@@ -24482,22 +24500,30 @@ var queryMenuOption = function (menuOptionText) { return __awaiter(void 0, void
24482
24500
  return [4 /*yield*/, getQueriesForElement(openMenu).findAllByRole("menuitem")];
24483
24501
  case 2:
24484
24502
  els = _a.sent();
24485
- result = els.find(function (e) { var _a, _b; return ((_a = e.innerHTML) === null || _a === void 0 ? void 0 : _a.trim()) === menuOptionText || ((_b = e.innerText) === null || _b === void 0 ? void 0 : _b.trim()) === menuOptionText; });
24503
+ matcher = getMatcher(menuOptionText);
24504
+ result = els.find(matcher);
24486
24505
  return [2 /*return*/, result !== null && result !== void 0 ? result : null];
24487
24506
  }
24488
24507
  });
24489
24508
  }); };
24490
24509
  var findMenuOption = function (menuOptionText) { return __awaiter(void 0, void 0, void 0, function () {
24491
- var menuOption;
24492
24510
  return __generator(this, function (_a) {
24493
24511
  switch (_a.label) {
24494
- case 0: return [4 /*yield*/, queryMenuOption(menuOptionText)];
24495
- case 1:
24496
- menuOption = _a.sent();
24497
- if (menuOption == null) {
24498
- throw Error("Unable to find menu option ".concat(menuOptionText));
24499
- }
24500
- return [2 /*return*/, menuOption];
24512
+ case 0: return [4 /*yield*/, waitForWrapper(function () { return __awaiter(void 0, void 0, void 0, function () {
24513
+ var menuOption;
24514
+ return __generator(this, function (_a) {
24515
+ switch (_a.label) {
24516
+ case 0: return [4 /*yield*/, queryMenuOption(menuOptionText)];
24517
+ case 1:
24518
+ menuOption = _a.sent();
24519
+ if (menuOption == null) {
24520
+ throw Error("Unable to find menu option ".concat(menuOptionText));
24521
+ }
24522
+ return [2 /*return*/, menuOption];
24523
+ }
24524
+ });
24525
+ }); })];
24526
+ case 1: return [2 /*return*/, _a.sent()];
24501
24527
  }
24502
24528
  });
24503
24529
  }); };
@@ -24609,7 +24635,7 @@ var closeMenu = function () {
24609
24635
  userEvent.click(document.body);
24610
24636
  };
24611
24637
  var findActionButton = function (text, container) {
24612
- return findQuick({ tagName: "button", child: { classes: ".ActionButton-minimalAreaDisplay", textEquals: text } }, container);
24638
+ return findQuick({ tagName: "button", child: { classes: ".ActionButton-minimalAreaDisplay", text: text } }, container);
24613
24639
  };
24614
24640
  var clickActionButton = function (text, container) { return __awaiter(void 0, void 0, void 0, function () {
24615
24641
  return __generator(this, function (_a) {
@@ -24686,6 +24712,7 @@ exports.bearingCorrectionValueFormatter = bearingCorrectionValueFormatter;
24686
24712
  exports.bearingNumberParser = bearingNumberParser;
24687
24713
  exports.bearingStringValidator = bearingStringValidator;
24688
24714
  exports.bearingValueFormatter = bearingValueFormatter;
24715
+ exports.cellContains = cellContains;
24689
24716
  exports.clickActionButton = clickActionButton;
24690
24717
  exports.clickMenuOption = clickMenuOption;
24691
24718
  exports.clickMultiSelectOption = clickMultiSelectOption;