@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.
@@ -12,14 +12,14 @@ import { IconName } from "@linzjs/lui/dist/components/LuiIcon/LuiIcon";
12
12
  export interface IQueryQuick {
13
13
  testId?: string;
14
14
  tagName?: "button" | "span" | "div" | "input" | "textarea" | any;
15
- textEquals?: string;
16
- textContains?: string;
15
+ text?: string | RegExp;
17
16
  icon?: IconName;
18
17
  ariaLabel?: string;
19
18
  role?: string;
20
19
  classes?: string;
21
20
  child?: IQueryQuick;
22
21
  }
22
+ export declare const getMatcher: (matcherText: string | RegExp) => (e: HTMLElement) => boolean;
23
23
  /**
24
24
  * Query by filter.
25
25
  *
@@ -3,12 +3,13 @@ export declare const queryRow: (rowId: number | string, within?: HTMLElement) =>
3
3
  export declare const selectRow: (rowId: string | number, within?: HTMLElement) => Promise<void>;
4
4
  export declare const deselectRow: (rowId: string | number, within?: HTMLElement) => Promise<void>;
5
5
  export declare const findCell: (rowId: number | string, colId: string, within?: HTMLElement) => Promise<HTMLElement>;
6
+ export declare const cellContains: (rowId: number | string, colId: string, text: string | RegExp, within?: HTMLElement) => Promise<HTMLElement>;
6
7
  export declare const selectCell: (rowId: string | number, colId: string, within?: HTMLElement) => Promise<void>;
7
8
  export declare const editCell: (rowId: number | string, colId: string, within?: HTMLElement) => Promise<void>;
8
- export declare const queryMenuOption: (menuOptionText: string) => Promise<HTMLElement | null>;
9
- export declare const findMenuOption: (menuOptionText: string) => Promise<HTMLElement>;
10
- export declare const clickMenuOption: (menuOptionText: string) => Promise<void>;
11
- export declare const openAndClickMenuOption: (rowId: number | string, colId: string, menuOptionText: string, within?: HTMLElement) => Promise<void>;
9
+ export declare const queryMenuOption: (menuOptionText: string | RegExp) => Promise<HTMLElement | null>;
10
+ export declare const findMenuOption: (menuOptionText: string | RegExp) => Promise<HTMLElement>;
11
+ export declare const clickMenuOption: (menuOptionText: string | RegExp) => Promise<void>;
12
+ export declare const openAndClickMenuOption: (rowId: number | string, colId: string, menuOptionText: string | RegExp, within?: HTMLElement) => Promise<void>;
12
13
  export declare const getMultiSelectOptions: () => Promise<{
13
14
  v: string;
14
15
  c: boolean;
@@ -3344,7 +3344,7 @@ var GridFormDropDown = function (props) {
3344
3344
  return (jsxs("div", __assign({ style: { display: "flex", flexDirection: "column", width: "100%" } }, { children: [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) && (jsx(FormError, { error: null, helpText: props.filterHelpText }))] })));
3345
3345
  } })), jsx(MenuDivider, {}, "$$divider_filter")] }))), jsx(ComponentLoadingWrapper, __assign({ loading: !options, className: "GridFormDropDown-options" }, { children: jsxs(Fragment$1, { children: [options && options.length == (filteredValues === null || filteredValues === void 0 ? void 0 : filteredValues.length) && (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) {
3346
3346
  var _a;
3347
- return item.value === MenuSeparatorString ? (jsx(MenuDivider, {}, "$$divider_".concat(index))) : item.value === MenuHeaderString ? (jsx(MenuHeader, { children: item.label }, "$$header_".concat(index))) : filteredValues.includes(item.value) ? null : (jsxs("div", { children: [jsxs(MenuItem, __assign({ disabled: !!item.disabled, title: item.disabled && typeof item.disabled !== "boolean" ? item.disabled : "", value: item.value, onClick: function (e) {
3347
+ return item.value === MenuSeparatorString ? (jsx(MenuDivider, {}, "$$divider_".concat(index))) : item.value === MenuHeaderString ? (jsx(MenuHeader, { children: item.label }, "$$header_".concat(index))) : filteredValues.includes(item.value) ? null : (jsxs("div", { children: [jsx(MenuItem, __assign({ disabled: !!item.disabled, title: item.disabled && typeof item.disabled !== "boolean" ? item.disabled : "", value: item.value, onClick: function (e) {
3348
3348
  if (item.subComponent) {
3349
3349
  // toggle selection
3350
3350
  setSelectedSubComponent(selectedSubComponent === item ? null : item);
@@ -3359,7 +3359,8 @@ var GridFormDropDown = function (props) {
3359
3359
  : CloseReason.TAB_FORWARD
3360
3360
  : CloseReason.CLICK).then();
3361
3361
  }
3362
- } }, { 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 && (jsx(FocusableItem, __assign({ className: "LuiDeprecatedForms" }, { children: function (ref) { return (jsx(GridSubComponentContext.Provider, __assign({ value: {
3362
+ } }, { children: ((_a = item.label) !== null && _a !== void 0 ? _a : (item.value == null ? "<".concat(item.value, ">") : "".concat(item.value))) +
3363
+ (item.subComponent ? "..." : "") }), "".concat(fieldToString(field), "-").concat(index)), item.subComponent && selectedSubComponent === item && (jsx(FocusableItem, __assign({ className: "LuiDeprecatedForms" }, { children: function (ref) { return (jsx(GridSubComponentContext.Provider, __assign({ value: {
3363
3364
  context: { options: options },
3364
3365
  data: data,
3365
3366
  value: subSelectedValue,
@@ -24235,6 +24236,12 @@ var queryAllBySelector = function (selector, container) {
24235
24236
  return Array.from(container.querySelectorAll(selector));
24236
24237
  };
24237
24238
  var escapeSelectorParam = function (param) { return param.replace(/["\\]/g, "\\$&"); };
24239
+ var getMatcher = function (matcherText) {
24240
+ var textMatcher = typeof matcherText === "string"
24241
+ ? function (text) { return text != null && text.toLowerCase() === matcherText.toLowerCase(); }
24242
+ : function (text) { return text != null && matcherText.test(text); };
24243
+ 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()); };
24244
+ };
24238
24245
  /**
24239
24246
  * Build selector for quick operations.
24240
24247
  *
@@ -24242,7 +24249,6 @@ var escapeSelectorParam = function (param) { return param.replace(/["\\]/g, "\\$
24242
24249
  * @param container Optional container to search in.
24243
24250
  */
