@linzjs/step-ag-grid 1.4.4 → 1.4.5

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 (100) hide show
  1. package/dist/index.js +1602 -3043
  2. package/dist/index.js.map +1 -1
  3. package/dist/src/components/GridLoadableCell.d.ts +2 -0
  4. package/dist/src/components/gridForm/GridFormDropDown.d.ts +1 -1
  5. package/dist/src/components/gridForm/GridFormMultiSelect.d.ts +1 -1
  6. package/dist/src/components/gridPopoverEdit/GridPopoverMenu.d.ts +1 -1
  7. package/dist/src/react-menu3/components/ControlledMenu.d.ts +2 -0
  8. package/dist/src/react-menu3/components/FocusableItem.d.ts +1 -0
  9. package/dist/src/react-menu3/components/Menu.d.ts +2 -0
  10. package/dist/src/react-menu3/components/MenuButton.d.ts +1 -0
  11. package/dist/src/react-menu3/components/MenuDivider.d.ts +2 -0
  12. package/dist/src/react-menu3/components/MenuGroup.d.ts +2 -0
  13. package/dist/src/react-menu3/components/MenuHeader.d.ts +2 -0
  14. package/dist/src/react-menu3/components/MenuItem.d.ts +1 -0
  15. package/dist/src/react-menu3/components/MenuList.d.ts +30 -0
  16. package/dist/src/react-menu3/components/MenuRadioGroup.d.ts +2 -0
  17. package/dist/src/react-menu3/components/SubMenu.d.ts +1 -0
  18. package/dist/src/react-menu3/hooks/index.d.ts +9 -0
  19. package/dist/src/react-menu3/hooks/useBEM.d.ts +9 -0
  20. package/dist/src/react-menu3/hooks/useCombinedRef.d.ts +2 -0
  21. package/dist/src/react-menu3/hooks/useIsomorphicLayoutEffect.d.ts +3 -0
  22. package/dist/src/react-menu3/hooks/useItemEffect.d.ts +2 -0
  23. package/dist/src/react-menu3/hooks/useItemState.d.ts +6 -0
  24. package/dist/src/react-menu3/hooks/useItems.d.ts +5 -0
  25. package/dist/src/react-menu3/hooks/useMenuChange.d.ts +1 -0
  26. package/dist/src/react-menu3/hooks/useMenuState.d.ts +11 -0
  27. package/dist/src/react-menu3/hooks/useMenuStateAndFocus.d.ts +10 -0
  28. package/dist/src/react-menu3/index.d.ts +11 -0
  29. package/dist/src/react-menu3/positionUtils/getPositionHelpers.d.ts +10 -0
  30. package/dist/src/react-menu3/positionUtils/index.d.ts +3 -0
  31. package/dist/src/react-menu3/positionUtils/placeArrowHorizontal.d.ts +7 -0
  32. package/dist/src/react-menu3/positionUtils/placeArrowVertical.d.ts +7 -0
  33. package/dist/src/react-menu3/positionUtils/placeLeftorRight.d.ts +21 -0
  34. package/dist/src/react-menu3/positionUtils/placeToporBottom.d.ts +21 -0
  35. package/dist/src/react-menu3/positionUtils/positionContextMenu.d.ts +8 -0
  36. package/dist/src/react-menu3/positionUtils/positionMenu.d.ts +21 -0
  37. package/dist/src/react-menu3/style-utils/index.d.ts +11 -0
  38. package/dist/src/react-menu3/utils/constants.d.ts +50 -0
  39. package/dist/src/react-menu3/utils/index.d.ts +4 -0
  40. package/dist/src/react-menu3/utils/propTypes.d.ts +55 -0
  41. package/dist/src/react-menu3/utils/utils.d.ts +27 -0
  42. package/dist/src/react-menu3/utils/withHovering.d.ts +1 -0
  43. package/dist/step-ag-grid.esm.js +1513 -2953
  44. package/dist/step-ag-grid.esm.js.map +1 -1
  45. package/package.json +18 -9
  46. package/src/components/GridLoadableCell.scss +4 -0
  47. package/src/components/GridLoadableCell.tsx +5 -1
  48. package/src/components/GridPopoverHook.tsx +4 -50
  49. package/src/components/gridForm/GridFormDropDown.tsx +2 -2
  50. package/src/components/gridForm/GridFormMultiSelect.tsx +4 -4
  51. package/src/components/gridForm/GridFormPopoutMenu.tsx +1 -1
  52. package/src/components/gridPopoverEdit/GridPopoverMenu.scss +6 -2
  53. package/src/components/gridPopoverEdit/GridPopoverMenu.tsx +1 -1
  54. package/src/components/gridRender/GridRenderPopoutMenuCell.tsx +7 -9
  55. package/src/react-menu3/components/ControlledMenu.tsx +260 -0
  56. package/src/react-menu3/components/FocusableItem.tsx +70 -0
  57. package/src/react-menu3/components/Menu.tsx +96 -0
  58. package/src/react-menu3/components/MenuButton.tsx +33 -0
  59. package/src/react-menu3/components/MenuDivider.tsx +21 -0
  60. package/src/react-menu3/components/MenuGroup.tsx +38 -0
  61. package/src/react-menu3/components/MenuHeader.tsx +21 -0
  62. package/src/react-menu3/components/MenuItem.tsx +130 -0
  63. package/src/react-menu3/components/MenuList.tsx +434 -0
  64. package/src/react-menu3/components/MenuRadioGroup.tsx +33 -0
  65. package/src/react-menu3/components/SubMenu.tsx +243 -0
  66. package/src/react-menu3/hooks/index.ts +9 -0
  67. package/src/react-menu3/hooks/useBEM.ts +32 -0
  68. package/src/react-menu3/hooks/useCombinedRef.ts +30 -0
  69. package/src/react-menu3/hooks/useIsomorphicLayoutEffect.ts +15 -0
  70. package/src/react-menu3/hooks/useItemEffect.ts +22 -0
  71. package/src/react-menu3/hooks/useItemState.ts +63 -0
  72. package/src/react-menu3/hooks/useItems.ts +110 -0
  73. package/src/react-menu3/hooks/useMenuChange.ts +12 -0
  74. package/src/react-menu3/hooks/useMenuState.ts +24 -0
  75. package/src/react-menu3/hooks/useMenuStateAndFocus.ts +15 -0
  76. package/src/react-menu3/index.d.ts +682 -0
  77. package/src/react-menu3/index.ts +11 -0
  78. package/src/react-menu3/positionUtils/getPositionHelpers.ts +76 -0
  79. package/src/react-menu3/positionUtils/index.ts +3 -0
  80. package/src/react-menu3/positionUtils/placeArrowHorizontal.ts +8 -0
  81. package/src/react-menu3/positionUtils/placeArrowVertical.ts +8 -0
  82. package/src/react-menu3/positionUtils/placeLeftorRight.ts +76 -0
  83. package/src/react-menu3/positionUtils/placeToporBottom.ts +77 -0
  84. package/src/react-menu3/positionUtils/positionContextMenu.ts +49 -0
  85. package/src/react-menu3/positionUtils/positionMenu.ts +73 -0
  86. package/src/react-menu3/style-utils/index.ts +80 -0
  87. package/src/react-menu3/style-utils.d.ts +110 -0
  88. package/src/react-menu3/styles/_mixins.scss +11 -0
  89. package/src/react-menu3/styles/_var.scss +20 -0
  90. package/src/react-menu3/styles/core.scss +80 -0
  91. package/src/react-menu3/styles/index.scss +70 -0
  92. package/src/react-menu3/styles/theme-dark.scss +30 -0
  93. package/src/react-menu3/styles/transitions/slide.scss +47 -0
  94. package/src/react-menu3/utils/constants.ts +63 -0
  95. package/src/react-menu3/utils/index.ts +4 -0
  96. package/src/react-menu3/utils/propTypes.ts +61 -0
  97. package/src/react-menu3/utils/utils.ts +71 -0
  98. package/src/react-menu3/utils/withHovering.tsx +22 -0
  99. package/src/stories/components/GridPopoutEditDropDown.stories.tsx +1 -3
  100. package/src/utils/util.ts +2 -1
