@linzjs/step-ag-grid 8.4.2 → 9.0.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.
Files changed (51) hide show
  1. package/README.md +4 -4
  2. package/dist/index.css +3 -0
  3. package/dist/src/components/gridForm/GridFormMultiSelect.d.ts +5 -4
  4. package/dist/src/lui/TextAreaInput.d.ts +1 -0
  5. package/dist/src/lui/TextInputFormatted.d.ts +1 -0
  6. package/dist/src/react-menu3/components/FocusableItem.d.ts +1 -1
  7. package/dist/src/react-menu3/components/MenuItem.d.ts +3 -1
  8. package/dist/src/react-menu3/components/SubMenu.d.ts +1 -1
  9. package/dist/src/react-menu3/utils/withHovering.d.ts +2 -2
  10. package/dist/src/utils/textMatcher.d.ts +1 -1
  11. package/dist/src/utils/textMatcher.test.d.ts +1 -0
  12. package/dist/step-ag-grid.esm.js +502 -735
  13. package/dist/step-ag-grid.esm.js.map +1 -1
  14. package/package.json +42 -42
  15. package/src/components/Grid.tsx +29 -27
  16. package/src/components/gridForm/GridFormDropDown.tsx +12 -14
  17. package/src/components/gridForm/GridFormMultiSelect.tsx +31 -29
  18. package/src/components/gridForm/GridFormPopoverMenu.tsx +18 -22
  19. package/src/components/gridForm/GridFormSubComponentTextArea.tsx +1 -1
  20. package/src/components/gridForm/GridFormSubComponentTextInput.tsx +1 -1
  21. package/src/components/gridForm/GridFormTextArea.tsx +1 -1
  22. package/src/components/gridForm/GridFormTextInput.tsx +1 -1
  23. package/src/lui/TextAreaInput.tsx +3 -1
  24. package/src/lui/TextInputFormatted.tsx +3 -1
  25. package/src/react-menu3/components/ControlledMenu.tsx +19 -6
  26. package/src/react-menu3/components/MenuItem.tsx +1 -1
  27. package/src/react-menu3/utils/withHovering.tsx +3 -3
  28. package/src/stories/grid/GridKeyboardInteractions.stories.tsx +261 -0
  29. package/src/stories/grid/{GridPopoutBearing.stories.tsx → GridPopoverEditBearing.stories.tsx} +4 -4
  30. package/src/stories/grid/{GridPopoutEditDropDown.stories.tsx → GridPopoverEditDropDown.stories.tsx} +10 -2
  31. package/src/stories/grid/{GridPopoutEditMultiSelect.stories.tsx → GridPopoverEditMultiSelect.stories.tsx} +0 -0
  32. package/src/stories/grid/gridFormInteraction/GridFormDropDownInteraction.stories.tsx +137 -0
  33. package/src/stories/grid/gridFormInteraction/GridFormEditBearingCorrectionInteraction.stories.tsx +92 -0
  34. package/src/stories/grid/gridFormInteraction/GridFormEditBearingInteraction.stories.tsx +91 -0
  35. package/src/stories/grid/gridFormInteraction/GridFormMultiSelectInteraction.stories.tsx +153 -0
  36. package/src/stories/grid/gridFormInteraction/GridFormPopoverMenuInteraction.stories.tsx +171 -0
  37. package/src/stories/grid/gridFormInteraction/GridFormTextAreaInteraction.stories.tsx +78 -0
  38. package/src/stories/grid/gridFormInteraction/GridFormTextInputInteraction.stories.tsx +85 -0
  39. package/src/stories/grid/{gridForm → gridFormStatic}/GridFormDropDown.stories.tsx +1 -1
  40. package/src/stories/grid/{gridForm → gridFormStatic}/GridFormEditBearing.stories.tsx +1 -1
  41. package/src/stories/grid/{gridForm → gridFormStatic}/GridFormEditBearingCorrection.stories.tsx +1 -1
  42. package/src/stories/grid/{gridForm → gridFormStatic}/GridFormMessage.stories.tsx +1 -1
  43. package/src/stories/grid/{gridForm → gridFormStatic}/GridFormMultiSelect.stories.tsx +1 -1
  44. package/src/stories/grid/{gridForm → gridFormStatic}/GridFormPopoverMenu.stories.tsx +1 -1
  45. package/src/stories/grid/{gridForm → gridFormStatic}/GridFormTextArea.stories.tsx +1 -1
  46. package/src/stories/grid/{gridForm → gridFormStatic}/GridFormTextInput.stories.tsx +1 -1
  47. package/src/stories/react-menu/ReactMenu.stories.tsx +66 -3
  48. package/src/styles/Grid.scss +3 -0
  49. package/src/utils/testUtil.ts +1 -0
  50. package/src/utils/textMatcher.test.ts +38 -0
  51. package/src/utils/textMatcher.ts +9 -2
