@eccenca/gui-elements 23.6.0 → 23.7.0-rc.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.
- package/CHANGELOG.md +22 -0
- package/dist/cjs/cmem/markdown/Markdown.js +10 -2
- package/dist/cjs/cmem/markdown/Markdown.js.map +1 -1
- package/dist/cjs/cmem/react-flow/StickyNoteModal/StickyNoteModal.js +4 -4
- package/dist/cjs/cmem/react-flow/StickyNoteModal/StickyNoteModal.js.map +1 -1
- package/dist/cjs/common/index.js +2 -0
- package/dist/cjs/common/index.js.map +1 -1
- package/dist/cjs/common/utils/getScrollParent.js +24 -0
- package/dist/cjs/common/utils/getScrollParent.js.map +1 -0
- package/dist/cjs/components/AutocompleteField/AutoCompleteField.js +19 -2
- package/dist/cjs/components/AutocompleteField/AutoCompleteField.js.map +1 -1
- package/dist/cjs/components/MultiSelect/MultiSelect.js +66 -41
- package/dist/cjs/components/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/cjs/components/Sticky/StickyTarget.js +85 -0
- package/dist/cjs/components/Sticky/StickyTarget.js.map +1 -0
- package/dist/cjs/components/Sticky/index.js +14 -0
- package/dist/cjs/components/Sticky/index.js.map +1 -0
- package/dist/cjs/components/index.js +1 -0
- package/dist/cjs/components/index.js.map +1 -1
- package/dist/cjs/extensions/codemirror/CodeMirror.js +1 -1
- package/dist/cjs/extensions/codemirror/CodeMirror.js.map +1 -1
- package/dist/cjs/extensions/react-flow/edges/EdgeDefault.js +7 -7
- package/dist/cjs/extensions/react-flow/edges/EdgeDefault.js.map +1 -1
- package/dist/cjs/extensions/react-flow/edges/EdgeLabel.js +3 -2
- package/dist/cjs/extensions/react-flow/edges/EdgeLabel.js.map +1 -1
- package/dist/cjs/extensions/react-flow/handles/HandleContent.js +14 -2
- package/dist/cjs/extensions/react-flow/handles/HandleContent.js.map +1 -1
- package/dist/cjs/extensions/react-flow/handles/HandleTools.js +1 -1
- package/dist/cjs/extensions/react-flow/handles/HandleTools.js.map +1 -1
- package/dist/cjs/extensions/react-flow/minimap/MiniMap.js +6 -8
- package/dist/cjs/extensions/react-flow/minimap/MiniMap.js.map +1 -1
- package/dist/esm/cmem/markdown/Markdown.js +10 -2
- package/dist/esm/cmem/markdown/Markdown.js.map +1 -1
- package/dist/esm/cmem/react-flow/StickyNoteModal/StickyNoteModal.js +5 -5
- package/dist/esm/cmem/react-flow/StickyNoteModal/StickyNoteModal.js.map +1 -1
- package/dist/esm/common/index.js +2 -0
- package/dist/esm/common/index.js.map +1 -1
- package/dist/esm/common/utils/getScrollParent.js +20 -0
- package/dist/esm/common/utils/getScrollParent.js.map +1 -0
- package/dist/esm/components/AutocompleteField/AutoCompleteField.js +27 -2
- package/dist/esm/components/AutocompleteField/AutoCompleteField.js.map +1 -1
- package/dist/esm/components/MultiSelect/MultiSelect.js +72 -52
- package/dist/esm/components/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/esm/components/Sticky/StickyTarget.js +89 -0
- package/dist/esm/components/Sticky/StickyTarget.js.map +1 -0
- package/dist/esm/components/Sticky/index.js +2 -0
- package/dist/esm/components/Sticky/index.js.map +1 -0
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/extensions/codemirror/CodeMirror.js +1 -1
- package/dist/esm/extensions/codemirror/CodeMirror.js.map +1 -1
- package/dist/esm/extensions/react-flow/edges/EdgeDefault.js +7 -7
- package/dist/esm/extensions/react-flow/edges/EdgeDefault.js.map +1 -1
- package/dist/esm/extensions/react-flow/edges/EdgeLabel.js +3 -2
- package/dist/esm/extensions/react-flow/edges/EdgeLabel.js.map +1 -1
- package/dist/esm/extensions/react-flow/handles/HandleContent.js +13 -2
- package/dist/esm/extensions/react-flow/handles/HandleContent.js.map +1 -1
- package/dist/esm/extensions/react-flow/handles/HandleTools.js +1 -1
- package/dist/esm/extensions/react-flow/handles/HandleTools.js.map +1 -1
- package/dist/esm/extensions/react-flow/minimap/MiniMap.js +6 -8
- package/dist/esm/extensions/react-flow/minimap/MiniMap.js.map +1 -1
- package/dist/types/cmem/react-flow/StickyNoteModal/StickyNoteModal.d.ts +5 -0
- package/dist/types/cmem/react-flow/configuration/graph.d.ts +9 -9
- package/dist/types/cmem/react-flow/configuration/unspecified.d.ts +2 -2
- package/dist/types/common/index.d.ts +2 -0
- package/dist/types/common/utils/getScrollParent.d.ts +9 -0
- package/dist/types/components/AutocompleteField/AutoCompleteField.d.ts +2 -0
- package/dist/types/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/dist/types/components/Sticky/StickyTarget.d.ts +32 -0
- package/dist/types/components/Sticky/index.d.ts +1 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/extensions/react-flow/edges/EdgeDefault.d.ts +6 -1
- package/dist/types/extensions/react-flow/edges/EdgeLabel.d.ts +1 -1
- package/dist/types/extensions/react-flow/edges/edgeTypes.d.ts +10 -10
- package/dist/types/extensions/react-flow/handles/HandleContent.d.ts +2 -3
- package/dist/types/extensions/react-flow/minimap/MiniMap.d.ts +12 -1
- package/package.json +3 -1
- package/src/cmem/markdown/Markdown.stories.tsx +8 -1
- package/src/cmem/markdown/Markdown.tsx +22 -1
- package/src/cmem/react-flow/ReactFlow/ReactFlow.stories.tsx +10 -4
- package/src/cmem/react-flow/StickyNoteModal/StickyNoteModal.tsx +8 -3
- package/src/common/index.ts +3 -0
- package/src/common/utils/getScrollParent.ts +20 -0
- package/src/components/AutocompleteField/AutoCompleteField.tsx +28 -0
- package/src/components/AutocompleteField/autocompletefield.scss +1 -1
- package/src/components/MultiSelect/MultiSelect.tsx +72 -47
- package/src/components/MultiSuggestField/MultiSuggestField.stories.tsx +146 -26
- package/src/components/MultiSuggestField/tests/MultiSuggestField.test.tsx +363 -61
- package/src/components/Sticky/StickyTarget.tsx +119 -0
- package/src/components/Sticky/index.ts +1 -0
- package/src/components/Sticky/sticky.scss +69 -0
- package/src/components/Sticky/stories/StickyTarget.stories.tsx +63 -0
- package/src/components/index.scss +1 -0
- package/src/components/index.ts +1 -0
- package/src/extensions/codemirror/CodeMirror.tsx +1 -1
- package/src/extensions/react-flow/edges/EdgeDefault.tsx +70 -62
- package/src/extensions/react-flow/edges/EdgeLabel.tsx +14 -2
- package/src/extensions/react-flow/edges/stories/EdgeDefault.stories.tsx +11 -5
- package/src/extensions/react-flow/edges/stories/EdgeLabel.stories.tsx +2 -0
- package/src/extensions/react-flow/handles/HandleContent.tsx +28 -25
- package/src/extensions/react-flow/handles/HandleTools.tsx +1 -0
- package/src/extensions/react-flow/handles/stories/HandleDefault.stories.tsx +5 -1
- package/src/extensions/react-flow/minimap/MiniMap.stories.tsx +62 -0
- package/src/extensions/react-flow/minimap/MiniMap.tsx +23 -7
- package/src/extensions/react-flow/nodes/stories/NodeContent.stories.tsx +2 -0
- package/src/extensions/react-flow/nodes/stories/NodeContentExtension.stories.tsx +2 -0
- package/src/extensions/react-flow/nodes/stories/NodeDefault.stories.tsx +0 -1
|
@@ -30,7 +30,8 @@ var minimapCalcConf = {
|
|
|
30
30
|
};
|
|
31
31
|
/** An improved mini-map for react-flow that supports navigation via the mini-map. */
|
|
32
32
|
export var MiniMap = memo(function (_a) {
|
|
33
|
-
var
|
|
33
|
+
var _b;
|
|
34
|
+
var flowInstance = _a.flowInstance, _c = _a.enableNavigation, enableNavigation = _c === void 0 ? false : _c, _d = _a.maskColor, maskColor = _d === void 0 ? "#ddddddbb" : _d, _e = _a.nodeClassName, nodeClassName = _e === void 0 ? miniMapUtils.nodeClassName : _e, _f = _a.nodeColor, nodeColor = _f === void 0 ? miniMapUtils.nodeColor : _f, _g = _a.nodeStrokeColor, nodeStrokeColor = _g === void 0 ? miniMapUtils.borderColor : _g, wrapperProps = _a.wrapperProps, minimapProps = __rest(_a, ["flowInstance", "enableNavigation", "maskColor", "nodeClassName", "nodeColor", "nodeStrokeColor", "wrapperProps"]);
|
|
34
35
|
var minimapWrapper = React.useRef(null);
|
|
35
36
|
useEffect(function () {
|
|
36
37
|
var minimapDiv = minimapWrapper.current;
|
|
@@ -78,22 +79,19 @@ export var MiniMap = memo(function (_a) {
|
|
|
78
79
|
flowInstance.setTransform(canvasNewState);
|
|
79
80
|
}
|
|
80
81
|
};
|
|
81
|
-
|
|
82
|
-
sets the view for the user when clicked and finish navigation
|
|
83
|
-
**/
|
|
82
|
+
// sets the view for the user when clicked and finish navigation
|
|
84
83
|
var handleMiniMapMouseUp = function (event) {
|
|
85
84
|
handleMiniMapMouseMove(event);
|
|
86
85
|
minimapCalcConf.navigationOn = false;
|
|
87
86
|
};
|
|
88
|
-
|
|
89
|
-
enables the mini-map fake drag effect see "handleMiniMapMouseMove" above.
|
|
90
|
-
**/
|
|
87
|
+
// enables the mini-map fake drag effect see "handleMiniMapMouseMove" above.
|
|
91
88
|
var handleMiniMapMouseDown = function () {
|
|
92
89
|
if (enableNavigation && flowInstance) {
|
|
93
90
|
minimapCalcConf.navigationOn = true;
|
|
94
91
|
}
|
|
95
92
|
};
|
|
96
|
-
return (React.createElement("div", { ref: minimapWrapper, onMouseDown: handleMiniMapMouseDown, onMouseUp: handleMiniMapMouseUp, onMouseMove: handleMiniMapMouseMove, onMouseLeave: handleMiniMapMouseUp,
|
|
93
|
+
return (React.createElement("div", __assign({ ref: minimapWrapper, onMouseDown: handleMiniMapMouseDown, onMouseUp: handleMiniMapMouseUp, onMouseMove: handleMiniMapMouseMove, onMouseLeave: handleMiniMapMouseUp }, wrapperProps, { style: flowInstance && enableNavigation
|
|
94
|
+
? __assign(__assign({}, ((_b = wrapperProps === null || wrapperProps === void 0 ? void 0 : wrapperProps.style) !== null && _b !== void 0 ? _b : {})), { cursor: "grab" }) : wrapperProps === null || wrapperProps === void 0 ? void 0 : wrapperProps.style }),
|
|
97
95
|
React.createElement(ReactFlowMiniMap, __assign({ maskColor: maskColor, nodeClassName: nodeClassName, nodeColor: nodeColor, nodeStrokeColor: nodeStrokeColor }, minimapProps))));
|
|
98
96
|
});
|
|
99
97
|
//# sourceMappingURL=MiniMap.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MiniMap.js","sourceRoot":"","sources":["../../../../../src/extensions/react-flow/minimap/MiniMap.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAuD,MAAM,qBAAqB,CAAC;AAGvH,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"MiniMap.js","sourceRoot":"","sources":["../../../../../src/extensions/react-flow/minimap/MiniMap.tsx"],"names":[],"mappings":"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"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { SimpleDialogProps } from "./../../../index";
|
|
2
3
|
export declare type StickyNoteModalTranslationKeys = "modalTitle" | "noteLabel" | "colorLabel" | "saveButton" | "cancelButton";
|
|
3
4
|
export declare type StickyNoteMetadataType = {
|
|
4
5
|
note: string;
|
|
@@ -22,5 +23,9 @@ export interface StickyNoteModalProps {
|
|
|
22
23
|
* translation utility for language compatibility
|
|
23
24
|
*/
|
|
24
25
|
translate: (key: StickyNoteModalTranslationKeys) => string;
|
|
26
|
+
/**
|
|
27
|
+
* Forward other properties to the `SimpleModal` element that is used for this dialog.
|
|
28
|
+
*/
|
|
29
|
+
simpleDialogProps?: Omit<SimpleDialogProps, "size" | "title" | "hasBorder" | "isOpen" | "onClose" | "actions">;
|
|
25
30
|
}
|
|
26
31
|
export declare const StickyNoteModal: React.FC<StickyNoteModalProps>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { GRAPH_NODE_TYPES } from "./typing";
|
|
3
3
|
declare const edgeTypes: {
|
|
4
|
-
default: import("react").MemoExoticComponent<(
|
|
5
|
-
implicit: import("react").MemoExoticComponent<(
|
|
6
|
-
import: import("react").MemoExoticComponent<(
|
|
7
|
-
subclass: import("react").MemoExoticComponent<(
|
|
8
|
-
subproperty: import("react").MemoExoticComponent<(
|
|
9
|
-
rdftype: import("react").MemoExoticComponent<(
|
|
10
|
-
success: import("react").MemoExoticComponent<(
|
|
11
|
-
warning: import("react").MemoExoticComponent<(
|
|
12
|
-
danger: import("react").MemoExoticComponent<(
|
|
4
|
+
default: import("react").MemoExoticComponent<({ data, drawSvgPath, ...edgeOriginalProperties }: import("./../../../extensions/react-flow/edges/EdgeDefault").EdgeDefaultProps) => import("react").JSX.Element>;
|
|
5
|
+
implicit: import("react").MemoExoticComponent<({ data, drawSvgPath, ...edgeOriginalProperties }: import("./../../../extensions/react-flow/edges/EdgeDefault").EdgeDefaultProps) => import("react").JSX.Element>;
|
|
6
|
+
import: import("react").MemoExoticComponent<({ data, drawSvgPath, ...edgeOriginalProperties }: import("./../../../extensions/react-flow/edges/EdgeDefault").EdgeDefaultProps) => import("react").JSX.Element>;
|
|
7
|
+
subclass: import("react").MemoExoticComponent<({ data, drawSvgPath, ...edgeOriginalProperties }: import("./../../../extensions/react-flow/edges/EdgeDefault").EdgeDefaultProps) => import("react").JSX.Element>;
|
|
8
|
+
subproperty: import("react").MemoExoticComponent<({ data, drawSvgPath, ...edgeOriginalProperties }: import("./../../../extensions/react-flow/edges/EdgeDefault").EdgeDefaultProps) => import("react").JSX.Element>;
|
|
9
|
+
rdftype: import("react").MemoExoticComponent<({ data, drawSvgPath, ...edgeOriginalProperties }: import("./../../../extensions/react-flow/edges/EdgeDefault").EdgeDefaultProps) => import("react").JSX.Element>;
|
|
10
|
+
success: import("react").MemoExoticComponent<({ data, drawSvgPath, ...edgeOriginalProperties }: import("./../../../extensions/react-flow/edges/EdgeDefault").EdgeDefaultProps) => import("react").JSX.Element>;
|
|
11
|
+
warning: import("react").MemoExoticComponent<({ data, drawSvgPath, ...edgeOriginalProperties }: import("./../../../extensions/react-flow/edges/EdgeDefault").EdgeDefaultProps) => import("react").JSX.Element>;
|
|
12
|
+
danger: import("react").MemoExoticComponent<({ data, drawSvgPath, ...edgeOriginalProperties }: import("./../../../extensions/react-flow/edges/EdgeDefault").EdgeDefaultProps) => import("react").JSX.Element>;
|
|
13
13
|
};
|
|
14
14
|
declare const nodeTypes: Record<GRAPH_NODE_TYPES, React.ReactNode>;
|
|
15
15
|
export { edgeTypes, nodeTypes };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const edgeTypes: {
|
|
3
|
-
default: import("react").MemoExoticComponent<(
|
|
4
|
-
straight: import("react").MemoExoticComponent<(
|
|
3
|
+
default: import("react").MemoExoticComponent<({ data, drawSvgPath, ...edgeOriginalProperties }: import("./../../../extensions/react-flow/edges/EdgeDefault").EdgeDefaultProps) => import("react").JSX.Element>;
|
|
4
|
+
straight: import("react").MemoExoticComponent<({ data, drawSvgPath, ...edgeOriginalProperties }: import("./../../../extensions/react-flow/edges/EdgeDefault").EdgeDefaultProps) => import("react").JSX.Element>;
|
|
5
5
|
step: import("react").MemoExoticComponent<(edge: import("./../../../extensions/react-flow/edges/EdgeStep").EdgeStepProps) => import("react").JSX.Element>;
|
|
6
6
|
};
|
|
7
7
|
export declare const nodeTypes: {
|
|
@@ -21,6 +21,7 @@ export declare const utils: {
|
|
|
21
21
|
};
|
|
22
22
|
getGlobalVar: (varname: string) => Window;
|
|
23
23
|
setGlobalVar: (varname: string, value: any) => any;
|
|
24
|
+
getScrollParent: (element: Element) => false | HTMLElement;
|
|
24
25
|
};
|
|
25
26
|
export declare const Utilities: {
|
|
26
27
|
openInNewTab: (event: import("react").MouseEvent<HTMLAnchorElement, MouseEvent>, handler?: ((e: import("react").MouseEvent<HTMLAnchorElement, MouseEvent>) => void) | undefined, url?: string | undefined) => void;
|
|
@@ -44,4 +45,5 @@ export declare const Utilities: {
|
|
|
44
45
|
};
|
|
45
46
|
getGlobalVar: (varname: string) => Window;
|
|
46
47
|
setGlobalVar: (varname: string, value: any) => any;
|
|
48
|
+
getScrollParent: (element: Element) => false | HTMLElement;
|
|
47
49
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Find the scroll parent of an element, returns `false` if it cannot be found.
|
|
3
|
+
* In case of a `false` return the very probably `document.documentElement` is the parent.
|
|
4
|
+
* In this case `window` object should be used for scroll event listeners.
|
|
5
|
+
* See `src/components/Sticky/StickyTarget.tsx` for an usage example.
|
|
6
|
+
* @param element
|
|
7
|
+
* @returns HTMLElement | false
|
|
8
|
+
*/
|
|
9
|
+
export declare const getScrollParent: (element: Element) => HTMLElement | false;
|
|
@@ -109,6 +109,8 @@ export interface AutoCompleteFieldProps<T, UPDATE_VALUE> {
|
|
|
109
109
|
* Use the full available width of the parent container.
|
|
110
110
|
*/
|
|
111
111
|
fill?: boolean;
|
|
112
|
+
/** Utility that fetches more options when clicked*/
|
|
113
|
+
loadMoreResults?: () => Promise<T[]>;
|
|
112
114
|
}
|
|
113
115
|
export declare type IAutoCompleteFieldProps<T, UPDATE_VALUE> = AutoCompleteFieldProps<T, UPDATE_VALUE>;
|
|
114
116
|
/**
|
|
@@ -4,7 +4,7 @@ import { MultiSelect as BlueprintMultiSelect, MultiSelectProps as BlueprintMulti
|
|
|
4
4
|
import { TestableComponent } from "../interfaces";
|
|
5
5
|
import { ContextOverlayProps } from "./../../index";
|
|
6
6
|
export interface MultiSelectSelectionProps<T> {
|
|
7
|
-
newlySelected
|
|
7
|
+
newlySelected?: T;
|
|
8
8
|
selectedItems: T[];
|
|
9
9
|
createdItems: Partial<T>[];
|
|
10
10
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface StickyTargetProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/**
|
|
4
|
+
* Set the side the element need to be sticky on.
|
|
5
|
+
*/
|
|
6
|
+
to?: "top" | "bottom";
|
|
7
|
+
/**
|
|
8
|
+
* The sticky area is positioned relatively to a local scroll area.
|
|
9
|
+
* The application header is not taken into offset calculation
|
|
10
|
+
*/
|
|
11
|
+
local?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Set the background color used for the sticky area.
|
|
14
|
+
* As it can overlay other content readability could be harmed if the overlayed content is shining through.
|
|
15
|
+
*/
|
|
16
|
+
background?: "card" | "application" | "transparent";
|
|
17
|
+
/**
|
|
18
|
+
* Set additional distance to original sticky position.
|
|
19
|
+
*/
|
|
20
|
+
offset?: `${number}${string}`;
|
|
21
|
+
/**
|
|
22
|
+
* Callback that returns an DOM element.
|
|
23
|
+
* The position of `StickyTarget` is then calculated relative to that element.
|
|
24
|
+
*/
|
|
25
|
+
getConnectedElement?: (ref: React.MutableRefObject<HTMLDivElement | null>) => Element | false;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Element wraps the content that need to be displayed sticky.
|
|
29
|
+
* The content then offset relative to its nearest scrolling ancestor and containing block (nearest block-level ancestor).
|
|
30
|
+
*/
|
|
31
|
+
export declare const StickyTarget: ({ className, to, local, background, offset, style, getConnectedElement, ...otherDivProps }: StickyTargetProps) => React.JSX.Element;
|
|
32
|
+
export default StickyTarget;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./StickyTarget";
|
|
@@ -36,6 +36,7 @@ export * from "./Separation/Divider";
|
|
|
36
36
|
export * from "./Separation/Spacing";
|
|
37
37
|
export * from "./Skeleton/Skeleton";
|
|
38
38
|
export * from "./Spinner/Spinner";
|
|
39
|
+
export * from "./Sticky";
|
|
39
40
|
export * from "./Structure";
|
|
40
41
|
export * from "./Switch/Switch";
|
|
41
42
|
export * from "./Table";
|
|
@@ -28,6 +28,11 @@ export interface EdgeDefaultDataProps {
|
|
|
28
28
|
* Callback handler that returns a React element used as edge title.
|
|
29
29
|
*/
|
|
30
30
|
renderLabel?: (edgeCenter: [number, number, number, number]) => React.ReactNode;
|
|
31
|
+
/**
|
|
32
|
+
* Properties are forwarded to the internally used SVG `g` element.
|
|
33
|
+
* Data attributes for test ids coud be included here.
|
|
34
|
+
*/
|
|
35
|
+
edgeSvgProps?: React.SVGProps<SVGGElement>;
|
|
31
36
|
}
|
|
32
37
|
export interface EdgeDefaultProps extends ReactFlowEdgeProps {
|
|
33
38
|
/**
|
|
@@ -39,7 +44,7 @@ export interface EdgeDefaultProps extends ReactFlowEdgeProps {
|
|
|
39
44
|
*/
|
|
40
45
|
drawSvgPath?: (edge: ReactFlowEdgeProps) => string;
|
|
41
46
|
}
|
|
42
|
-
export declare const EdgeDefault: React.MemoExoticComponent<(
|
|
47
|
+
export declare const EdgeDefault: React.MemoExoticComponent<({ data, drawSvgPath, ...edgeOriginalProperties }: EdgeDefaultProps) => React.JSX.Element>;
|
|
43
48
|
export declare const edgeDefaultUtils: {
|
|
44
49
|
createEdgeDefaultClassName: ({ strokeType, intent, highlightColor }: EdgeDefaultDataProps, baseClass?: string) => string;
|
|
45
50
|
drawEdgeStep: ({ sourceX, sourceY, sourcePosition, targetX, targetY, targetPosition, data, }: import("./EdgeStep").EdgeStepProps) => string;
|
|
@@ -33,7 +33,7 @@ export interface EdgeLabelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
33
33
|
*/
|
|
34
34
|
intent?: IntentTypes;
|
|
35
35
|
}
|
|
36
|
-
export declare const EdgeLabel: React.MemoExoticComponent<({ depiction, text, actions, large, fullWidth, loose, intent, title, ...otherDivProps }: EdgeLabelProps) => React.JSX.Element>;
|
|
36
|
+
export declare const EdgeLabel: React.MemoExoticComponent<({ depiction, text, actions, large, fullWidth, loose, intent, title, className, ...otherDivProps }: EdgeLabelProps) => React.JSX.Element>;
|
|
37
37
|
export interface EdgeLabelObjectProps extends React.SVGAttributes<SVGForeignObjectElement> {
|
|
38
38
|
/**
|
|
39
39
|
* The `<EdgeLabel />` element that need to be displayed.
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const edgeTypes: {
|
|
3
|
-
default: import("react").MemoExoticComponent<(
|
|
4
|
-
straight: import("react").MemoExoticComponent<(
|
|
3
|
+
default: import("react").MemoExoticComponent<({ data, drawSvgPath, ...edgeOriginalProperties }: import("./EdgeDefault").EdgeDefaultProps) => import("react").JSX.Element>;
|
|
4
|
+
straight: import("react").MemoExoticComponent<({ data, drawSvgPath, ...edgeOriginalProperties }: import("./EdgeDefault").EdgeDefaultProps) => import("react").JSX.Element>;
|
|
5
5
|
step: import("react").MemoExoticComponent<(edge: import("./EdgeStep").EdgeStepProps) => import("react").JSX.Element>;
|
|
6
|
-
success: import("react").MemoExoticComponent<(
|
|
7
|
-
warning: import("react").MemoExoticComponent<(
|
|
8
|
-
danger: import("react").MemoExoticComponent<(
|
|
9
|
-
implicit: import("react").MemoExoticComponent<(
|
|
10
|
-
import: import("react").MemoExoticComponent<(
|
|
11
|
-
subclass: import("react").MemoExoticComponent<(
|
|
12
|
-
subproperty: import("react").MemoExoticComponent<(
|
|
13
|
-
rdftype: import("react").MemoExoticComponent<(
|
|
6
|
+
success: import("react").MemoExoticComponent<({ data, drawSvgPath, ...edgeOriginalProperties }: import("./EdgeDefault").EdgeDefaultProps) => import("react").JSX.Element>;
|
|
7
|
+
warning: import("react").MemoExoticComponent<({ data, drawSvgPath, ...edgeOriginalProperties }: import("./EdgeDefault").EdgeDefaultProps) => import("react").JSX.Element>;
|
|
8
|
+
danger: import("react").MemoExoticComponent<({ data, drawSvgPath, ...edgeOriginalProperties }: import("./EdgeDefault").EdgeDefaultProps) => import("react").JSX.Element>;
|
|
9
|
+
implicit: import("react").MemoExoticComponent<({ data, drawSvgPath, ...edgeOriginalProperties }: import("./EdgeDefault").EdgeDefaultProps) => import("react").JSX.Element>;
|
|
10
|
+
import: import("react").MemoExoticComponent<({ data, drawSvgPath, ...edgeOriginalProperties }: import("./EdgeDefault").EdgeDefaultProps) => import("react").JSX.Element>;
|
|
11
|
+
subclass: import("react").MemoExoticComponent<({ data, drawSvgPath, ...edgeOriginalProperties }: import("./EdgeDefault").EdgeDefaultProps) => import("react").JSX.Element>;
|
|
12
|
+
subproperty: import("react").MemoExoticComponent<({ data, drawSvgPath, ...edgeOriginalProperties }: import("./EdgeDefault").EdgeDefaultProps) => import("react").JSX.Element>;
|
|
13
|
+
rdftype: import("react").MemoExoticComponent<({ data, drawSvgPath, ...edgeOriginalProperties }: import("./EdgeDefault").EdgeDefaultProps) => import("react").JSX.Element>;
|
|
14
14
|
value: import("react").MemoExoticComponent<(edge: import("./EdgeStep").EdgeStepProps) => import("react").JSX.Element>;
|
|
15
15
|
score: import("react").MemoExoticComponent<(edge: import("./EdgeStep").EdgeStepProps) => import("react").JSX.Element>;
|
|
16
16
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { TooltipProps } from "../../../index";
|
|
3
|
-
export interface HandleContentProps {
|
|
4
|
-
children?: JSX.Element | string;
|
|
3
|
+
export interface HandleContentProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "className"> {
|
|
5
4
|
/**
|
|
6
5
|
* Tooltip displayed as overlay on hover.
|
|
7
6
|
*/
|
|
@@ -11,4 +10,4 @@ export interface HandleContentProps {
|
|
|
11
10
|
*/
|
|
12
11
|
tooltipProps?: Omit<TooltipProps, "content" | "children" | "renderTarget">;
|
|
13
12
|
}
|
|
14
|
-
export declare const HandleContent: React.MemoExoticComponent<({ children, extendedTooltip, tooltipProps }: HandleContentProps) => React.JSX.Element>;
|
|
13
|
+
export declare const HandleContent: React.MemoExoticComponent<({ children, extendedTooltip, tooltipProps, ...otherDivProps }: HandleContentProps) => React.JSX.Element>;
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { MiniMapProps as ReactFlowMiniMapProps, OnLoadParams } from "react-flow-renderer";
|
|
3
3
|
export interface MiniMapProps extends ReactFlowMiniMapProps {
|
|
4
|
+
/**
|
|
5
|
+
* React-Flow instance
|
|
6
|
+
*/
|
|
4
7
|
flowInstance?: OnLoadParams;
|
|
8
|
+
/**
|
|
9
|
+
* Enable navigating the react-flow canvas by dragging and clicking on the mini-map.
|
|
10
|
+
*/
|
|
5
11
|
enableNavigation?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Properties are forwarded to the HTML `div` element used as minimap wrapper.
|
|
14
|
+
* Data attributes for test ids coud be included here.
|
|
15
|
+
*/
|
|
16
|
+
wrapperProps?: Omit<React.HTMLAttributes<HTMLDivElement>, "onMouseDown" | "onMouseUp" | "onMouseMove" | "onMouseLeave">;
|
|
6
17
|
}
|
|
7
18
|
/** An improved mini-map for react-flow that supports navigation via the mini-map. */
|
|
8
|
-
export declare const MiniMap: React.MemoExoticComponent<({ flowInstance, enableNavigation, maskColor, nodeClassName, nodeColor, nodeStrokeColor, ...minimapProps }: MiniMapProps) => React.JSX.Element>;
|
|
19
|
+
export declare const MiniMap: React.MemoExoticComponent<({ flowInstance, enableNavigation, maskColor, nodeClassName, nodeColor, nodeStrokeColor, wrapperProps, ...minimapProps }: MiniMapProps) => React.JSX.Element>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eccenca/gui-elements",
|
|
3
3
|
"description": "GUI elements based on other libraries, usable in React application, written in Typescript.",
|
|
4
|
-
"version": "23.
|
|
4
|
+
"version": "23.7.0-rc.1",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/eccenca/gui-elements",
|
|
7
7
|
"bugs": "https://github.com/eccenca/gui-elements/issues",
|
|
@@ -85,6 +85,7 @@
|
|
|
85
85
|
"react-flow-renderer-lts": "npm:react-flow-renderer@^10.3.17",
|
|
86
86
|
"react-inlinesvg": "^3.0.3",
|
|
87
87
|
"react-markdown": "^8.0.7",
|
|
88
|
+
"react-syntax-highlighter": "15.5.0",
|
|
88
89
|
"rehype-raw": "^6.1.1",
|
|
89
90
|
"remark-definition-list": "^1.2.0",
|
|
90
91
|
"remark-gfm": "^3.0.1",
|
|
@@ -117,6 +118,7 @@
|
|
|
117
118
|
"@types/color": "^3.0.6",
|
|
118
119
|
"@types/jest": "^29.5.12",
|
|
119
120
|
"@types/lodash": "^4.14.202",
|
|
121
|
+
"@types/react-syntax-highlighter": "15.5.11",
|
|
120
122
|
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
|
121
123
|
"@typescript-eslint/parser": "^5.62.0",
|
|
122
124
|
"babel-jest": "^29.7.0",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { Blockquote } from "@blueprintjs/core";
|
|
2
3
|
import { ComponentMeta, ComponentStory } from "@storybook/react";
|
|
3
4
|
|
|
4
5
|
import { Markdown } from "./../../../index";
|
|
@@ -44,11 +45,17 @@ This is a paragraph with a [text link](http://example.com/) and a footnote refer
|
|
|
44
45
|
##### Headline level 5
|
|
45
46
|
###### Headline level 6
|
|
46
47
|
|
|
47
|
-
This is a code block.
|
|
48
|
+
This is a code block.
|
|
49
|
+
|
|
50
|
+
\`\`\`
|
|
51
|
+
another code block
|
|
52
|
+
{{templateVar}}
|
|
53
|
+
\`\`\`
|
|
48
54
|
|
|
49
55
|
> This is a block quote.
|
|
50
56
|
>
|
|
51
57
|
> With 2 paragraphs.
|
|
58
|
+
> And some code like \`{{showThisNotItsValue}}\`
|
|
52
59
|
|
|
53
60
|
A line with some <strong>HTML code</strong> inside.
|
|
54
61
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import ReactMarkdown from "react-markdown";
|
|
3
3
|
import { PluggableList } from "react-markdown/lib/react-markdown";
|
|
4
|
-
|
|
4
|
+
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
|
|
5
|
+
import { materialLight } from "react-syntax-highlighter/dist/esm/styles/prism";
|
|
6
|
+
// @ts-expect-error: No declaration file for module
|
|
5
7
|
import remarkTypograf from "@mavrin/remark-typograf";
|
|
6
8
|
import rehypeRaw from "rehype-raw";
|
|
7
9
|
import { remarkDefinitionList } from "remark-definition-list";
|
|
@@ -132,6 +134,25 @@ export const Markdown = ({
|
|
|
132
134
|
return linkTarget as React.HTMLAttributeAnchorTarget;
|
|
133
135
|
}
|
|
134
136
|
: undefined,
|
|
137
|
+
components: {
|
|
138
|
+
code(props: any) {
|
|
139
|
+
const { children, className, node, ...rest } = props;
|
|
140
|
+
const match = /language-(\w+)/.exec(className || "");
|
|
141
|
+
return match ? (
|
|
142
|
+
<SyntaxHighlighter
|
|
143
|
+
{...rest}
|
|
144
|
+
PreTag="div"
|
|
145
|
+
children={String(children).replace(/\n$/, "")}
|
|
146
|
+
language={match[1]}
|
|
147
|
+
style={materialLight}
|
|
148
|
+
/>
|
|
149
|
+
) : (
|
|
150
|
+
<code {...rest} className={className}>
|
|
151
|
+
{children}
|
|
152
|
+
</code>
|
|
153
|
+
);
|
|
154
|
+
},
|
|
155
|
+
},
|
|
135
156
|
};
|
|
136
157
|
allowedElements && (reactMarkdownProperties.allowedElements = allowedElements);
|
|
137
158
|
reHypePlugins &&
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { FC, useCallback, useEffect, useState } from "react";
|
|
2
2
|
import { Elements, FlowElement } from "react-flow-renderer";
|
|
3
|
-
import {
|
|
3
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
4
4
|
|
|
5
5
|
import { EdgeTools, NodeTools, ReactFlow } from "./../../../index";
|
|
6
6
|
import { ReactFlowProps } from "./ReactFlow";
|
|
@@ -361,7 +361,7 @@ export default {
|
|
|
361
361
|
options: Object.keys(nodeExamples),
|
|
362
362
|
},
|
|
363
363
|
},
|
|
364
|
-
} as
|
|
364
|
+
} as Meta<typeof ReactFlow>;
|
|
365
365
|
|
|
366
366
|
const ReactFlowExample: FC<ReactFlowProps> = (args) => {
|
|
367
367
|
const [reactflowInstance, setReactflowInstance] = useState(null);
|
|
@@ -402,10 +402,13 @@ const ReactFlowExample: FC<ReactFlowProps> = (args) => {
|
|
|
402
402
|
[reactflowInstance]
|
|
403
403
|
);
|
|
404
404
|
|
|
405
|
+
const { configuration, ...otherArgs } = args;
|
|
406
|
+
|
|
405
407
|
return (
|
|
406
408
|
<>
|
|
407
409
|
<ReactFlow
|
|
408
|
-
|
|
410
|
+
{...otherArgs}
|
|
411
|
+
configuration={configuration}
|
|
409
412
|
elements={elements}
|
|
410
413
|
style={{ height: "400px" }}
|
|
411
414
|
onLoad={onLoad}
|
|
@@ -418,9 +421,12 @@ const ReactFlowExample: FC<ReactFlowProps> = (args) => {
|
|
|
418
421
|
);
|
|
419
422
|
};
|
|
420
423
|
|
|
421
|
-
const Template:
|
|
424
|
+
const Template: StoryFn<typeof ReactFlow> = (args) => <ReactFlowExample {...args} />;
|
|
422
425
|
|
|
423
426
|
export const Default = Template.bind({});
|
|
424
427
|
Default.args = {
|
|
425
428
|
configuration: "unspecified",
|
|
429
|
+
"data-test-id": "reactflow-test-id",
|
|
430
|
+
"data-testid": "reactflow-testid",
|
|
426
431
|
};
|
|
432
|
+
Default.nodeExamples = nodeExamples;
|
|
@@ -4,7 +4,7 @@ import getColorConfiguration from "../../../common/utils/getColorConfiguration";
|
|
|
4
4
|
import { CodeEditor } from "../../../extensions";
|
|
5
5
|
import { ReactFlowHotkeyContext } from "../extensions/ReactFlowHotkeyContext";
|
|
6
6
|
|
|
7
|
-
import { Button, FieldItem, Icon, SimpleDialog, Tag, TagList } from "./../../../index";
|
|
7
|
+
import { Button, FieldItem, Icon, SimpleDialog, SimpleDialogProps, Tag, TagList } from "./../../../index";
|
|
8
8
|
|
|
9
9
|
export type StickyNoteModalTranslationKeys = "modalTitle" | "noteLabel" | "colorLabel" | "saveButton" | "cancelButton";
|
|
10
10
|
|
|
@@ -28,10 +28,14 @@ export interface StickyNoteModalProps {
|
|
|
28
28
|
* translation utility for language compatibility
|
|
29
29
|
*/
|
|
30
30
|
translate: (key: StickyNoteModalTranslationKeys) => string;
|
|
31
|
+
/**
|
|
32
|
+
* Forward other properties to the `SimpleModal` element that is used for this dialog.
|
|
33
|
+
*/
|
|
34
|
+
simpleDialogProps?: Omit<SimpleDialogProps, "size" | "title" | "hasBorder" | "isOpen" | "onClose" | "actions">;
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
export const StickyNoteModal: React.FC<StickyNoteModalProps> = React.memo(
|
|
34
|
-
({ metaData, onClose, onSubmit, translate }) => {
|
|
38
|
+
({ metaData, onClose, onSubmit, translate, simpleDialogProps }) => {
|
|
35
39
|
const refNote = React.useRef<string>(metaData?.note ?? "");
|
|
36
40
|
const [color, setSelectedColor] = React.useState<string>(metaData?.color ?? "");
|
|
37
41
|
const noteColors: [string, string][] = Object.entries(getColorConfiguration("stickynotes")).map(
|
|
@@ -79,7 +83,6 @@ export const StickyNoteModal: React.FC<StickyNoteModalProps> = React.memo(
|
|
|
79
83
|
|
|
80
84
|
return (
|
|
81
85
|
<SimpleDialog
|
|
82
|
-
data-test-id={"sticky-note-modal"}
|
|
83
86
|
size="small"
|
|
84
87
|
title={translate("modalTitle")}
|
|
85
88
|
hasBorder
|
|
@@ -101,6 +104,8 @@ export const StickyNoteModal: React.FC<StickyNoteModalProps> = React.memo(
|
|
|
101
104
|
{translate("cancelButton")}
|
|
102
105
|
</Button>,
|
|
103
106
|
]}
|
|
107
|
+
{...simpleDialogProps}
|
|
108
|
+
data-test-id={(simpleDialogProps ?? {})["data-test-id"] ?? "sticky-note-modal"} // @deprecated we remove this automatically set testid with the next major release
|
|
104
109
|
>
|
|
105
110
|
<FieldItem
|
|
106
111
|
key="note"
|
package/src/common/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { invisibleZeroWidthCharacters } from "./utils/characters";
|
|
2
2
|
import decideContrastColorValue from "./utils/colorDecideContrastvalue";
|
|
3
3
|
import getColorConfiguration from "./utils/getColorConfiguration";
|
|
4
|
+
import { getScrollParent } from "./utils/getScrollParent";
|
|
4
5
|
import { getGlobalVar, setGlobalVar } from "./utils/globalVars";
|
|
5
6
|
import { openInNewTab } from "./utils/openInNewTab";
|
|
6
7
|
|
|
@@ -11,6 +12,8 @@ export const utils = {
|
|
|
11
12
|
invisibleZeroWidthCharacters,
|
|
12
13
|
getGlobalVar,
|
|
13
14
|
setGlobalVar,
|
|
15
|
+
getScrollParent,
|
|
14
16
|
};
|
|
17
|
+
|
|
15
18
|
// @deprecated use `utils`
|
|
16
19
|
export const Utilities = utils;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Find the scroll parent of an element, returns `false` if it cannot be found.
|
|
3
|
+
* In case of a `false` return the very probably `document.documentElement` is the parent.
|
|
4
|
+
* In this case `window` object should be used for scroll event listeners.
|
|
5
|
+
* See `src/components/Sticky/StickyTarget.tsx` for an usage example.
|
|
6
|
+
* @param element
|
|
7
|
+
* @returns HTMLElement | false
|
|
8
|
+
*/
|
|
9
|
+
export const getScrollParent = (element: Element): HTMLElement | false => {
|
|
10
|
+
let scrollParent = element.parentElement;
|
|
11
|
+
while (scrollParent) {
|
|
12
|
+
const { overflow } = window.getComputedStyle(scrollParent);
|
|
13
|
+
if (overflow.split(" ").every((value) => value === "auto" || value === "scroll")) {
|
|
14
|
+
return scrollParent;
|
|
15
|
+
}
|
|
16
|
+
scrollParent = scrollParent.parentElement;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return false;
|
|
20
|
+
};
|
|
@@ -156,6 +156,8 @@ export interface AutoCompleteFieldProps<T, UPDATE_VALUE> {
|
|
|
156
156
|
* Use the full available width of the parent container.
|
|
157
157
|
*/
|
|
158
158
|
fill?: boolean;
|
|
159
|
+
/** Utility that fetches more options when clicked*/
|
|
160
|
+
loadMoreResults?: () => Promise<T[]>;
|
|
159
161
|
}
|
|
160
162
|
|
|
161
163
|
export type IAutoCompleteFieldProps<T, UPDATE_VALUE> = AutoCompleteFieldProps<T, UPDATE_VALUE>;
|
|
@@ -195,6 +197,7 @@ export function AutoCompleteField<T, UPDATE_VALUE>(props: AutoCompleteFieldProps
|
|
|
195
197
|
requestErrorPrefix,
|
|
196
198
|
hasBackDrop,
|
|
197
199
|
fill,
|
|
200
|
+
loadMoreResults,
|
|
198
201
|
...otherProps
|
|
199
202
|
} = props;
|
|
200
203
|
const [selectedItem, setSelectedItem] = useState<T | undefined>(initialValue);
|
|
@@ -334,6 +337,7 @@ export function AutoCompleteField<T, UPDATE_VALUE>(props: AutoCompleteFieldProps
|
|
|
334
337
|
disabled: modifiers.disabled,
|
|
335
338
|
highlightingEnabled: highlightingEnabled,
|
|
336
339
|
};
|
|
340
|
+
|
|
337
341
|
const renderedItem = itemRenderer(item, query, relevantModifiers, handleClick);
|
|
338
342
|
if (typeof renderedItem === "string") {
|
|
339
343
|
return (
|
|
@@ -442,6 +446,26 @@ export function AutoCompleteField<T, UPDATE_VALUE>(props: AutoCompleteFieldProps
|
|
|
442
446
|
createNewItemPosition,
|
|
443
447
|
}
|
|
444
448
|
: {};
|
|
449
|
+
|
|
450
|
+
const handleMenuScroll = React.useCallback(
|
|
451
|
+
async (event: any) => {
|
|
452
|
+
const menu = event.target;
|
|
453
|
+
const { scrollTop, scrollHeight, clientHeight } = menu;
|
|
454
|
+
// Check if scrolled to the bottom of the list
|
|
455
|
+
if (scrollTop + clientHeight >= scrollHeight && loadMoreResults) {
|
|
456
|
+
const results = await loadMoreResults();
|
|
457
|
+
if (results) {
|
|
458
|
+
setFiltered((prev) => [...prev, ...results]);
|
|
459
|
+
setTimeout(() => {
|
|
460
|
+
menu.scrollTop = scrollHeight; //safari adaptation
|
|
461
|
+
menu.scrollTo({ left: 0, top: scrollHeight, behavior: "auto" });
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
},
|
|
466
|
+
[loadMoreResults]
|
|
467
|
+
);
|
|
468
|
+
|
|
445
469
|
return (
|
|
446
470
|
<BlueprintSuggest<T>
|
|
447
471
|
className={`${eccgui}-autocompletefield__input` + (className ? ` ${className}` : "")}
|
|
@@ -455,7 +479,11 @@ export function AutoCompleteField<T, UPDATE_VALUE>(props: AutoCompleteFieldProps
|
|
|
455
479
|
noResults={<MenuItem disabled={true} text={noResultText} />}
|
|
456
480
|
onItemSelect={onSelectionChange}
|
|
457
481
|
onQueryChange={(q) => setQuery(q)}
|
|
482
|
+
resetOnQuery={false}
|
|
458
483
|
closeOnSelect={true}
|
|
484
|
+
menuProps={{
|
|
485
|
+
onScroll: handleMenuScroll,
|
|
486
|
+
}}
|
|
459
487
|
query={query}
|
|
460
488
|
// This leads to odd compile errors without "as any"
|
|
461
489
|
popoverProps={updatedContextOverlayProps as any}
|