@linzjs/step-ag-grid 20.0.0 → 21.0.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.
Files changed (183) hide show
  1. package/dist/index.css +3 -4
  2. package/dist/src/components/ComponentLoadingWrapper.d.ts +9 -9
  3. package/dist/src/components/Grid.d.ts +80 -80
  4. package/dist/src/components/GridCell.d.ts +63 -27
  5. package/dist/src/components/GridCell.test.d.ts +1 -1
  6. package/dist/src/components/GridCellFiller.d.ts +5 -4
  7. package/dist/src/components/GridCellMultiEditor.d.ts +18 -18
  8. package/dist/src/components/GridCellMultiSelectClassRules.d.ts +2 -2
  9. package/dist/src/components/GridIcon.d.ts +9 -9
  10. package/dist/src/components/GridLoadableCell.d.ts +1 -1
  11. package/dist/src/components/GridNoRowsOverlay.d.ts +9 -9
  12. package/dist/src/components/GridPopoverHook.d.ts +12 -12
  13. package/dist/src/components/GridWrapper.d.ts +5 -5
  14. package/dist/src/components/PostSortRowsHook.d.ts +11 -11
  15. package/dist/src/components/gridFilter/GridFilterButtons.d.ts +16 -16
  16. package/dist/src/components/gridFilter/GridFilterColumnsToggle.d.ts +5 -5
  17. package/dist/src/components/gridFilter/GridFilterDownloadCsvButton.d.ts +2 -2
  18. package/dist/src/components/gridFilter/GridFilterHeaderIconButton.d.ts +11 -11
  19. package/dist/src/components/gridFilter/GridFilterQuick.d.ts +5 -5
  20. package/dist/src/components/gridFilter/GridFilters.d.ts +2 -2
  21. package/dist/src/components/gridFilter/index.d.ts +7 -7
  22. package/dist/src/components/gridFilter/useGridFilter.d.ts +3 -3
  23. package/dist/src/components/gridForm/GridFormDropDown.d.ts +37 -37
  24. package/dist/src/components/gridForm/GridFormEditBearing.d.ts +12 -12
  25. package/dist/src/components/gridForm/GridFormMessage.d.ts +7 -7
  26. package/dist/src/components/gridForm/GridFormMultiSelect.d.ts +36 -36
  27. package/dist/src/components/gridForm/GridFormMultiSelectGrid.d.ts +24 -24
  28. package/dist/src/components/gridForm/GridFormPopoverMenu.d.ts +36 -36
  29. package/dist/src/components/gridForm/GridFormSubComponentTextArea.d.ts +12 -12
  30. package/dist/src/components/gridForm/GridFormSubComponentTextInput.d.ts +11 -11
  31. package/dist/src/components/gridForm/GridFormTextArea.d.ts +14 -14
  32. package/dist/src/components/gridForm/GridFormTextInput.d.ts +14 -14
  33. package/dist/src/components/gridForm/index.d.ts +10 -10
  34. package/dist/src/components/gridHeader/GridHeaderSelect.d.ts +7 -7
  35. package/dist/src/components/gridHeader/index.d.ts +1 -1
  36. package/dist/src/components/gridHook/index.d.ts +1 -1
  37. package/dist/src/components/gridHook/useGridContextMenu.d.ts +19 -19
  38. package/dist/src/components/gridPopoverEdit/GridPopoutEditMultiSelect.d.ts +5 -5
  39. package/dist/src/components/gridPopoverEdit/GridPopoutEditMultiSelectGrid.d.ts +5 -5
  40. package/dist/src/components/gridPopoverEdit/GridPopoverEditBearing.d.ts +16 -16
  41. package/dist/src/components/gridPopoverEdit/GridPopoverEditDropDown.d.ts +5 -5
  42. package/dist/src/components/gridPopoverEdit/GridPopoverMenu.d.ts +8 -8
  43. package/dist/src/components/gridPopoverEdit/GridPopoverMessage.d.ts +5 -5
  44. package/dist/src/components/gridPopoverEdit/GridPopoverTextArea.d.ts +5 -5
  45. package/dist/src/components/gridPopoverEdit/GridPopoverTextInput.d.ts +5 -5
  46. package/dist/src/components/gridPopoverEdit/index.d.ts +9 -9
  47. package/dist/src/components/gridRender/GridRenderGenericCell.d.ts +16 -37
  48. package/dist/src/components/gridRender/GridRenderPopoutMenuCell.d.ts +2 -2
  49. package/dist/src/components/gridRender/index.d.ts +2 -2
  50. package/dist/src/components/gridUtil.d.ts +3 -3
  51. package/dist/src/components/index.d.ts +18 -18
  52. package/dist/src/contexts/GridContext.d.ts +67 -67
  53. package/dist/src/contexts/GridContextProvider.d.ts +15 -15
  54. package/dist/src/contexts/GridContextProvider.test.d.ts +1 -1
  55. package/dist/src/contexts/GridPopoverContext.d.ts +15 -15
  56. package/dist/src/contexts/GridPopoverContextProvider.d.ts +7 -7
  57. package/dist/src/contexts/GridSubComponentContext.d.ts +10 -10
  58. package/dist/src/contexts/GridUpdatingContext.d.ts +8 -8
  59. package/dist/src/contexts/GridUpdatingContextProvider.d.ts +3 -3
  60. package/dist/src/index.d.ts +17 -17
  61. package/dist/src/lui/ActionButton.d.ts +20 -20
  62. package/dist/src/lui/FormError.d.ts +7 -7
  63. package/dist/src/lui/TextAreaInput.d.ts +11 -11
  64. package/dist/src/lui/TextInputFormatted.d.ts +10 -10
  65. package/dist/src/lui/reactUtils.d.ts +6 -6
  66. package/dist/src/lui/reactUtils.test.d.ts +1 -1
  67. package/dist/src/lui/stateDeferredHook.d.ts +4 -4
  68. package/dist/src/lui/timeoutHook.d.ts +14 -14
  69. package/dist/src/lui/timeoutHook.test.d.ts +1 -1
  70. package/dist/src/react-menu3/components/ControlledMenu.d.ts +8 -8
  71. package/dist/src/react-menu3/components/FocusableItem.d.ts +9 -9
  72. package/dist/src/react-menu3/components/Menu.d.ts +16 -16
  73. package/dist/src/react-menu3/components/MenuButton.d.ts +8 -8
  74. package/dist/src/react-menu3/components/MenuDivider.d.ts +3 -3
  75. package/dist/src/react-menu3/components/MenuGroup.d.ts +12 -12
  76. package/dist/src/react-menu3/components/MenuHeader.d.ts +4 -4
  77. package/dist/src/react-menu3/components/MenuItem.d.ts +59 -59
  78. package/dist/src/react-menu3/components/MenuList.d.ts +2 -2
  79. package/dist/src/react-menu3/components/MenuRadioGroup.d.ts +25 -25
  80. package/dist/src/react-menu3/components/SubMenu.d.ts +110 -110
  81. package/dist/src/react-menu3/contexts/EventHandlersContext.d.ts +7 -7
  82. package/dist/src/react-menu3/contexts/HoverItemContext.d.ts +2 -2
  83. package/dist/src/react-menu3/contexts/ItemSettingsContext.d.ts +5 -5
  84. package/dist/src/react-menu3/contexts/MenuListContext.d.ts +9 -9
  85. package/dist/src/react-menu3/contexts/MenuListItemContext.d.ts +11 -11
  86. package/dist/src/react-menu3/contexts/RadioGroupContext.d.ts +7 -7
  87. package/dist/src/react-menu3/contexts/SettingsContext.d.ts +20 -20
  88. package/dist/src/react-menu3/hooks/index.d.ts +9 -9
  89. package/dist/src/react-menu3/hooks/useBEM.d.ts +10 -10
  90. package/dist/src/react-menu3/hooks/useCombinedRef.d.ts +2 -2
  91. package/dist/src/react-menu3/hooks/useIsomorphicLayoutEffect.d.ts +3 -3
  92. package/dist/src/react-menu3/hooks/useItemEffect.d.ts +2 -2
  93. package/dist/src/react-menu3/hooks/useItemState.d.ts +7 -7
  94. package/dist/src/react-menu3/hooks/useItems.d.ts +7 -7
  95. package/dist/src/react-menu3/hooks/useMenuChange.d.ts +2 -2
  96. package/dist/src/react-menu3/hooks/useMenuState.d.ts +23 -14
  97. package/dist/src/react-menu3/hooks/useMenuStateAndFocus.d.ts +2 -2
  98. package/dist/src/react-menu3/index.d.ts +11 -11
  99. package/dist/src/react-menu3/positionUtils/getPositionHelpers.d.ts +11 -11
  100. package/dist/src/react-menu3/positionUtils/index.d.ts +3 -3
  101. package/dist/src/react-menu3/positionUtils/placeArrowHorizontal.d.ts +8 -8
  102. package/dist/src/react-menu3/positionUtils/placeArrowVertical.d.ts +8 -8
  103. package/dist/src/react-menu3/positionUtils/placeLeftorRight.d.ts +19 -19
  104. package/dist/src/react-menu3/positionUtils/placeToporBottom.d.ts +19 -19
  105. package/dist/src/react-menu3/positionUtils/positionContextMenu.d.ts +13 -13
  106. package/dist/src/react-menu3/positionUtils/positionMenu.d.ts +26 -26
  107. package/dist/src/react-menu3/style-utils/index.d.ts +11 -11
  108. package/dist/src/react-menu3/types.d.ts +401 -401
  109. package/dist/src/react-menu3/utils/constants.d.ts +54 -54
  110. package/dist/src/react-menu3/utils/index.d.ts +3 -3
  111. package/dist/src/react-menu3/utils/propTypes2.d.ts +56 -56
  112. package/dist/src/react-menu3/utils/utils.d.ts +37 -37
  113. package/dist/src/react-menu3/utils/withHovering.d.ts +7 -7
  114. package/dist/src/utils/bearing.d.ts +19 -19
  115. package/dist/src/utils/bearing.test.d.ts +1 -1
  116. package/dist/src/utils/deferredPromise.d.ts +5 -5
  117. package/dist/src/utils/storybookTestUtil.d.ts +3 -3
  118. package/dist/src/utils/testQuick.d.ts +62 -62
  119. package/dist/src/utils/testUtil.d.ts +46 -45
  120. package/dist/src/utils/textMatcher.d.ts +13 -13
  121. package/dist/src/utils/textMatcher.test.d.ts +1 -1
  122. package/dist/src/utils/textValidator.d.ts +18 -18
  123. package/dist/src/utils/textValidator.test.d.ts +1 -1
  124. package/dist/src/utils/util.d.ts +8 -8
  125. package/dist/src/utils/util.test.d.ts +1 -1
  126. package/dist/step-ag-grid.cjs.js +4651 -4651
  127. package/dist/step-ag-grid.cjs.js.map +1 -1
  128. package/dist/step-ag-grid.esm.js +4651 -4651
  129. package/dist/step-ag-grid.esm.js.map +1 -1
  130. package/dist/vite.config.d.ts +2 -0
  131. package/package.json +23 -22
  132. package/src/components/Grid.tsx +10 -9
  133. package/src/components/GridCell.test.tsx +2 -3
  134. package/src/components/GridCell.tsx +75 -23
  135. package/src/components/GridCellFiller.tsx +2 -1
  136. package/src/components/GridCellMultiEditor.tsx +9 -9
  137. package/src/components/GridCellMultiSelectClassRules.tsx +4 -4
  138. package/src/components/GridPopoverHook.tsx +4 -4
  139. package/src/components/PostSortRowsHook.ts +7 -7
  140. package/src/components/gridFilter/GridFilterButtons.tsx +6 -6
  141. package/src/components/gridFilter/GridFilterColumnsToggle.tsx +2 -5
  142. package/src/components/gridFilter/GridFilterDownloadCsvButton.tsx +1 -1
  143. package/src/components/gridFilter/useGridFilter.ts +1 -1
  144. package/src/components/gridForm/GridFormDropDown.tsx +9 -9
  145. package/src/components/gridForm/GridFormEditBearing.tsx +5 -5
  146. package/src/components/gridForm/GridFormMessage.tsx +4 -4
  147. package/src/components/gridForm/GridFormMultiSelect.tsx +9 -9
  148. package/src/components/gridForm/GridFormMultiSelectGrid.tsx +11 -11
  149. package/src/components/gridForm/GridFormPopoverMenu.tsx +13 -13
  150. package/src/components/gridForm/GridFormSubComponentTextArea.tsx +4 -4
  151. package/src/components/gridForm/GridFormSubComponentTextInput.tsx +4 -4
  152. package/src/components/gridForm/GridFormTextArea.tsx +6 -6
  153. package/src/components/gridForm/GridFormTextInput.tsx +7 -7
  154. package/src/components/gridHeader/GridHeaderSelect.tsx +10 -8
  155. package/src/components/gridHook/useGridContextMenu.tsx +8 -8
  156. package/src/components/gridPopoverEdit/GridPopoutEditMultiSelect.ts +6 -6
  157. package/src/components/gridPopoverEdit/GridPopoutEditMultiSelectGrid.ts +6 -6
  158. package/src/components/gridPopoverEdit/GridPopoverEditBearing.ts +16 -16
  159. package/src/components/gridPopoverEdit/GridPopoverEditDropDown.ts +6 -6
  160. package/src/components/gridPopoverEdit/GridPopoverMenu.tsx +5 -5
  161. package/src/components/gridPopoverEdit/GridPopoverMessage.ts +5 -5
  162. package/src/components/gridPopoverEdit/GridPopoverTextArea.ts +5 -4
  163. package/src/components/gridPopoverEdit/GridPopoverTextInput.ts +5 -5
  164. package/src/components/gridRender/GridRenderGenericCell.tsx +6 -36
  165. package/src/contexts/GridContext.tsx +9 -9
  166. package/src/contexts/GridContextProvider.test.tsx +1 -1
  167. package/src/contexts/GridContextProvider.tsx +32 -36
  168. package/src/contexts/GridPopoverContext.tsx +6 -6
  169. package/src/stories/grid/GridDragRow.stories.tsx +13 -7
  170. package/src/stories/grid/GridNonEditableRow.stories.tsx +2 -3
  171. package/src/stories/grid/GridPopoutContextMenu.stories.tsx +2 -2
  172. package/src/stories/grid/GridPopoutEditGenericTextArea.stories.tsx +1 -1
  173. package/src/stories/grid/GridPopoverEditBearing.stories.tsx +2 -2
  174. package/src/stories/grid/GridPopoverEditDropDown.stories.tsx +12 -3
  175. package/src/stories/grid/GridPopoverEditMultiSelect.stories.tsx +2 -2
  176. package/src/stories/grid/GridPopoverEditMultiSelectGrid.stories.tsx +2 -2
  177. package/src/stories/grid/GridReadOnly.stories.tsx +6 -6
  178. package/src/stories/grid/GridViewList.stories.tsx +5 -7
  179. package/src/stories/grid/interactions/GridKeyboardInteractions.stories.tsx +3 -3
  180. package/src/styles/Grid.scss +3 -6
  181. package/src/utils/testUtil.ts +49 -7
  182. package/src/utils/textValidator.ts +5 -5
  183. package/src/utils/util.ts +1 -1
