@eccenca/gui-elements 23.3.0-rc.0 → 23.3.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 +27 -12
- package/dist/cjs/common/index.js +5 -2
- package/dist/cjs/common/index.js.map +1 -1
- package/dist/cjs/common/utils/globalVars.js +21 -0
- package/dist/cjs/common/utils/globalVars.js.map +1 -0
- package/dist/cjs/components/Dialog/Modal.js +20 -2
- package/dist/cjs/components/Dialog/Modal.js.map +1 -1
- package/dist/cjs/components/Table/TableExpandHeader.js +7 -8
- package/dist/cjs/components/Table/TableExpandHeader.js.map +1 -1
- package/dist/cjs/extensions/react-flow/edges/EdgeLabel.js +10 -9
- package/dist/cjs/extensions/react-flow/edges/EdgeLabel.js.map +1 -1
- package/dist/cjs/extensions/react-flow/handles/HandleContent.js +4 -4
- package/dist/cjs/extensions/react-flow/handles/HandleContent.js.map +1 -1
- package/dist/cjs/extensions/react-flow/handles/HandleDefault.js +53 -24
- package/dist/cjs/extensions/react-flow/handles/HandleDefault.js.map +1 -1
- package/dist/cjs/extensions/react-flow/handles/HandleTools.js +16 -2
- package/dist/cjs/extensions/react-flow/handles/HandleTools.js.map +1 -1
- package/dist/cjs/extensions/react-flow/nodes/NodeContent.js +17 -8
- package/dist/cjs/extensions/react-flow/nodes/NodeContent.js.map +1 -1
- package/dist/esm/common/index.js +5 -2
- package/dist/esm/common/index.js.map +1 -1
- package/dist/esm/common/utils/globalVars.js +16 -0
- package/dist/esm/common/utils/globalVars.js.map +1 -0
- package/dist/esm/components/Dialog/Modal.js +20 -2
- package/dist/esm/components/Dialog/Modal.js.map +1 -1
- package/dist/esm/components/Table/TableExpandHeader.js +7 -8
- package/dist/esm/components/Table/TableExpandHeader.js.map +1 -1
- package/dist/esm/extensions/react-flow/edges/EdgeLabel.js +10 -9
- package/dist/esm/extensions/react-flow/edges/EdgeLabel.js.map +1 -1
- package/dist/esm/extensions/react-flow/handles/HandleContent.js +16 -5
- package/dist/esm/extensions/react-flow/handles/HandleContent.js.map +1 -1
- package/dist/esm/extensions/react-flow/handles/HandleDefault.js +53 -24
- package/dist/esm/extensions/react-flow/handles/HandleDefault.js.map +1 -1
- package/dist/esm/extensions/react-flow/handles/HandleTools.js +32 -2
- package/dist/esm/extensions/react-flow/handles/HandleTools.js.map +1 -1
- package/dist/esm/extensions/react-flow/nodes/NodeContent.js +17 -8
- package/dist/esm/extensions/react-flow/nodes/NodeContent.js.map +1 -1
- package/dist/types/common/index.d.ts +4 -0
- package/dist/types/common/utils/globalVars.d.ts +2 -0
- package/dist/types/components/Dialog/Modal.d.ts +11 -3
- package/dist/types/components/Table/TableExpandHeader.d.ts +5 -1
- package/dist/types/extensions/react-flow/edges/EdgeLabel.d.ts +7 -3
- package/dist/types/extensions/react-flow/handles/HandleContent.d.ts +7 -2
- package/dist/types/extensions/react-flow/handles/HandleDefault.d.ts +13 -4
- package/dist/types/extensions/react-flow/handles/HandleTools.d.ts +2 -1
- package/dist/types/extensions/react-flow/nodes/NodeContent.d.ts +3 -7
- package/package.json +6 -6
- package/src/common/index.ts +6 -3
- package/src/common/utils/globalVars.ts +18 -0
- package/src/components/Application/application.scss +8 -6
- package/src/components/Dialog/Modal.tsx +35 -3
- package/src/components/Dialog/dialog.scss +4 -0
- package/src/components/PropertyValuePair/propertyvalue.scss +1 -0
- package/src/components/Table/TableExpandHeader.tsx +21 -18
- package/src/extensions/react-flow/edges/EdgeLabel.tsx +78 -81
- package/src/extensions/react-flow/edges/_edges.scss +62 -67
- package/src/extensions/react-flow/handles/HandleContent.tsx +14 -13
- package/src/extensions/react-flow/handles/HandleDefault.tsx +112 -42
- package/src/extensions/react-flow/handles/HandleTools.tsx +28 -4
- package/src/extensions/react-flow/handles/_handles.scss +86 -21
- package/src/extensions/react-flow/handles/stories/HandleDefault.stories.tsx +41 -3
- package/src/extensions/react-flow/nodes/NodeContent.tsx +35 -30
- package/src/extensions/react-flow/nodes/stories/NodeContent.stories.tsx +75 -52
- package/src/extensions/react-flow/nodes/stories/NodeDefault.stories.tsx +4 -4
- package/src/extensions/react-flow/nodes/stories/nodeTypes.ts +11 -0
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { TableExpandHeaderProps as CarbonTableExpandHeaderProps } from "carbon-components-react";
|
|
3
|
+
import { TestIconProps } from "../Icon";
|
|
4
|
+
import { ValidIconName } from "../Icon/canonicalIconNames";
|
|
3
5
|
export interface TableExpandHeaderProps extends Omit<CarbonTableExpandHeaderProps, "children" | "ariaLabel" | "enableExpando" | "expandIconDescription">, React.ThHTMLAttributes<HTMLTableCellElement> {
|
|
4
6
|
/**
|
|
5
7
|
* This text is displayed as tooltip for the button that toggles the expanded/collapsed state.
|
|
6
8
|
*/
|
|
7
9
|
togglerText: string;
|
|
10
|
+
/** An optional icon that is shown as toggle icon. */
|
|
11
|
+
toggleIcon?: ValidIconName | string[] | React.ReactElement<TestIconProps>;
|
|
8
12
|
}
|
|
9
13
|
/**
|
|
10
14
|
* Adds a button to the table header that can trigger a function to expand/collapse all rows of the table.
|
|
11
15
|
*/
|
|
12
|
-
export declare function TableExpandHeader({ togglerText, isExpanded, onExpand, className, enableToggle, ...otherCarbonTableExpandHeaderProps }: TableExpandHeaderProps): React.JSX.Element;
|
|
16
|
+
export declare function TableExpandHeader({ togglerText, isExpanded, onExpand, className, enableToggle, toggleIcon, ...otherCarbonTableExpandHeaderProps }: TableExpandHeaderProps): React.JSX.Element;
|
|
13
17
|
export default TableExpandHeader;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { DepictionProps } from "../../../index";
|
|
3
|
-
import { ValidIconName } from "../../../components/Icon/canonicalIconNames";
|
|
4
2
|
import { IntentTypes } from "../../../common/Intent";
|
|
3
|
+
import { ValidIconName } from "../../../components/Icon/canonicalIconNames";
|
|
4
|
+
import { DepictionProps } from "../../../index";
|
|
5
5
|
export interface EdgeLabelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
6
|
/**
|
|
7
7
|
* Depiction element displayed left from the label.
|
|
@@ -24,12 +24,16 @@ export interface EdgeLabelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
24
24
|
* Stretches the label component to the full available width.
|
|
25
25
|
*/
|
|
26
26
|
fullWidth?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Label is diaplayed without a box that comes with borders and background color.
|
|
29
|
+
*/
|
|
30
|
+
loose?: boolean;
|
|
27
31
|
/**
|
|
28
32
|
* Add a info state to the label, visualized by color.
|
|
29
33
|
*/
|
|
30
34
|
intent?: IntentTypes;
|
|
31
35
|
}
|
|
32
|
-
export declare const EdgeLabel: React.MemoExoticComponent<({ depiction, text, actions, large, fullWidth, intent, title, ...otherDivProps }: EdgeLabelProps) => React.JSX.Element>;
|
|
36
|
+
export declare const EdgeLabel: React.MemoExoticComponent<({ depiction, text, actions, large, fullWidth, loose, intent, title, ...otherDivProps }: EdgeLabelProps) => React.JSX.Element>;
|
|
33
37
|
export interface EdgeLabelObjectProps extends React.SVGAttributes<SVGForeignObjectElement> {
|
|
34
38
|
/**
|
|
35
39
|
* The `<EdgeLabel />` element that need to be displayed.
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TooltipProps } from "../../../index";
|
|
2
3
|
export interface HandleContentProps {
|
|
3
4
|
children?: JSX.Element | string;
|
|
4
5
|
/**
|
|
5
6
|
* Tooltip displayed as overlay on hover.
|
|
6
7
|
*/
|
|
7
8
|
extendedTooltip?: JSX.Element | string;
|
|
9
|
+
/**
|
|
10
|
+
* Configure the tooltip and overwrite automatically set options.
|
|
11
|
+
*/
|
|
12
|
+
tooltipProps?: Omit<TooltipProps, "content" | "children" | "renderTarget">;
|
|
8
13
|
}
|
|
9
|
-
export declare const HandleContent: React.MemoExoticComponent<({ children, extendedTooltip }: HandleContentProps) => React.JSX.Element>;
|
|
14
|
+
export declare const HandleContent: React.MemoExoticComponent<({ children, extendedTooltip, tooltipProps }: HandleContentProps) => React.JSX.Element>;
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { HandleProps as ReactFlowHandleLegacyProps } from "react-flow-renderer";
|
|
3
3
|
import { HandleProps as ReactFlowHandleNextProps } from "react-flow-renderer-lts";
|
|
4
|
+
import { IntentTypes } from "../../../common/Intent";
|
|
4
5
|
import { ReacFlowVersionSupportProps } from "../versionsupport";
|
|
5
6
|
import { HandleContentProps } from "./HandleContent";
|
|
6
|
-
|
|
7
|
+
export declare type HandleCategory = "configuration" | "flexible" | "fixed" | "unknown" | "dependency";
|
|
8
|
+
interface HandleExtensionProps extends ReacFlowVersionSupportProps, Omit<React.HTMLAttributes<HTMLDivElement>, "id" | "children"> {
|
|
9
|
+
/**
|
|
10
|
+
* Defines the handle category, mainly used to adjust layout.
|
|
11
|
+
*/
|
|
12
|
+
category?: HandleCategory;
|
|
7
13
|
/**
|
|
8
14
|
* Extended handle data.
|
|
9
15
|
*/
|
|
@@ -12,13 +18,16 @@ interface HandleExtensionProps extends ReacFlowVersionSupportProps {
|
|
|
12
18
|
* Simple text tooltip displayed as title on hover.
|
|
13
19
|
*/
|
|
14
20
|
tooltip?: string;
|
|
15
|
-
|
|
16
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Feedback state of the handle.
|
|
23
|
+
*/
|
|
24
|
+
intent?: IntentTypes;
|
|
25
|
+
children?: HandleContentProps["children"];
|
|
17
26
|
}
|
|
18
27
|
export interface HandleProps extends HandleExtensionProps, ReactFlowHandleLegacyProps {
|
|
19
28
|
}
|
|
20
29
|
export interface HandleNextProps extends HandleExtensionProps, ReactFlowHandleNextProps {
|
|
21
30
|
}
|
|
22
31
|
export declare type HandleDefaultProps = HandleProps | HandleNextProps;
|
|
23
|
-
export declare const HandleDefault: React.MemoExoticComponent<({ flowVersion, data, tooltip, children, ...handleProps }: HandleDefaultProps) => React.JSX.Element>;
|
|
32
|
+
export declare const HandleDefault: React.MemoExoticComponent<({ flowVersion, data, tooltip, children, category, intent, ...handleProps }: HandleDefaultProps) => React.JSX.Element>;
|
|
24
33
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { TestableComponent } from "../../../index";
|
|
2
3
|
import { ContextOverlayProps } from "./../../../components/ContextOverlay/ContextOverlay";
|
|
3
|
-
export interface HandleToolsProps extends Omit<ContextOverlayProps, "children" | "content" | "popoverClassName"
|
|
4
|
+
export interface HandleToolsProps extends Omit<ContextOverlayProps, "children" | "content" | "popoverClassName">, TestableComponent {
|
|
4
5
|
children: string | JSX.Element | JSX.Element[];
|
|
5
6
|
}
|
|
6
7
|
export declare const HandleTools: ({ children, ...otherContextOverlayProps }: HandleToolsProps) => React.JSX.Element;
|
|
@@ -8,15 +8,11 @@ import { HandleNextProps, HandleProps } from "./../handles/HandleDefault";
|
|
|
8
8
|
import { NodeContentExtensionProps } from "./NodeContentExtension";
|
|
9
9
|
import { NodeProps } from "./NodeDefault";
|
|
10
10
|
import { HighlightingState, NodeHighlightColor } from "./sharedTypes";
|
|
11
|
+
declare type NodeContentHandleLegacyProps = HandleProps;
|
|
12
|
+
declare type NodeContentHandleNextProps = HandleNextProps;
|
|
13
|
+
export declare type NodeContentHandleProps = NodeContentHandleLegacyProps | NodeContentHandleNextProps;
|
|
11
14
|
export type { HighlightingState };
|
|
12
|
-
interface NodeContentHandleLegacyProps extends HandleProps {
|
|
13
|
-
category?: "configuration";
|
|
14
|
-
}
|
|
15
15
|
export declare type IHandleProps = NodeContentHandleLegacyProps;
|
|
16
|
-
export interface NodeContentHandleNextProps extends HandleNextProps {
|
|
17
|
-
category?: "configuration";
|
|
18
|
-
}
|
|
19
|
-
export declare type NodeContentHandleProps = NodeContentHandleLegacyProps | NodeContentHandleNextProps;
|
|
20
16
|
export declare type NodeDimensions = {
|
|
21
17
|
width: number;
|
|
22
18
|
height: number;
|
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.3.0-rc.
|
|
4
|
+
"version": "23.3.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",
|
|
@@ -114,19 +114,19 @@
|
|
|
114
114
|
"@types/color": "^3.0.2",
|
|
115
115
|
"@types/jest": "^29.5.4",
|
|
116
116
|
"@types/lodash": "^4.14.194",
|
|
117
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
118
|
-
"@typescript-eslint/parser": "^5.
|
|
117
|
+
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
|
118
|
+
"@typescript-eslint/parser": "^5.62.0",
|
|
119
119
|
"babel-jest": "^29.7.0",
|
|
120
120
|
"chromatic": "^6.17.4",
|
|
121
|
-
"eslint": "^8.
|
|
122
|
-
"eslint-plugin-react": "^7.
|
|
121
|
+
"eslint": "^8.49.0",
|
|
122
|
+
"eslint-plugin-react": "^7.33.2",
|
|
123
123
|
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
124
124
|
"husky": "4",
|
|
125
125
|
"identity-obj-proxy": "^3.0.0",
|
|
126
126
|
"jest": "^29.7.0",
|
|
127
127
|
"jest-environment-jsdom": "^29.7.0",
|
|
128
128
|
"jest-pnp-resolver": "^1.2.3",
|
|
129
|
-
"lint-staged": "^13.
|
|
129
|
+
"lint-staged": "^13.3.0",
|
|
130
130
|
"node-sass-package-importer": "^5.3.2",
|
|
131
131
|
"prettier": "^2.8.8",
|
|
132
132
|
"react-app-polyfill": "^3.0.0",
|
package/src/common/index.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { invisibleZeroWidthCharacters } from "./utils/characters";
|
|
2
2
|
import decideContrastColorValue from "./utils/colorDecideContrastvalue";
|
|
3
3
|
import getColorConfiguration from "./utils/getColorConfiguration";
|
|
4
|
-
import {
|
|
4
|
+
import { getGlobalVar, setGlobalVar } from "./utils/globalVars";
|
|
5
|
+
import { openInNewTab } from "./utils/openInNewTab";
|
|
5
6
|
|
|
6
7
|
export const utils = {
|
|
7
8
|
openInNewTab,
|
|
8
9
|
decideContrastColorValue,
|
|
9
10
|
getColorConfiguration,
|
|
10
11
|
invisibleZeroWidthCharacters,
|
|
11
|
-
|
|
12
|
+
getGlobalVar,
|
|
13
|
+
setGlobalVar,
|
|
14
|
+
};
|
|
12
15
|
// @deprecated use `utils`
|
|
13
16
|
export const Utilities = utils;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
2
|
+
|
|
3
|
+
const getGlobalConfig = () => {
|
|
4
|
+
return typeof window[eccgui as any] === "undefined"
|
|
5
|
+
? Object.defineProperty(window, `${eccgui}`, {
|
|
6
|
+
value: {},
|
|
7
|
+
writable: true,
|
|
8
|
+
})[eccgui as any]
|
|
9
|
+
: window[eccgui as any];
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const getGlobalVar = (varname: string) => {
|
|
13
|
+
return getGlobalConfig()[varname as any];
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const setGlobalVar = (varname: string, value: any) => {
|
|
17
|
+
return (getGlobalConfig()[varname as any] = value);
|
|
18
|
+
};
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
// @import 'config';
|
|
2
|
-
@import
|
|
3
|
-
@import
|
|
4
|
-
@import
|
|
2
|
+
@import "~@carbon/styles/scss/components/ui-shell/functions";
|
|
3
|
+
@import "header";
|
|
4
|
+
@import "toolbar";
|
|
5
|
+
|
|
5
6
|
// @import '~@carbon/styles/scss/components/ui-shell/product-switcher';
|
|
6
7
|
// @import '~@carbon/styles/scss/components/ui-shell/switcher';
|
|
7
|
-
@import
|
|
8
|
+
@import "sidebar";
|
|
9
|
+
|
|
8
10
|
// @import '~@carbon/styles/scss/components/ui-shell/navigation-menu';
|
|
9
|
-
@import
|
|
11
|
+
@import "content";
|
|
10
12
|
|
|
11
13
|
.#{$ns}-portal {
|
|
12
|
-
z-index:
|
|
14
|
+
z-index: 10001; // higher than carbon ui shell header and delta to dialog portals
|
|
13
15
|
}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import {
|
|
3
3
|
Classes as BlueprintClassNames,
|
|
4
|
-
IOverlayState,
|
|
4
|
+
IOverlayState as BlueprintOverlayState,
|
|
5
5
|
Overlay as BlueprintOverlay,
|
|
6
|
-
OverlayProps,
|
|
6
|
+
OverlayProps as BlueprintOverlayProps,
|
|
7
7
|
} from "@blueprintjs/core";
|
|
8
8
|
|
|
9
|
+
import { Utilities } from "../../common";
|
|
9
10
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
10
11
|
|
|
11
12
|
import { Card } from "./../Card";
|
|
12
13
|
|
|
13
|
-
export interface ModalProps extends
|
|
14
|
+
export interface ModalProps extends BlueprintOverlayProps, BlueprintOverlayState {
|
|
14
15
|
children: React.ReactNode | React.ReactNode[];
|
|
15
16
|
/**
|
|
16
17
|
* A space-delimited list of class names to pass along to the BlueprintJS `Overlay` element that is used to create the modal.
|
|
@@ -33,6 +34,14 @@ export interface ModalProps extends OverlayProps, IOverlayState {
|
|
|
33
34
|
* This is needed, e.g. when capturing key (down, up) events that should bubble to the modal's parent elements.
|
|
34
35
|
*/
|
|
35
36
|
modalFocusable?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Works only for modals inside portals (`usePortal={true}`).
|
|
39
|
+
* When set to `true` then the `z-index` of the modal's portal element is recalculated, so that the modal is always shown on top of all other visible elements.
|
|
40
|
+
* Use this with care!
|
|
41
|
+
* Usually the normal opening sequence is enough to show the currently most important modal on top.
|
|
42
|
+
* If this option is used inflationary then this could harm the visibility of other overlays.
|
|
43
|
+
*/
|
|
44
|
+
forceTopPosition?: boolean;
|
|
36
45
|
}
|
|
37
46
|
|
|
38
47
|
/**
|
|
@@ -51,6 +60,9 @@ export const Modal = ({
|
|
|
51
60
|
preventBackdrop = false,
|
|
52
61
|
wrapperDivProps,
|
|
53
62
|
modalFocusable = true,
|
|
63
|
+
usePortal = true,
|
|
64
|
+
forceTopPosition = false,
|
|
65
|
+
onOpening,
|
|
54
66
|
...otherProps
|
|
55
67
|
}: ModalProps) => {
|
|
56
68
|
const backdropProps: React.HTMLProps<HTMLDivElement> | undefined =
|
|
@@ -79,6 +91,23 @@ export const Modal = ({
|
|
|
79
91
|
return child;
|
|
80
92
|
});
|
|
81
93
|
|
|
94
|
+
const handlerOnOpening = (modalElement: HTMLElement) => {
|
|
95
|
+
if (onOpening) {
|
|
96
|
+
// call the original event handler
|
|
97
|
+
onOpening(modalElement);
|
|
98
|
+
}
|
|
99
|
+
if (usePortal && forceTopPosition) {
|
|
100
|
+
const parentalPortal = modalElement.closest(`.${BlueprintClassNames.PORTAL}`) as HTMLElement;
|
|
101
|
+
const highestTopIndex = (Utilities.getGlobalVar("highestModalTopIndex") as unknown as number) ?? 0;
|
|
102
|
+
if (parentalPortal) {
|
|
103
|
+
const portalTopIndex = parseInt(getComputedStyle(parentalPortal).zIndex ?? 0, 10);
|
|
104
|
+
const newTopIndex = Math.max(portalTopIndex, highestTopIndex) + 1;
|
|
105
|
+
parentalPortal.style.zIndex = `${newTopIndex}`;
|
|
106
|
+
Utilities.setGlobalVar("highestModalTopIndex", newTopIndex);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
82
111
|
return (
|
|
83
112
|
<BlueprintOverlay
|
|
84
113
|
{...otherProps}
|
|
@@ -88,6 +117,9 @@ export const Modal = ({
|
|
|
88
117
|
canOutsideClickClose={canOutsideClickClose}
|
|
89
118
|
canEscapeKeyClose={canEscapeKeyClose}
|
|
90
119
|
hasBackdrop={!preventBackdrop}
|
|
120
|
+
usePortal={usePortal}
|
|
121
|
+
onOpening={handlerOnOpening}
|
|
122
|
+
portalClassName={`${eccgui}-dialog__portal`}
|
|
91
123
|
>
|
|
92
124
|
<div
|
|
93
125
|
{...wrapperDivProps}
|
|
@@ -15,6 +15,10 @@ $eccgui-color-modal-backdrop: rgba(invert($eccgui-color-workspace-background), 0
|
|
|
15
15
|
|
|
16
16
|
@import "~@blueprintjs/core/src/components/dialog/dialog";
|
|
17
17
|
|
|
18
|
+
.#{$eccgui}-dialog__portal {
|
|
19
|
+
z-index: 8001; // higher than carbon ui shell header
|
|
20
|
+
}
|
|
21
|
+
|
|
18
22
|
.#{$eccgui}-dialog__backdrop {
|
|
19
23
|
background-color: $eccgui-color-modal-backdrop;
|
|
20
24
|
}
|
|
@@ -3,49 +3,52 @@ import {
|
|
|
3
3
|
TableExpandHeader as CarbonTableExpandHeader,
|
|
4
4
|
TableExpandHeaderProps as CarbonTableExpandHeaderProps,
|
|
5
5
|
} from "carbon-components-react";
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
8
|
+
import { TestIconProps } from "../Icon";
|
|
9
|
+
import { ValidIconName } from "../Icon/canonicalIconNames";
|
|
10
|
+
|
|
11
|
+
import IconButton from "./../Icon/IconButton";
|
|
8
12
|
|
|
9
|
-
export interface TableExpandHeaderProps
|
|
10
|
-
CarbonTableExpandHeaderProps,
|
|
11
|
-
|
|
12
|
-
>, React.ThHTMLAttributes<HTMLTableCellElement> {
|
|
13
|
+
export interface TableExpandHeaderProps
|
|
14
|
+
extends Omit<CarbonTableExpandHeaderProps, "children" | "ariaLabel" | "enableExpando" | "expandIconDescription">,
|
|
15
|
+
React.ThHTMLAttributes<HTMLTableCellElement> {
|
|
13
16
|
/**
|
|
14
17
|
* This text is displayed as tooltip for the button that toggles the expanded/collapsed state.
|
|
15
18
|
*/
|
|
16
19
|
togglerText: string;
|
|
17
|
-
|
|
20
|
+
|
|
21
|
+
/** An optional icon that is shown as toggle icon. */
|
|
22
|
+
toggleIcon?: ValidIconName | string[] | React.ReactElement<TestIconProps>;
|
|
23
|
+
}
|
|
18
24
|
|
|
19
25
|
/**
|
|
20
26
|
* Adds a button to the table header that can trigger a function to expand/collapse all rows of the table.
|
|
21
27
|
*/
|
|
22
|
-
export function TableExpandHeader
|
|
28
|
+
export function TableExpandHeader({
|
|
23
29
|
togglerText,
|
|
24
30
|
isExpanded,
|
|
25
31
|
onExpand,
|
|
26
32
|
className,
|
|
27
33
|
enableToggle,
|
|
34
|
+
toggleIcon,
|
|
28
35
|
...otherCarbonTableExpandHeaderProps
|
|
29
36
|
}: TableExpandHeaderProps) {
|
|
30
|
-
|
|
31
|
-
const toggleButton =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
const defaultToggleIcon = isExpanded ? "toggler-rowcollapse" : "toggler-rowexpand";
|
|
38
|
+
const toggleButton = React.cloneElement(<IconButton name={toggleIcon ?? defaultToggleIcon} text={togglerText} />, {
|
|
39
|
+
onClick: onExpand,
|
|
40
|
+
});
|
|
35
41
|
return (
|
|
36
42
|
<CarbonTableExpandHeader
|
|
37
|
-
className={
|
|
38
|
-
`${eccgui}-simpletable__headexpander` +
|
|
39
|
-
(!!className ? ` ${className}` : "")
|
|
40
|
-
}
|
|
43
|
+
className={`${eccgui}-simpletable__headexpander` + (className ? ` ${className}` : "")}
|
|
41
44
|
isExpanded={isExpanded}
|
|
42
45
|
onExpand={onExpand}
|
|
43
46
|
enableToggle={false}
|
|
44
47
|
{...otherCarbonTableExpandHeaderProps}
|
|
45
48
|
>
|
|
46
|
-
{
|
|
49
|
+
{enableToggle && toggleButton}
|
|
47
50
|
</CarbonTableExpandHeader>
|
|
48
|
-
)
|
|
51
|
+
);
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
export default TableExpandHeader;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React, { memo } from "react";
|
|
2
|
-
|
|
3
|
-
import {
|
|
2
|
+
|
|
3
|
+
import { intentClassName, IntentTypes } from "../../../common/Intent";
|
|
4
4
|
import { ValidIconName } from "../../../components/Icon/canonicalIconNames";
|
|
5
|
-
import {
|
|
5
|
+
import { CLASSPREFIX as eccgui } from "../../../configuration/constants";
|
|
6
|
+
import { Depiction, DepictionProps, Icon, OverflowText } from "../../../index";
|
|
6
7
|
|
|
7
8
|
export interface EdgeLabelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
8
9
|
/**
|
|
@@ -26,62 +27,56 @@ export interface EdgeLabelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
26
27
|
* Stretches the label component to the full available width.
|
|
27
28
|
*/
|
|
28
29
|
fullWidth?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Label is diaplayed without a box that comes with borders and background color.
|
|
32
|
+
*/
|
|
33
|
+
loose?: boolean;
|
|
29
34
|
/**
|
|
30
35
|
* Add a info state to the label, visualized by color.
|
|
31
36
|
*/
|
|
32
37
|
intent?: IntentTypes;
|
|
33
38
|
}
|
|
34
39
|
|
|
35
|
-
export const EdgeLabel = memo(
|
|
36
|
-
depiction,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
...otherDivProps
|
|
44
|
-
} : EdgeLabelProps) => {
|
|
45
|
-
|
|
46
|
-
const depEl = (!!depiction && typeof depiction === "string")
|
|
47
|
-
? <Depiction image={<Icon name={depiction as ValidIconName} />} />
|
|
48
|
-
: depiction;
|
|
40
|
+
export const EdgeLabel = memo(
|
|
41
|
+
({ depiction, text, actions, large, fullWidth, loose, intent, title, ...otherDivProps }: EdgeLabelProps) => {
|
|
42
|
+
const depEl =
|
|
43
|
+
!!depiction && typeof depiction === "string" ? (
|
|
44
|
+
<Depiction image={<Icon name={depiction as ValidIconName} />} />
|
|
45
|
+
) : (
|
|
46
|
+
depiction
|
|
47
|
+
);
|
|
49
48
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
{
|
|
63
|
-
React.cloneElement(depEl, {
|
|
49
|
+
return (
|
|
50
|
+
<div
|
|
51
|
+
className={
|
|
52
|
+
`${eccgui}-graphviz__edge-label` +
|
|
53
|
+
(large ? ` ${eccgui}-graphviz__edge-label--large` : "") +
|
|
54
|
+
(fullWidth ? ` ${eccgui}-graphviz__edge-label--fullwidth` : "") +
|
|
55
|
+
(loose ? ` ${eccgui}-graphviz__edge-label--loose` : "") +
|
|
56
|
+
(intent ? ` ${intentClassName(intent)}` : "")
|
|
57
|
+
}
|
|
58
|
+
{...otherDivProps}
|
|
59
|
+
>
|
|
60
|
+
{!!depEl && (
|
|
61
|
+
<div className={`${eccgui}-graphviz__edge-label__depiction`}>
|
|
62
|
+
{React.cloneElement(depEl, {
|
|
64
63
|
padding: "tiny",
|
|
65
64
|
ratio: "1:1",
|
|
66
65
|
resizing: "contain",
|
|
67
66
|
forceInlineSvg: true,
|
|
68
67
|
border: false,
|
|
69
68
|
backgroundColor: undefined,
|
|
70
|
-
})
|
|
71
|
-
|
|
69
|
+
})}
|
|
70
|
+
</div>
|
|
71
|
+
)}
|
|
72
|
+
<div className={`${eccgui}-graphviz__edge-label__text`} title={title}>
|
|
73
|
+
{typeof text === "string" ? <OverflowText>{text}</OverflowText> : text}
|
|
72
74
|
</div>
|
|
73
|
-
|
|
74
|
-
<div className={`${eccgui}-graphviz__edge-label__text`} title={title}>
|
|
75
|
-
{ typeof text === "string" ? <OverflowText>{ text }</OverflowText> : text }
|
|
75
|
+
{!!actions && <div className={`${eccgui}-graphviz__edge-label__aux`}>{actions}</div>}
|
|
76
76
|
</div>
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
</div>
|
|
81
|
-
)}
|
|
82
|
-
</div>
|
|
83
|
-
)
|
|
84
|
-
});
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
);
|
|
85
80
|
|
|
86
81
|
export interface EdgeLabelObjectProps extends React.SVGAttributes<SVGForeignObjectElement> {
|
|
87
82
|
/**
|
|
@@ -99,42 +94,44 @@ export interface EdgeLabelObjectProps extends React.SVGAttributes<SVGForeignObje
|
|
|
99
94
|
resizeTimeout?: number;
|
|
100
95
|
}
|
|
101
96
|
|
|
102
|
-
export const EdgeLabelObject = memo(
|
|
103
|
-
children,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}, [edgeCenter]);
|
|
97
|
+
export const EdgeLabelObject = memo(
|
|
98
|
+
({ children, edgeCenter, resizeTimeout = -1, ...otherForeignObjectProps }: EdgeLabelObjectProps) => {
|
|
99
|
+
const containerCallback = React.useCallback(
|
|
100
|
+
(containerRef) => {
|
|
101
|
+
if (containerRef) labelSize(containerRef);
|
|
102
|
+
},
|
|
103
|
+
[edgeCenter]
|
|
104
|
+
);
|
|
111
105
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
106
|
+
const labelSize = (container: SVGForeignObjectElement) => {
|
|
107
|
+
const labelElement = container.getElementsByClassName(`${eccgui}-graphviz__edge-label`);
|
|
108
|
+
if (labelElement.length > 0) {
|
|
109
|
+
const width = (labelElement[0] as HTMLElement).offsetWidth;
|
|
110
|
+
const height = (labelElement[0] as HTMLElement).offsetHeight;
|
|
111
|
+
container.setAttribute("x", (edgeCenter[0] - width / 2).toString());
|
|
112
|
+
container.setAttribute("y", (edgeCenter[1] - height / 2).toString());
|
|
113
|
+
container.setAttribute("width", width.toString());
|
|
114
|
+
container.setAttribute("height", height.toString());
|
|
115
|
+
} else if (resizeTimeout > 0) {
|
|
116
|
+
// Content is not ready yet, recall resizing process after timeout.
|
|
117
|
+
// This can happen in case the children is actually not a `EdgeLabel`.
|
|
118
|
+
setTimeout(() => {
|
|
119
|
+
labelSize(container);
|
|
120
|
+
}, resizeTimeout);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
127
123
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
124
|
+
return (
|
|
125
|
+
<foreignObject
|
|
126
|
+
ref={containerCallback}
|
|
127
|
+
className={`${eccgui}-graphviz__edge-labelobject`}
|
|
128
|
+
width="1"
|
|
129
|
+
height="1"
|
|
130
|
+
{...otherForeignObjectProps}
|
|
131
|
+
requiredExtensions="http://www.w3.org/1999/xhtml"
|
|
132
|
+
>
|
|
133
|
+
{children}
|
|
134
|
+
</foreignObject>
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
);
|