@@ -0,0 +1,70 @@
1
+ @use 'var';
2
+ @use 'core';
3
+
4
+ .szh-menu {
5
+ user-select: none;
6
+ color: var.$color;
7
+ border: none;
8
+ border-radius: 0.25rem;
9
+ box-shadow: 0 3px 7px rgba(0, 0, 0, 0.133), 0 0.6px 2px rgba(0, 0, 0, 0.1);
10
+ min-width: 10rem;
11
+ padding: 0.5rem 0;
12
+
13
+ &__item {
14
+ display: flex;
15
+ align-items: center;
16
+ position: relative;
17
+ padding: 0.375rem 1.5rem;
18
+
19
+ .szh-menu-container--itemTransition & {
20
+ transition: {
21
+ property: background-color, color;
22
+ duration: 0.15s;
23
+ timing-function: ease-in-out;
24
+ }
25
+ }
26
+
27
+ &--type-radio {
28
+ padding-left: 2.2rem;
29
+ &::before {
30
+ content: '\25cb';
31
+ position: absolute;
32
+ left: 0.8rem;
33
+ top: 0.55rem;
34
+ font-size: 0.8rem;
35
+ }
36
+ }
37
+
38
+ &--type-radio#{&}--checked::before {
39
+ content: '\25cf';
40
+ }
41
+
42
+ &--type-checkbox {
43
+ padding-left: 2.2rem;
44
+ &::before {
45
+ position: absolute;
46
+ left: 0.8rem;
47
+ }
48
+ }
49
+
50
+ &--type-checkbox#{&}--checked::before {
51
+ content: '\2714';
52
+ }
53
+ }
54
+
55
+ &__submenu > .szh-menu__item {
56
+ padding-right: 2.5rem;
57
+ &::after {
58
+ content: '\276f';
59
+ position: absolute;
60
+ right: 1rem;
61
+ }
62
+ }
63
+
64
+ &__header {
65
+ color: var.$header-color;
66
+ font-size: 0.8rem;
67
+ padding: 0.2rem 1.5rem;
68
+ text-transform: uppercase;
69
+ }
70
+ }
@@ -0,0 +1,30 @@
1
+ @use 'var';
2
+
3
+ .szh-menu-container--theme-dark .szh-menu {
4
+ color: var.$color-dark;
5
+ background-color: var.$background-color-dark;
6
+ border: 1px solid var.$border-color-dark;
7
+ box-shadow: 0 2px 9px 3px rgba(0, 0, 0, 0.25);
8
+
9
+ &__arrow {
10
+ background-color: var.$background-color-dark;
11
+ border-left-color: var.$border-color-dark;
12
+ border-top-color: var.$border-color-dark;
13
+ }
14
+
15
+ &__item {
16
+ &--hover {
17
+ background-color: var.$background-color-hover-dark;
18
+ }
19
+ &--focusable {
20
+ background-color: inherit;
21
+ }
22
+ &--disabled {
23
+ color: var.$color-disabled-dark;
24
+ }
25
+ }
26
+
27
+ &__divider {
28
+ background-color: var.$divider-color-dark;
29
+ }
30
+ }
@@ -0,0 +1,47 @@
1
+ @use 'sass:list';
2
+ @use 'sass:map';
3
+
4
+ $menu: 'szh-menu';
5
+ $duration: 0.15s;
6
+ $directions: (
7
+ 'left': 'X' 1,
8
+ 'right': 'X' -1,
9
+ 'top': 'Y' 1,
10
+ 'bottom': 'Y' -1
11
+ );
12
+
13
+ @mixin animation($name, $dir) {
14
+ .#{$menu}--state-opening.#{$menu}--dir-#{$dir} {
15
+ animation: #{$menu}-show-#{$name}-#{$dir} $duration ease-out;
16
+ }
17
+
18
+ .#{$menu}--state-closing.#{$menu}--dir-#{$dir} {
19
+ animation: #{$menu}-hide-#{$name}-#{$dir} $duration ease-in forwards;
20
+ }
21
+ }
22
+
23
+ @mixin slide-start($axis, $sign) {
24
+ opacity: 0;
25
+ transform: translate#{$axis }($sign * 0.75rem);
26
+ }
27
+
28
+ @each $dir, $value in $directions {
29
+ $axis: list.nth($value, 1);
30
+ $sign: list.nth($value, 2);
31
+
32
+ @keyframes #{$menu}-show-slide-#{$dir} {
33
+ from {
34
+ @include slide-start($axis, $sign);
35
+ }
36
+ }
37
+
38
+ @keyframes #{$menu}-hide-slide-#{$dir} {
39
+ to {
40
+ @include slide-start($axis, $sign);
41
+ }
42
+ }
43
+ }
44
+
45
+ @each $dir in map.keys($directions) {
46
+ @include animation('slide', $dir);
47
+ }
@@ -0,0 +1,63 @@
1
+ // @ts-nocheck
2
+ import { createContext } from "react";
3
+
4
+ export const menuContainerClass = "szh-menu-container";
5
+ export const menuClass = "szh-menu";
6
+ export const menuButtonClass = "szh-menu-button";
7
+ export const menuArrowClass = "arrow";
8
+ export const menuItemClass = "item";
9
+ export const menuDividerClass = "divider";
10
+ export const menuHeaderClass = "header";
11
+ export const menuGroupClass = "group";
12
+ export const subMenuClass = "submenu";
13
+ export const radioGroupClass = "radio-group";
14
+
15
+ export const HoverItemContext = createContext();
16
+ export const MenuListItemContext = createContext({});
17
+ export const MenuListContext = createContext({});
18
+ export const EventHandlersContext = createContext({});
19
+ export const RadioGroupContext = createContext({});
20
+ export const SettingsContext = createContext({});
21
+ export const ItemSettingsContext = createContext({});
22
+
23
+ export const Keys = Object.freeze({
24
+ ENTER: "Enter",
25
+ ESC: "Escape",
26
+ SPACE: " ",
27
+ HOME: "Home",
28
+ END: "End",
29
+ LEFT: "ArrowLeft",
30
+ RIGHT: "ArrowRight",
31
+ UP: "ArrowUp",
32
+ DOWN: "ArrowDown",
33
+ });
34
+
35
+ export const HoverActionTypes = Object.freeze({
36
+ RESET: 0,
37
+ SET: 1,
38
+ UNSET: 2,
39
+ INCREASE: 3,
40
+ DECREASE: 4,
41
+ FIRST: 5,
42
+ LAST: 6,
43
+ SET_INDEX: 7,
44
+ });
45
+
46
+ export const CloseReason = Object.freeze({
47
+ CLICK: "click",
48
+ CANCEL: "cancel",
49
+ BLUR: "blur",
50
+ SCROLL: "scroll",
51
+ });
52
+
53
+ export const FocusPositions = Object.freeze({
54
+ FIRST: "first",
55
+ LAST: "last",
56
+ });
57
+
58
+ export const MenuStateMap: Record<string, string | undefined> = Object.freeze({
59
+ entering: "opening",
60
+ entered: "open",
61
+ exiting: "closing",
62
+ exited: "closed",
63
+ });
@@ -0,0 +1,4 @@
1
+ export * from "./constants";
2
+ export * from "./utils";
3
+ export * from "./propTypes";
4
+ export { withHovering } from "./withHovering";
@@ -0,0 +1,61 @@
1
+ import { string, number, bool, func, object, oneOf, oneOfType, exact } from "prop-types";
2
+
3
+ export const stylePropTypes = (name?: string) => ({
4
+ [name ? `${name}ClassName` : "className"]: oneOfType([string, func]),
5
+ });
6
+
7
+ // Menu, SubMenu and ControlledMenu
8
+ export const menuPropTypes = {
9
+ className: string,
10
+ ...stylePropTypes("menu"),
11
+ ...stylePropTypes("arrow"),
12
+ menuStyle: object,
13
+ arrowStyle: object,
14
+ arrow: bool,
15
+ setDownOverflow: bool,
16
+ offsetX: number,
17
+ offsetY: number,
18
+ align: oneOf(["start", "center", "end"]),
19
+ direction: oneOf(["left", "right", "top", "bottom"]),
20
+ position: oneOf(["auto", "anchor", "initial"]),
21
+ overflow: oneOf(["auto", "visible", "hidden"]),
22
+ };
23
+
24
+ // Menu and ControlledMenu
25
+ export const rootMenuPropTypes = {
26
+ ...menuPropTypes,
27
+ containerProps: object,
28
+ initialMounted: bool,
29
+ unmountOnClose: bool,
30
+ transition: oneOfType([
31
+ bool,
32
+ exact({
33
+ open: bool,
34
+ close: bool,
35
+ item: bool,
36
+ }),
37
+ ]),
38
+ transitionTimeout: number,
39
+ boundingBoxRef: object,
40
+ boundingBoxPadding: string,
41
+ reposition: oneOf(["auto", "initial"]),
42
+ repositionFlag: oneOfType([string, number]),
43
+ viewScroll: oneOf(["auto", "close", "initial"]),
44
+ submenuOpenDelay: number,
45
+ submenuCloseDelay: number,
46
+ portal: oneOfType([
47
+ bool,
48
+ exact({
49
+ target: object,
50
+ stablePosition: bool,
51
+ }),
52
+ ]),
53
+ theming: string,
54
+ onItemClick: func,
55
+ };
56
+
57
+ // Menu and SubMenu
58
+ export const uncontrolledMenuPropTypes = {
59
+ instanceRef: oneOfType([object, func]),
60
+ onMenuChange: func,
61
+ };
@@ -0,0 +1,71 @@
1
+ // @ts-nocheck
2
+ import { unstable_batchedUpdates } from "react-dom";
3
+
4
+ export const isMenuOpen = (state) => !!state && state[0] === "o";
5
+ export const batchedUpdates = unstable_batchedUpdates || ((callback) => callback());
6
+ export const values = Object.values || ((obj) => Object.keys(obj).map((key) => obj[key]));
7
+ export const floatEqual = (a: number, b: number, diff = 0.0001) => Math.abs(a - b) < diff;
8
+ export const getTransition = (transition: boolean | Record<string, string>, name: string) =>
9
+ transition === true || !!(transition && transition[name]);
10
+ export const safeCall = (fn, arg) => (typeof fn === "function" ? fn(arg) : fn);
11
+
12
+ const internalKey = "_szhsinMenu";
13
+ export const getName = (component) => component[internalKey];
14
+ export const defineName = (name, component) => Object.defineProperty(component, internalKey, { value: name });
15
+
16
+ export const mergeProps = (target: Record<string, any>, source: Record<string, any>) => {
17
+ source &&
18
+ Object.keys(source).forEach((key) => {
19
+ const targetProp = target[key];
20
+ const sourceProp = source[key];
21
+ if (typeof sourceProp === "function" && targetProp) {
22
+ target[key] = (...arg) => {
23
+ sourceProp(...arg);
24
+ targetProp(...arg);
25
+ };
26
+ } else {
27
+ target[key] = sourceProp;
28
+ }
29
+ });
30
+
31
+ return target;
32
+ };
33
+
34
+ export const parsePadding = (paddingStr) => {
35
+ if (typeof paddingStr !== "string") return { top: 0, right: 0, bottom: 0, left: 0 };
36
+
37
+ const padding = paddingStr.trim().split(/\s+/, 4).map(parseFloat);
38
+ const top = !isNaN(padding[0]) ? padding[0] : 0;
39
+ const right = !isNaN(padding[1]) ? padding[1] : top;
40
+ return {
41
+ top,
42
+ right,
43
+ bottom: !isNaN(padding[2]) ? padding[2] : top,
44
+ left: !isNaN(padding[3]) ? padding[3] : right,
45
+ };
46
+ };
47
+
48
+ // Adapted from https://github.com/popperjs/popper-core/tree/v2.9.1/src/dom-utils
49
+ export const getScrollAncestor = (node) => {
50
+ const thisWindow = node.ownerDocument.defaultView;
51
+ while (node) {
52
+ node = node.parentNode;
53
+ if (!node || node === thisWindow.document.body) return;
54
+ const { overflow, overflowX, overflowY } = thisWindow.getComputedStyle(node);
55
+ if (/auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX)) return node;
56
+ }
57
+ };
58
+
59
+ export function commonProps(isDisabled, isHovering) {
60
+ return {
61
+ "aria-disabled": isDisabled || undefined,
62
+ tabIndex: isHovering ? 0 : -1,
63
+ };
64
+ }
65
+
66
+ export function indexOfNode(nodeList, node) {
67
+ for (let i = 0; i < nodeList.length; i++) {
68
+ if (nodeList[i] === node) return i;
69
+ }
70
+ return -1;
71
+ }
@@ -0,0 +1,22 @@
1
+ // @ts-nocheck
2
+ import { memo, forwardRef, useContext, useRef } from "react";
3
+ import { HoverItemContext } from "./constants";
4
+
5
+ export const withHovering = (name: string, WrappedComponent: any): any => {
6
+ const Component = memo(WrappedComponent);
7
+ const WithHovering = forwardRef<any>((props: any, ref) => {
8
+ const itemRef = useRef(null);
9
+ return (
10
+ <Component
11
+ {...props}
12
+ itemRef={itemRef}
13
+ externalRef={ref}
14
+ isHovering={useContext(HoverItemContext) === itemRef.current}
15
+ />
16
+ );
17
+ });
18
+
19
+ WithHovering.displayName = `WithHovering(${name})`;
20
+
21
+ return WithHovering;
22
+ };
@@ -8,12 +8,10 @@ import { GridContextProvider } from "@contexts/GridContextProvider";
8
8
  import { Grid, GridProps } from "@components/Grid";
