@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.
- package/README.md +4 -4
- package/dist/index.css +3 -0
- package/dist/src/components/gridForm/GridFormMultiSelect.d.ts +5 -4
- package/dist/src/lui/TextAreaInput.d.ts +1 -0
- package/dist/src/lui/TextInputFormatted.d.ts +1 -0
- package/dist/src/react-menu3/components/FocusableItem.d.ts +1 -1
- package/dist/src/react-menu3/components/MenuItem.d.ts +3 -1
- package/dist/src/react-menu3/components/SubMenu.d.ts +1 -1
- package/dist/src/react-menu3/utils/withHovering.d.ts +2 -2
- package/dist/src/utils/textMatcher.d.ts +1 -1
- package/dist/src/utils/textMatcher.test.d.ts +1 -0
- package/dist/step-ag-grid.esm.js +502 -735
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +42 -42
- package/src/components/Grid.tsx +29 -27
- package/src/components/gridForm/GridFormDropDown.tsx +12 -14
- package/src/components/gridForm/GridFormMultiSelect.tsx +31 -29
- package/src/components/gridForm/GridFormPopoverMenu.tsx +18 -22
- package/src/components/gridForm/GridFormSubComponentTextArea.tsx +1 -1
- package/src/components/gridForm/GridFormSubComponentTextInput.tsx +1 -1
- package/src/components/gridForm/GridFormTextArea.tsx +1 -1
- package/src/components/gridForm/GridFormTextInput.tsx +1 -1
- package/src/lui/TextAreaInput.tsx +3 -1
- package/src/lui/TextInputFormatted.tsx +3 -1
- package/src/react-menu3/components/ControlledMenu.tsx +19 -6
- package/src/react-menu3/components/MenuItem.tsx +1 -1
- package/src/react-menu3/utils/withHovering.tsx +3 -3
- package/src/stories/grid/GridKeyboardInteractions.stories.tsx +261 -0
- package/src/stories/grid/{GridPopoutBearing.stories.tsx → GridPopoverEditBearing.stories.tsx} +4 -4
- package/src/stories/grid/{GridPopoutEditDropDown.stories.tsx → GridPopoverEditDropDown.stories.tsx} +10 -2
- package/src/stories/grid/{GridPopoutEditMultiSelect.stories.tsx → GridPopoverEditMultiSelect.stories.tsx} +0 -0
- package/src/stories/grid/gridFormInteraction/GridFormDropDownInteraction.stories.tsx +137 -0
- package/src/stories/grid/gridFormInteraction/GridFormEditBearingCorrectionInteraction.stories.tsx +92 -0
- package/src/stories/grid/gridFormInteraction/GridFormEditBearingInteraction.stories.tsx +91 -0
- package/src/stories/grid/gridFormInteraction/GridFormMultiSelectInteraction.stories.tsx +153 -0
- package/src/stories/grid/gridFormInteraction/GridFormPopoverMenuInteraction.stories.tsx +171 -0
- package/src/stories/grid/gridFormInteraction/GridFormTextAreaInteraction.stories.tsx +78 -0
- package/src/stories/grid/gridFormInteraction/GridFormTextInputInteraction.stories.tsx +85 -0
- package/src/stories/grid/{gridForm → gridFormStatic}/GridFormDropDown.stories.tsx +1 -1
- package/src/stories/grid/{gridForm → gridFormStatic}/GridFormEditBearing.stories.tsx +1 -1
- package/src/stories/grid/{gridForm → gridFormStatic}/GridFormEditBearingCorrection.stories.tsx +1 -1
- package/src/stories/grid/{gridForm → gridFormStatic}/GridFormMessage.stories.tsx +1 -1
- package/src/stories/grid/{gridForm → gridFormStatic}/GridFormMultiSelect.stories.tsx +1 -1
- package/src/stories/grid/{gridForm → gridFormStatic}/GridFormPopoverMenu.stories.tsx +1 -1
- package/src/stories/grid/{gridForm → gridFormStatic}/GridFormTextArea.stories.tsx +1 -1
- package/src/stories/grid/{gridForm → gridFormStatic}/GridFormTextInput.stories.tsx +1 -1
- package/src/stories/react-menu/ReactMenu.stories.tsx +66 -3
- package/src/styles/Grid.scss +3 -0
- package/src/utils/testUtil.ts +1 -0
- package/src/utils/textMatcher.test.ts +38 -0
- package/src/utils/textMatcher.ts +9 -2
package/src/utils/testUtil.ts
CHANGED
|
@@ -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
|
+
});
|
package/src/utils/textMatcher.ts
CHANGED
|
@@ -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
|
|
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
|