24244
24251
  var quickSelector = function (props, container) {
24245
- var _a, _b;
24246
24252
  var selector = "";
24247
24253
  var lastIQueryQuick = props;
24248
24254
  for (var loop = props; loop; loop = loop.child) {
@@ -24259,16 +24265,9 @@ var quickSelector = function (props, container) {
24259
24265
  throw "get/query/findQuick needs at least one defined parameter";
24260
24266
  }
24261
24267
  var els = queryAllBySelector(selector, container);
24262
- var textMatch = (_a = lastIQueryQuick.textEquals) === null || _a === void 0 ? void 0 : _a.toLowerCase();
24263
- if (textMatch != null) {
24264
- els = els.filter(function (el) { return el.innerHTML.toLowerCase() === textMatch || el.innerText.toLowerCase() === textMatch; });
24265
- }
24266
- var textContains = (_b = lastIQueryQuick.textContains) === null || _b === void 0 ? void 0 : _b.toLowerCase();
24267
- if (textContains != null) {
24268
- els = els.filter(function (el) {
24269
- return el.innerHTML.toLowerCase().indexOf(textContains) != -1 ||
24270
- el.innerText.toLowerCase().indexOf(textContains) != -1;
24271
- });
24268
+ if (lastIQueryQuick.text != null) {
24269
+ var matcher = getMatcher(lastIQueryQuick.text);
24270
+ els = els.filter(matcher);
24272
24271
  }
24273
24272
  return { selector: selector, els: els };
24274
24273
  };
@@ -24283,7 +24282,7 @@ var queryQuick = function (filter, container) {
24283
24282
  var _a;
24284
24283
  var _b = quickSelector(filter, container), els = _b.els, selector = _b.selector;
24285
24284
  if (els.length > 1) {
24286
- throw "Found multiple(".concat(els.length, ") elements by selector ").concat(selector);
24285
+ 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"); }));
24287
24286
  }
24288
24287
  return (_a = els[0]) !== null && _a !== void 0 ? _a : null;
24289
24288
  };
@@ -24403,6 +24402,25 @@ var findCell = function (rowId, colId, within) { return __awaiter(void 0, void 0
24403
24402
  }
24404
24403
  });
24405
24404
  }); };