@@ -128,6 +128,7 @@ export const validateMenuOptions = async (
128
128
  export const clickMenuOption = async (menuOptionText: string | RegExp): Promise<void> => {
129
129
  await act(async () => {
130
130
  const menuOption = await findMenuOption(menuOptionText);
131
+ // eslint-disable-next-line testing-library/await-async-utils
131
132
  userEvent.click(menuOption);
132
133
  });
133
134
  };
@@ -0,0 +1,38 @@
1
+ import { textMatch } from "./textMatcher";
2
+
3
+ /**
4
+ * "L" => L*
5
+ * "=L" => L
6
+ * "*L*" => *L*
7
+ * "*L" => *L
8
+ * "A B" => A* and B*
9
+ * "A B, C" => (A* and B*) or C*
10
+ * "!A" => all values must not match A
11
+ * "=!A" => all values must not match exactly A
12
+ * Returns true if there's a text match.
13
+ */
14
+ describe("textMatch", () => {
15
+ test("textMatch", () => {
16
+ const validate = [
17
+ {
18
+ value: "",
19
+ matched: [""],
20
+ unmatched: ["a", "a*", "*a*"],
21
+ },
22
+ {
23
+ value: "two words",
24
+ matched: ["", "*wo", "*or*", "tw", "two", "tw wo", "tw, rr", "=!tw"],
25
+ unmatched: ["ds", "o", "=tw", "tw rr", "!two", "!tw*"],
26
+ },
27
+ ];
28
+
29
+ validate.forEach((v) => {
30
+ for (const filter of v.matched) {
31
+ expect(textMatch(v.value, filter), `Must match text: ${v.value} filter: ${filter}`).toBe(true);
32
+ }
33
+ for (const filter of v.unmatched) {
34
+ expect(textMatch(v.value, filter), `Mustn't match text: ${v.value} filter: ${filter}`).toBe(false);
35
+ }
36
+ });
37
+ });
38
+ });
@@ -5,7 +5,7 @@ import { isMatch } from "matcher";
5
5
  * Text matching with wildcards and multiple matchers.
6
6
  *
7
7
  * "L" => L*
8
- * "L*" => L*
8
+ * "=L" => L
9
9
  * "*L*" => *L*
10
10
  * "*L" => *L
11
11
  * "A B" => A* and B*
@@ -19,8 +19,15 @@ export const textMatch = (text: string | undefined | null, filter: string): bool
19
19
  const superFilters = filter
20
20
  .split(",")
21
21
  .map((sf) => sf.trim())
22
- .filter((sf) => sf);
22
+ .filter((sf) => sf)
23
+ .map((r) =>
24
+ r
25
+ .split(/\s+/)
26
+ .map((f) => (f.startsWith("=") ? f.slice(1) : f + "*"))
27
+ .join(" "),
28
+ );
23
29
  const [negativeFilters, positiveFilters] = partition(superFilters, (superFilters) => superFilters.startsWith("!"));
30
+
24
31
  const values = text.replaceAll(",", " ").trim().split(/\s+/);
25
32
  return (
26
33
  (isEmpty(positiveFilters) || // Not filtered