@linzjs/step-ag-grid 1.4.2 → 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.
- package/dist/index.js +1610 -3048
- package/dist/index.js.map +1 -1
- package/dist/src/components/GridLoadableCell.d.ts +2 -0
- package/dist/src/components/gridForm/GridFormDropDown.d.ts +1 -1
- package/dist/src/components/gridForm/GridFormMultiSelect.d.ts +1 -1
- package/dist/src/components/gridPopoverEdit/GridPopoverMenu.d.ts +1 -1
- package/dist/src/react-menu3/components/ControlledMenu.d.ts +2 -0
- package/dist/src/react-menu3/components/FocusableItem.d.ts +1 -0
- package/dist/src/react-menu3/components/Menu.d.ts +2 -0
- package/dist/src/react-menu3/components/MenuButton.d.ts +1 -0
- package/dist/src/react-menu3/components/MenuDivider.d.ts +2 -0
- package/dist/src/react-menu3/components/MenuGroup.d.ts +2 -0
- package/dist/src/react-menu3/components/MenuHeader.d.ts +2 -0
- package/dist/src/react-menu3/components/MenuItem.d.ts +1 -0
- package/dist/src/react-menu3/components/MenuList.d.ts +30 -0
- package/dist/src/react-menu3/components/MenuRadioGroup.d.ts +2 -0
- package/dist/src/react-menu3/components/SubMenu.d.ts +1 -0
- package/dist/src/react-menu3/hooks/index.d.ts +9 -0
- package/dist/src/react-menu3/hooks/useBEM.d.ts +9 -0
- package/dist/src/react-menu3/hooks/useCombinedRef.d.ts +2 -0
- package/dist/src/react-menu3/hooks/useIsomorphicLayoutEffect.d.ts +3 -0
- package/dist/src/react-menu3/hooks/useItemEffect.d.ts +2 -0
- package/dist/src/react-menu3/hooks/useItemState.d.ts +6 -0
- package/dist/src/react-menu3/hooks/useItems.d.ts +5 -0
- package/dist/src/react-menu3/hooks/useMenuChange.d.ts +1 -0
- package/dist/src/react-menu3/hooks/useMenuState.d.ts +11 -0
- package/dist/src/react-menu3/hooks/useMenuStateAndFocus.d.ts +10 -0
- package/dist/src/react-menu3/index.d.ts +11 -0
- package/dist/src/react-menu3/positionUtils/getPositionHelpers.d.ts +10 -0
- package/dist/src/react-menu3/positionUtils/index.d.ts +3 -0
- package/dist/src/react-menu3/positionUtils/placeArrowHorizontal.d.ts +7 -0
- package/dist/src/react-menu3/positionUtils/placeArrowVertical.d.ts +7 -0
- package/dist/src/react-menu3/positionUtils/placeLeftorRight.d.ts +21 -0
- package/dist/src/react-menu3/positionUtils/placeToporBottom.d.ts +21 -0
- package/dist/src/react-menu3/positionUtils/positionContextMenu.d.ts +8 -0
- package/dist/src/react-menu3/positionUtils/positionMenu.d.ts +21 -0
- package/dist/src/react-menu3/style-utils/index.d.ts +11 -0
- package/dist/src/react-menu3/utils/constants.d.ts +50 -0
- package/dist/src/react-menu3/utils/index.d.ts +4 -0
- package/dist/src/react-menu3/utils/propTypes.d.ts +55 -0
- package/dist/src/react-menu3/utils/utils.d.ts +27 -0
- package/dist/src/react-menu3/utils/withHovering.d.ts +1 -0
- package/dist/step-ag-grid.esm.js +1521 -2958
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +18 -9
- package/src/components/GridLoadableCell.scss +4 -0
- package/src/components/GridLoadableCell.tsx +5 -1
- package/src/components/GridPopoverHook.tsx +4 -50
- package/src/components/gridForm/GridFormDropDown.tsx +3 -3
- package/src/components/gridForm/GridFormMultiSelect.tsx +4 -4
- package/src/components/gridForm/GridFormPopoutMenu.tsx +1 -1
- package/src/components/gridPopoverEdit/GridPopoverMenu.scss +6 -2
- package/src/components/gridPopoverEdit/GridPopoverMenu.tsx +1 -1
- package/src/components/gridRender/GridRenderPopoutMenuCell.tsx +7 -9
- package/src/react-menu3/components/ControlledMenu.tsx +260 -0
- package/src/react-menu3/components/FocusableItem.tsx +70 -0
- package/src/react-menu3/components/Menu.tsx +96 -0
- package/src/react-menu3/components/MenuButton.tsx +33 -0
- package/src/react-menu3/components/MenuDivider.tsx +21 -0
- package/src/react-menu3/components/MenuGroup.tsx +38 -0
- package/src/react-menu3/components/MenuHeader.tsx +21 -0
- package/src/react-menu3/components/MenuItem.tsx +130 -0
- package/src/react-menu3/components/MenuList.tsx +434 -0
- package/src/react-menu3/components/MenuRadioGroup.tsx +33 -0
- package/src/react-menu3/components/SubMenu.tsx +243 -0
- package/src/react-menu3/hooks/index.ts +9 -0
- package/src/react-menu3/hooks/useBEM.ts +32 -0
- package/src/react-menu3/hooks/useCombinedRef.ts +30 -0
- package/src/react-menu3/hooks/useIsomorphicLayoutEffect.ts +15 -0
- package/src/react-menu3/hooks/useItemEffect.ts +22 -0
- package/src/react-menu3/hooks/useItemState.ts +63 -0
- package/src/react-menu3/hooks/useItems.ts +110 -0
- package/src/react-menu3/hooks/useMenuChange.ts +12 -0
- package/src/react-menu3/hooks/useMenuState.ts +24 -0
- package/src/react-menu3/hooks/useMenuStateAndFocus.ts +15 -0
- package/src/react-menu3/index.d.ts +682 -0
- package/src/react-menu3/index.ts +11 -0
- package/src/react-menu3/positionUtils/getPositionHelpers.ts +76 -0
- package/src/react-menu3/positionUtils/index.ts +3 -0
- package/src/react-menu3/positionUtils/placeArrowHorizontal.ts +8 -0
- package/src/react-menu3/positionUtils/placeArrowVertical.ts +8 -0
- package/src/react-menu3/positionUtils/placeLeftorRight.ts +76 -0
- package/src/react-menu3/positionUtils/placeToporBottom.ts +77 -0
- package/src/react-menu3/positionUtils/positionContextMenu.ts +49 -0
- package/src/react-menu3/positionUtils/positionMenu.ts +73 -0
- package/src/react-menu3/style-utils/index.ts +80 -0
- package/src/react-menu3/style-utils.d.ts +110 -0
- package/src/react-menu3/styles/_mixins.scss +11 -0
- package/src/react-menu3/styles/_var.scss +20 -0
- package/src/react-menu3/styles/core.scss +80 -0
- package/src/react-menu3/styles/index.scss +70 -0
- package/src/react-menu3/styles/theme-dark.scss +30 -0
- package/src/react-menu3/styles/transitions/slide.scss +47 -0
- package/src/react-menu3/utils/constants.ts +63 -0
- package/src/react-menu3/utils/index.ts +4 -0
- package/src/react-menu3/utils/propTypes.ts +61 -0
- package/src/react-menu3/utils/utils.ts +71 -0
- package/src/react-menu3/utils/withHovering.tsx +22 -0
- package/src/stories/components/GridPopoutEditDropDown.stories.tsx +44 -3
- package/src/utils/bearing.ts +7 -4
- 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,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
|
+
};
|
|
@@ -43,6 +43,12 @@ interface ITestRow {
|
|
|
43
43
|
position: string | null;
|
|
44
44
|
position2: string | null;
|
|
45
45
|
position3: string | null;
|
|
46
|
+
position4: ICode | null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
interface ICode {
|
|
50
|
+
code: string;
|
|
51
|
+
desc: string;
|
|
46
52
|
}
|
|
47
53
|
|
|
48
54
|
const GridEditDropDownTemplate: ComponentStory<typeof Grid> = (props: GridProps) => {
|
|
@@ -65,6 +71,14 @@ const GridEditDropDownTemplate: ComponentStory<typeof Grid> = (props: GridProps)
|
|
|
65
71
|
].filter((v) => (filter != null ? v != null && v.toLowerCase().indexOf(filter) === 0 : true));
|
|
66
72
|
}, []);
|
|
67
73
|
|
|
74
|
+
const optionsObjects = useMemo(
|
|
75
|
+
() => [
|
|
76
|
+
{ code: "O1", desc: "Object One" },
|
|
77
|
+
{ code: "O2", desc: "Object Two" },
|
|
78
|
+
],
|
|
79
|
+
[],
|
|
80
|
+
);
|
|
81
|
+
|
|
68
82
|
const columnDefs = useMemo(
|
|
69
83
|
() =>
|
|
70
84
|
[
|
|
@@ -148,15 +162,42 @@ const GridEditDropDownTemplate: ComponentStory<typeof Grid> = (props: GridProps)
|
|
|
148
162
|
options: [null, "Architect", "Developer", "Product Owner", "Scrum Master", "Tester", "(other)"],
|
|
149
163
|
},
|
|
150
164
|
}),
|
|
165
|
+
GridPopoverEditDropDown<ITestRow, ITestRow["position4"]>({
|
|
166
|
+
field: "position4",
|
|
167
|
+
initialWidth: 65,
|
|
168
|
+
maxWidth: 150,
|
|
169
|
+
headerName: "Filtered (object)",
|
|
170
|
+
valueGetter: (params) => params.data.position4?.desc,
|
|
171
|
+
cellEditorParams: {
|
|
172
|
+
multiEdit: true,
|
|
173
|
+
filtered: "local",
|
|
174
|
+
filterPlaceholder: "Filter this",
|
|
175
|
+
options: optionsObjects.map((o) => {
|
|
176
|
+
return { value: o, label: o.desc, disabled: false };
|
|
177
|
+
}),
|
|
178
|
+
},
|
|
179
|
+
}),
|
|
151
180
|
] as ColDef[],
|
|
152
|
-
[optionsFn],
|
|
181
|
+
[optionsFn, optionsObjects],
|
|
153
182
|
);
|
|
154
183
|
|
|
155
184
|
const rowData = useMemo(
|
|
156
185
|
() =>
|
|
157
186
|
[
|
|
158
|
-
{
|
|
159
|
-
|
|
187
|
+
{
|
|
188
|
+
id: 1000,
|
|
189
|
+
position: "Tester",
|
|
190
|
+
position2: "1",
|
|
191
|
+
position3: "Tester",
|
|
192
|
+
position4: { code: "O1", desc: "Object One" },
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
id: 1001,
|
|
196
|
+
position: "Developer",
|
|
197
|
+
position2: "2",
|
|
198
|
+
position3: "Developer",
|
|
199
|
+
position4: { code: "O2", desc: "Object Two" },
|
|
200
|
+
},
|
|
160
201
|
] as ITestRow[],
|
|
161
202
|
[],
|
|
162
203
|
);
|
package/src/utils/bearing.ts
CHANGED
|
@@ -13,6 +13,9 @@ export const bearingCorrectionValueFormatter = (params: ValueFormatterParams): s
|
|
|
13
13
|
if (value == null) {
|
|
14
14
|
return "-";
|
|
15
15
|
}
|
|
16
|
+
if (typeof value === "string") {
|
|
17
|
+
return convertDDToDMS(bearingNumberParser(value), true, true);
|
|
18
|
+
}
|
|
16
19
|
return convertDDToDMS(value, true, true);
|
|
17
20
|
};
|
|
18
21
|
|
|
@@ -47,11 +50,11 @@ export const convertDDToDMS = (dd: number | null, showPositiveSymbol = true, add
|
|
|
47
50
|
if (dd === 0) addTrailingZeros = false;
|
|
48
51
|
|
|
49
52
|
// toFixed rounds parts up greater than 60, which has to be corrected below
|
|
50
|
-
const [bearingWholeString,
|
|
53
|
+
const [bearingWholeString, bearingDecimalString] = dd.toFixed(5).split(".");
|
|
51
54
|
|
|
52
55
|
let bearingWhole = Math.abs(parseInt(bearingWholeString));
|
|
53
|
-
let minNumeric = parseInt(
|
|
54
|
-
let secNumeric = parseInt(
|
|
56
|
+
let minNumeric = parseInt(bearingDecimalString?.substring(0, 2));
|
|
57
|
+
let secNumeric = parseInt(bearingDecimalString?.substring(2, 4));
|
|
55
58
|
|
|
56
59
|
// If the toFixed caused rounding beyond 60 minutes/seconds then apply the carry
|
|
57
60
|
if (secNumeric >= 60) {
|
|
@@ -68,7 +71,7 @@ export const convertDDToDMS = (dd: number | null, showPositiveSymbol = true, add
|
|
|
68
71
|
|
|
69
72
|
const minString = minNumeric.toString().padStart(2, "0");
|
|
70
73
|
const secString = secNumeric.toString().padStart(2, "0");
|
|
71
|
-
const deciSecString =
|
|
74
|
+
const deciSecString = bearingDecimalString?.substring(4, 5);
|
|
72
75
|
|
|
73
76
|
let dmsString = `${showPositiveSymbol && dd > 0 ? "+" : ""}${dd < 0 ? "-" : ""}${bearingWhole}°`;
|
|
74
77
|
if (addTrailingZeros || deciSecString != "0") {
|
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
|
-
|
|
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;
|