24405
+ var cellContains = function (rowId, colId, text, within) { return __awaiter(void 0, void 0, void 0, function () {
24406
+ return __generator(this, function (_a) {
24407
+ switch (_a.label) {
24408
+ case 0: return [4 /*yield*/, waitForWrapper(function () { return __awaiter(void 0, void 0, void 0, function () {
24409
+ var row;
24410
+ return __generator(this, function (_a) {
24411
+ switch (_a.label) {
24412
+ case 0: return [4 /*yield*/, findRow(rowId, within)];
24413
+ case 1:
24414
+ row = _a.sent();
24415
+ return [4 /*yield*/, findQuick({ tagName: "[col-id='".concat(colId, "']"), text: text }, row)];
24416
+ case 2: return [2 /*return*/, _a.sent()];
24417
+ }
24418
+ });
24419
+ }); })];
24420
+ case 1: return [2 /*return*/, _a.sent()];
24421
+ }
24422
+ });
24423
+ }); };
24406
24424
  var selectCell = function (rowId, colId, within) { return __awaiter(void 0, void 0, void 0, function () {
24407
24425
  return __generator(this, function (_a) {
24408
24426
  switch (_a.label) {
@@ -24452,7 +24470,7 @@ var findOpenMenu = function () { return __awaiter(void 0, void 0, void 0, functi
24452
24470
  return [2 /*return*/, findQuick({ classes: ".szh-menu--state-open" })];
24453
24471
  }); }); };
24454
24472
  var queryMenuOption = function (menuOptionText) { return __awaiter(void 0, void 0, void 0, function () {
24455
- var openMenu, els, result;
24473
+ var openMenu, els, matcher, result;
24456
24474
  return __generator(this, function (_a) {
24457
24475
  switch (_a.label) {
24458
24476
  case 0: return [4 /*yield*/, findOpenMenu()];
@@ -24461,22 +24479,30 @@ var queryMenuOption = function (menuOptionText) { return __awaiter(void 0, void
24461
24479
  return [4 /*yield*/, getQueriesForElement(openMenu).findAllByRole("menuitem")];
24462
24480
  case 2:
24463
24481
  els = _a.sent();
24464
- 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; });
24482
+ matcher = getMatcher(menuOptionText);
24483
+ result = els.find(matcher);
24465
24484
  return [2 /*return*/, result !== null && result !== void 0 ? result : null];
24466
24485
  }
24467
24486
  });
24468
24487
  }); };
24469
24488
  var findMenuOption = function (menuOptionText) { return __awaiter(void 0, void 0, void 0, function () {
24470
- var menuOption;
24471
24489
  return __generator(this, function (_a) {
24472
24490
  switch (_a.label) {
24473
- case 0: return [4 /*yield*/, queryMenuOption(menuOptionText)];
24474
- case 1:
24475
- menuOption = _a.sent();
24476
- if (menuOption == null) {
24477
- throw Error("Unable to find menu option ".concat(menuOptionText));
24478
- }
24479
- return [2 /*return*/, menuOption];
24491
+ case 0: return [4 /*yield*/, waitForWrapper(function () { return __awaiter(void 0, void 0, void 0, function () {
24492
+ var menuOption;
24493
+ return __generator(this, function (_a) {
24494
+ switch (_a.label) {
24495
+ case 0: return [4 /*yield*/, queryMenuOption(menuOptionText)];
24496
+ case 1:
24497
+ menuOption = _a.sent();
24498
+ if (menuOption == null) {
24499
+ throw Error("Unable to find menu option ".concat(menuOptionText));
24500
+ }
24501
+ return [2 /*return*/, menuOption];
24502
+ }
24503
+ });
24504
+ }); })];
24505
+ case 1: return [2 /*return*/, _a.sent()];
24480
24506
  }
24481
24507
  });
24482
24508
  }); };
@@ -24588,7 +24614,7 @@ var closeMenu = function () {
24588
24614
  userEvent.click(document.body);
24589
24615
  };
24590
24616
  var findActionButton = function (text, container) {
24591
- return findQuick({ tagName: "button", child: { classes: ".ActionButton-minimalAreaDisplay", textEquals: text } }, container);
24617
+ return findQuick({ tagName: "button", child: { classes: ".ActionButton-minimalAreaDisplay", text: text } }, container);
24592
24618
  };
24593
24619
  var clickActionButton = function (text, container) { return __awaiter(void 0, void 0, void 0, function () {
24594
24620
  return __generator(this, function (_a) {
@@ -24612,5 +24638,5 @@ var clickActionButton = function (text, container) { return __awaiter(void 0, vo
24612
24638
  });
24613
24639
  }); };
24614
24640
 
24615
- export { ActionButton, ComponentLoadingWrapper, ControlledMenu, FocusableItem, GenericCellEditorComponentWrapper, Grid, GridCell, GridCellMultiSelectClassRules, GridCellRenderer, GridContext, GridContextProvider, GridFormDropDown, GridFormMultiSelect, GridFormPopoverMenu, GridFormSubComponentTextArea, GridFormSubComponentTextInput, GridHeaderSelect, GridIcon, GridLoadableCell, GridPopoutEditMultiSelect, GridPopoverContext, GridPopoverContextProvider, GridPopoverEditBearing, GridPopoverEditBearingCorrection, GridPopoverEditDropDown, GridPopoverMenu, GridPopoverMessage, GridPopoverTextArea, GridPopoverTextInput, GridRenderPopoutMenuCell, GridRendererGenericCell, GridSubComponentContext, GridUpdatingContext, GridUpdatingContextProvider, Menu, MenuButton, MenuDivider, MenuGroup, MenuHeader, MenuHeaderItem, MenuHeaderString, MenuItem, MenuRadioGroup, MenuSeparator, MenuSeparatorString, PopoutMenuSeparator, SubMenu, TextAreaInput, TextInputFormatted, bearingCorrectionValueFormatter, bearingNumberParser, bearingStringValidator, bearingValueFormatter, clickActionButton, clickMenuOption, clickMultiSelectOption, closeMenu, convertDDToDMS, deselectRow, editCell, findActionButton, findCell, findMenuOption, findMultiSelectOption, findRow, getMultiSelectOptions, hasParentClass, isFloat, isNotEmpty, openAndClickMenuOption, queryMenuOption, queryRow, selectCell, selectRow, stringByteLengthIsInvalid, typeOtherInput, typeOtherTextArea, useGridPopoverContext, useGridPopoverHook, useMenuState, usePostSortRowsHook, wait$2 as wait };
24641
+ export { ActionButton, ComponentLoadingWrapper, ControlledMenu, FocusableItem, GenericCellEditorComponentWrapper, Grid, GridCell, GridCellMultiSelectClassRules, GridCellRenderer, GridContext, GridContextProvider, GridFormDropDown, GridFormMultiSelect, GridFormPopoverMenu, GridFormSubComponentTextArea, GridFormSubComponentTextInput, GridHeaderSelect, GridIcon, GridLoadableCell, GridPopoutEditMultiSelect, GridPopoverContext, GridPopoverContextProvider, GridPopoverEditBearing, GridPopoverEditBearingCorrection, GridPopoverEditDropDown, GridPopoverMenu, GridPopoverMessage, GridPopoverTextArea, GridPopoverTextInput, GridRenderPopoutMenuCell, GridRendererGenericCell, GridSubComponentContext, GridUpdatingContext, GridUpdatingContextProvider, Menu, MenuButton, MenuDivider, MenuGroup, MenuHeader, MenuHeaderItem, MenuHeaderString, MenuItem, MenuRadioGroup, MenuSeparator, MenuSeparatorString, PopoutMenuSeparator, SubMenu, TextAreaInput, TextInputFormatted, bearingCorrectionValueFormatter, bearingNumberParser, bearingStringValidator, bearingValueFormatter, cellContains, clickActionButton, clickMenuOption, clickMultiSelectOption, closeMenu, convertDDToDMS, deselectRow, editCell, findActionButton, findCell, findMenuOption, findMultiSelectOption, findRow, getMultiSelectOptions, hasParentClass, isFloat, isNotEmpty, openAndClickMenuOption, queryMenuOption, queryRow, selectCell, selectRow, stringByteLengthIsInvalid, typeOtherInput, typeOtherTextArea, useGridPopoverContext, useGridPopoverHook, useMenuState, usePostSortRowsHook, wait$2 as wait };
24616
24642
  //# sourceMappingURL=step-ag-grid.esm.js.map