@linzjs/step-ag-grid 7.2.0 → 7.3.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.
@@ -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,
@@ -3379,7 +3380,7 @@ var GridFormDropDown = function (props) {
3379
3380
  return [2 /*return*/];
3380
3381
  });
3381
3382
  }); }
3382
- } }, { children: item.subComponent && (jsx(item.subComponent, {}, "".concat(fieldToString(field), "-").concat(index, "_subcomponent_inner"))) }))); } }), "".concat(item.label, "_subcomponent")))] }, "menu-wrapper-".concat(index)));
3383
+ } }, { children: item.subComponent && (jsx("div", __assign({ className: "subComponent" }, { children: jsx(item.subComponent, {}, "".concat(fieldToString(field), "-").concat(index, "_subcomponent_inner")) }))) }))); } }), "".concat(item.label, "_subcomponent")))] }, "menu-wrapper-".concat(index)));
3383
3384
  })] }) }))] }));
3384
3385
  };
3385
3386
 
@@ -3750,7 +3751,7 @@ var MenuSubComponent = function (props) {
3750
3751
  subComponentIsValid["".concat(item.value)] = valid;
3751
3752
  },
3752
3753
  triggerSave: triggerSave
3753
- } }, { children: jsx(item.subComponent, {}) })));
3754
+ } }, { children: jsx("div", __assign({ className: "subComponent" }, { children: jsx(item.subComponent, {}) })) })));
3754
3755
  } }), "".concat(item.value, "_subcomponent")));
3755
3756
  };
3756
3757
 
@@ -3896,7 +3897,7 @@ var GridFormPopoverMenu = function (props) {
3896
3897
  subComponentIsValid.current = valid;
3897
3898
  },
3898
3899
  triggerSave: triggerSave
3899
- } }, { children: jsx(item.subComponent, {}) })));
3900
+ } }, { children: jsx("div", __assign({ className: "subComponent" }, { children: jsx(item.subComponent, {}) })) })));
3900
3901
  } }), "".concat(item.label, "_subcomponent")))] }, "".concat(item.label))));
3901
3902
  }) }) })));
3902
3903
  };
@@ -4318,7 +4319,7 @@ var GridFormSubComponentTextArea = function (props) {
4318
4319
  useEffect(function () {
4319
4320
  setValid(value != null && invalid() == null);
4320
4321
  }, [setValid, invalid, value]);
4321
- return (jsx("div", __assign({ className: clsx("FreeTextInput LuiDeprecatedForms", props.className) }, { children: jsx(TextAreaInput, { className: "free-text-input", value: value, onChange: function (e) { return setValue(e.target.value); }, error: invalid(), helpText: helpText, autoFocus: true, placeholder: props.placeholder }) })));
4322
+ return (jsx("div", __assign({ className: clsx("FreeTextInput", props.className) }, { children: jsx(TextAreaInput, { className: "free-text-input", value: value, onChange: function (e) { return setValue(e.target.value); }, error: invalid(), helpText: helpText, autoFocus: true, placeholder: props.placeholder }) })));
4322
4323
  };
4323
4324
 
4324
4325
  var css_248z = ".ActionButton{align-items:center;display:flex}.ActionButton-minimal{padding-right:38px!important}.ActionButton .LuiIcon{margin:0 4px!important}.ActionButton-minimalArea{position:relative}.ActionButton-minimalAreaDisplay{position:absolute}.ActionButton-minimalAreaExpand{visibility:hidden}.ActionButton-inProgress{background-color:#e2f3f7!important;color:#007198!important;cursor:progress}.ActionButton-inProgress svg *{fill:#0000!important}.ActionButton-fill{justify-content:center;width:100%}";
@@ -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) {
@@ -24435,14 +24453,14 @@ var editCell = function (rowId, colId, within) { return __awaiter(void 0, void 0
24435
24453
  case 1:
24436
24454
  cell = _a.sent();
24437
24455
  userEvent.dblClick(cell);
24438
- return [4 /*yield*/, findOpenMenu()];
24439
- case 2:
24440
- _a.sent();
24441
24456
  return [2 /*return*/];
24442
24457
  }
24443
24458
  });
24444
24459
  }); })];
24445
24460
  case 1:
24461
+ _a.sent();
24462
+ return [4 /*yield*/, findOpenMenu()];
24463
+ case 2:
24446
24464
  _a.sent();
24447
24465
  return [2 /*return*/];
24448
24466
  }
@@ -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
+ }); }, { timeout: 10000 })];
24505
+ case 1: return [2 /*return*/, _a.sent()];
24480
24506
  }
24481
24507
  });
24482
24508
  }); };
@@ -24507,8 +24533,11 @@ var openAndClickMenuOption = function (rowId, colId, menuOptionText, within) { r
24507
24533
  case 0: return [4 /*yield*/, editCell(rowId, colId, within)];
24508
24534
  case 1:
24509
24535
  _a.sent();
24510
- return [4 /*yield*/, clickMenuOption(menuOptionText)];
24536
+ return [4 /*yield*/, wait$2(100)];
24511
24537
  case 2:
24538
+ _a.sent();
24539
+ return [4 /*yield*/, clickMenuOption(menuOptionText)];
24540
+ case 3:
24512
24541
  _a.sent();
24513
24542
  return [2 /*return*/];
24514
24543
  }
@@ -24561,7 +24590,7 @@ var typeOtherInput = function (value) { return __awaiter(void 0, void 0, void 0,
24561
24590
  case 0: return [4 /*yield*/, findOpenMenu()];
24562
24591
  case 1:
24563
24592
  openMenu = _a.sent();
24564
- return [4 /*yield*/, findQuick({ tagName: "input[type='text']" }, openMenu)];
24593
+ return [4 /*yield*/, findQuick({ classes: ".subComponent", child: { tagName: "input[type='text']" } }, openMenu)];
24565
24594
  case 2:
24566
24595
  otherInput = _a.sent();
24567
24596
  userEvent.type(otherInput, value);
@@ -24576,7 +24605,7 @@ var typeOtherTextArea = function (value) { return __awaiter(void 0, void 0, void
24576
24605
  case 0: return [4 /*yield*/, findOpenMenu()];
24577
24606
  case 1:
24578
24607
  openMenu = _a.sent();
24579
- return [4 /*yield*/, findQuick({ tagName: "textarea" }, openMenu)];
24608
+ return [4 /*yield*/, findQuick({ classes: ".subComponent", child: { tagName: "textarea" } }, openMenu)];
24580
24609
  case 2:
24581
24610
  otherTextArea = _a.sent();
24582
24611
  userEvent.type(otherTextArea, value);
@@ -24588,7 +24617,7 @@ var closeMenu = function () {
24588
24617
  userEvent.click(document.body);
24589
24618
  };
24590
24619
  var findActionButton = function (text, container) {
24591
- return findQuick({ tagName: "button", child: { classes: ".ActionButton-minimalAreaDisplay", textEquals: text } }, container);
24620
+ return findQuick({ tagName: "button", child: { classes: ".ActionButton-minimalAreaDisplay", text: text } }, container);
24592
24621
  };
24593
24622
  var clickActionButton = function (text, container) { return __awaiter(void 0, void 0, void 0, function () {
24594
24623
  return __generator(this, function (_a) {
@@ -24612,5 +24641,5 @@ var clickActionButton = function (text, container) { return __awaiter(void 0, vo
24612
24641
  });
24613
24642
  }); };
24614
24643
 
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 };
24644
+ 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
24645
  //# sourceMappingURL=step-ag-grid.esm.js.map