9
9
  import { useCallback, useMemo, useState } from "react";
10
10
  import {
11
- FinalSelectOption,
12
11
  GridFormDropDown,
13
12
  GridFormPopoutDropDownProps,
14
13
  MenuSeparator,
15
14
  MenuSeparatorString,
16
- SelectOption,
17
15
  } from "@components/gridForm/GridFormDropDown";
18
16
  import { ColDef } from "ag-grid-community";
19
17
  import { wait } from "@utils/util";
@@ -180,7 +178,7 @@ const GridEditDropDownTemplate: ComponentStory<typeof Grid> = (props: GridProps)
180
178
  },
181
179
  }),
182
180
  ] as ColDef[],
183
- [optionsFn],
181
+ [optionsFn, optionsObjects],
184
182
  );
185
183
 
186
184
  const rowData = useMemo(
package/src/utils/util.ts CHANGED
@@ -17,7 +17,8 @@ export const isFloat = (value: string) => {
17
17
  export const hasParentClass = function (className: string, child: Node) {
18
18
  let node: Node | null = child;
19
19
  while (node) {
20
- if (node instanceof Node && node instanceof HTMLElement && node.classList.contains(className)) {
20
+ // When nodes are in portals they aren't type node anymore hence treating it as any here
21
+ if ((node as any).classList && (node as any).classList.contains(className)) {
21
22
  return true;
22
23
  }
23
24
  node = node.parentNode;