@@ -17,6 +17,43 @@ export const countRows = async (within?: HTMLElement): Promise<number> => {
17
17
  return getAllQuick({ tagName: `div[row-id]:not(:empty)` }, within).length;
18
18
  };
19
19
 
20
+ export const findRowByIndex = async (rowIndex: number | string, within?: HTMLElement): Promise<HTMLDivElement> => {
21
+ await waitFor(async () => {
22
+ expect(getAllQuick({ classes: ".ag-row" }).length > 0).toBe(true);
23
+ });
24
+ //if this is not wrapped in an act console errors are logged during testing
25
+ let row!: HTMLDivElement;
26
+ await act(async () => {
27
+ row = await findQuick<HTMLDivElement>(
28
+ { tagName: `.ag-center-cols-container div[row-index='${rowIndex}']:not(:empty)` },
29
+ within,
30
+ );
31
+ // @ts-ignore
32
+ let combineChildren = [...Array.from(row.children)];
33
+
34
+ const leftCols = queryQuick<HTMLDivElement>(
35
+ { tagName: `.ag-pinned-left-cols-container div[row-index='${rowIndex}']` },
36
+ within,
37
+ );
38
+ if (leftCols) {
39
+ // @ts-ignore
40
+ combineChildren = [...Array.from(leftCols.children), ...combineChildren];
41
+ }
42
+
43
+ const rightCols = queryQuick<HTMLDivElement>(
44
+ { tagName: `.ag-pinned-right-cols-container div[row-index='${rowIndex}']` },
45
+ within,
46
+ );
47
+ if (rightCols) {
48
+ // @ts-ignore
49
+ combineChildren = [...Array.from(rightCols.children), ...combineChildren];
50
+ }
51
+
52
+ row.replaceChildren(...combineChildren);
53
+ });
54
+ return row;
55
+ };
56
+
20
57
  export const findRow = async (rowId: number | string, within?: HTMLElement): Promise<HTMLDivElement> => {
21
58
  await waitFor(async () => {
22
59
  expect(getAllQuick({ classes: ".ag-row" }).length > 0).toBe(true);
@@ -29,7 +66,7 @@ export const findRow = async (rowId: number | string, within?: HTMLElement): Pro
29
66
  within,
30
67
  );
31
68
  // @ts-ignore
32
- let combineChildren = [...row.children];
69
+ let combineChildren = [...Array.from(row.children)];
33
70
 
34
71
  const leftCols = queryQuick<HTMLDivElement>(
35
72
  { tagName: `.ag-pinned-left-cols-container div[row-id='${rowId}']` },
@@ -37,7 +74,7 @@ export const findRow = async (rowId: number | string, within?: HTMLElement): Pro
37
74
  );
38
75
  if (leftCols) {
39
76
  // @ts-ignore
40
- combineChildren = [...leftCols.children, ...combineChildren];
77
+ combineChildren = [...Array.from(leftCols.children), ...combineChildren];
41
78
  }
42
79
 
43
80
  const rightCols = queryQuick<HTMLDivElement>(
@@ -46,7 +83,7 @@ export const findRow = async (rowId: number | string, within?: HTMLElement): Pro
46
83
  );
47
84
  if (rightCols) {
48
85
  // @ts-ignore
49
- combineChildren = [...rightCols.children, ...combineChildren];
86
+ combineChildren = [...Array.from(rightCols.children), ...combineChildren];
50
87
  }
51
88
 
52
89
  row.replaceChildren(...combineChildren);
@@ -108,9 +145,14 @@ export const selectCell = async (rowId: string | number, colId: string, within?:
108
145
  };
109
146
 
110
147
  export const editCell = async (rowId: number | string, colId: string, within?: HTMLElement): Promise<void> => {
111
- const cell = await findCell(rowId, colId, within);
112
- await user.dblClick(cell);
113
- await waitFor(findOpenPopover);
148
+ await waitFor(
149
+ async () => {
150
+ const cell = await findCell(rowId, colId, within);
151
+ await user.dblClick(cell);
152
+ await waitFor(findOpenPopover, { timeout: 1000 });
153
+ },
154
+ { timeout: 10000 },
155
+ );
114
156
  };
115
157
 
116
158
  export const isCellReadOnly = async (rowId: number | string, colId: string, within?: HTMLElement): Promise<boolean> => {
@@ -118,7 +160,7 @@ export const isCellReadOnly = async (rowId: number | string, colId: string, with
118
160
  return cell.className.includes("GridCell-readonly");
119
161
  };
120
162
 
121
- export const findOpenPopover = async (): Promise<HTMLElement> => findQuick({ classes: ".szh-menu--state-open" });
163
+ export const findOpenPopover = () => findQuick({ classes: ".szh-menu--state-open" });
122
164
 
123
165
  export const queryMenuOption = async (menuOptionText: string | RegExp): Promise<HTMLElement | null> => {
124
166
  const openMenu = await findOpenPopover();
@@ -3,11 +3,11 @@ import { ReactElement } from "react";
3
3
  import { GridBaseRow } from "../components/Grid";
4
4
  import { isFloat, stringByteLengthIsInvalid } from "./util";
5
5
 
6
- export interface TextInputValidatorProps<RowType extends GridBaseRow> {
6
+ export interface TextInputValidatorProps<TData extends GridBaseRow> {
7
7
  required?: boolean;
8
8
  maxLength?: number;
9
9
  maxBytes?: number;
10
- invalid?: (value: string, data: RowType, context: any) => ReactElement | string | null;
10
+ invalid?: (value: string, data: TData, context: any) => ReactElement | string | null;
11
11
  numberFormat?: {
12
12
  precision?: number;
13
13
  scale?: number;
@@ -19,10 +19,10 @@ export interface TextInputValidatorProps<RowType extends GridBaseRow> {
19
19
  };
20
20
  }
21
21
 
22
- export const TextInputValidator = <RowType extends GridBaseRow>(
23
- props: TextInputValidatorProps<RowType>,
22
+ export const TextInputValidator = <TData extends GridBaseRow>(
23
+ props: TextInputValidatorProps<TData>,
24
24
  value: string | null,
25
- data: RowType,
25
+ data: TData,
26
26
  context: any,
27
27
  ) => {
28
28
  if (value == null) return null;
package/src/utils/util.ts CHANGED
@@ -44,7 +44,7 @@ export const hasParentClass = function (className: string, child: Node) {
44
44
  export const stringByteLengthIsInvalid = (str: string, maxBytes: number) =>
45
45
  new TextEncoder().encode(str).length > maxBytes;
46
46
 
47
- export const fnOrVar = (fn: any, param: any) => (typeof fn === "function" ? fn(param) : fn);
47
+ export const fnOrVar = (fn: any, param?: any) => (typeof fn === "function" ? fn(param) : fn);
48
48
 
49
49
  export const sanitiseFileName = (filename: string): string => {
50
50
  const valid = filename