@eccenca/gui-elements 23.3.0-rc.0 → 23.3.0
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 +39 -19
- 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/ContextOverlay/ContextOverlay.js +3 -2
- package/dist/cjs/components/ContextOverlay/ContextOverlay.js.map +1 -1
- package/dist/cjs/components/Dialog/Modal.js +20 -2
- package/dist/cjs/components/Dialog/Modal.js.map +1 -1
- package/dist/cjs/components/Icon/canonicalIconNames.js +4 -0
- package/dist/cjs/components/Icon/canonicalIconNames.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 +62 -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/ContextOverlay/ContextOverlay.js +5 -4
- package/dist/esm/components/ContextOverlay/ContextOverlay.js.map +1 -1
- package/dist/esm/components/Dialog/Modal.js +20 -2
- package/dist/esm/components/Dialog/Modal.js.map +1 -1
- package/dist/esm/components/Icon/canonicalIconNames.js +4 -0
- package/dist/esm/components/Icon/canonicalIconNames.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 +62 -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/ContextOverlay/ContextOverlay.d.ts +7 -2
- package/dist/types/components/Dialog/Modal.d.ts +11 -3
- package/dist/types/components/Icon/canonicalIconNames.d.ts +1 -1
- 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 +8 -7
- package/src/common/index.ts +6 -3
- package/src/common/utils/globalVars.ts +18 -0
- package/src/components/Application/application.scss +7 -9
- package/src/components/ContextOverlay/ContextOverlay.tsx +20 -12
- package/src/components/ContextOverlay/contextoverlay.scss +8 -0
- package/src/components/Dialog/Modal.tsx +35 -3
- package/src/components/Dialog/dialog.scss +4 -0
- package/src/components/Icon/canonicalIconNames.tsx +9 -0
- package/src/components/PropertyValuePair/propertyvalue.scss +1 -0
- package/src/components/Table/TableExpandHeader.tsx +21 -18
- package/src/configuration/_variables.scss +27 -36
- 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 +127 -44
- 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,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: $eccgui-zindex-modals;
|
|
20
|
+
}
|
|
21
|
+
|
|
18
22
|
.#{$eccgui}-dialog__backdrop {
|
|
19
23
|
background-color: $eccgui-color-modal-backdrop;
|
|
20
24
|
}
|
|
@@ -14,6 +14,7 @@ export type ValidIconName =
|
|
|
14
14
|
| "application-vocabularies"
|
|
15
15
|
| "application-warning"
|
|
16
16
|
| "application-hotkeys"
|
|
17
|
+
| "artefact-chatlog"
|
|
17
18
|
| "artefact-commit"
|
|
18
19
|
| "artefact-customtask"
|
|
19
20
|
| "artefact-dataset"
|
|
@@ -44,6 +45,8 @@ export type ValidIconName =
|
|
|
44
45
|
| "artefact-workflow"
|
|
45
46
|
| "data-sourcepath"
|
|
46
47
|
| "data-targetpath"
|
|
48
|
+
| "entity-human"
|
|
49
|
+
| "entity-robot"
|
|
47
50
|
| "item-add-artefact"
|
|
48
51
|
| "item-clone"
|
|
49
52
|
| "item-comment"
|
|
@@ -108,6 +111,7 @@ export type ValidIconName =
|
|
|
108
111
|
| "operation-fix"
|
|
109
112
|
| "operation-link"
|
|
110
113
|
| "operation-logout"
|
|
114
|
+
| "operation-magic"
|
|
111
115
|
| "operation-merge"
|
|
112
116
|
| "operation-redo"
|
|
113
117
|
| "operation-search"
|
|
@@ -165,6 +169,7 @@ const canonicalIconNames: Record<ValidIconName, CarbonIconType> = {
|
|
|
165
169
|
"application-warning": icons.WarningAlt,
|
|
166
170
|
"application-hotkeys": icons.Keyboard,
|
|
167
171
|
|
|
172
|
+
"artefact-chatlog": icons.Chat,
|
|
168
173
|
"artefact-commit": icons.Commit,
|
|
169
174
|
"artefact-customtask": icons.Script,
|
|
170
175
|
"artefact-dataset-csv": icons.Csv,
|
|
@@ -197,6 +202,9 @@ const canonicalIconNames: Record<ValidIconName, CarbonIconType> = {
|
|
|
197
202
|
"data-sourcepath": icons.Data_2,
|
|
198
203
|
"data-targetpath": icons.Data_1,
|
|
199
204
|
|
|
205
|
+
"entity-human": icons.User,
|
|
206
|
+
"entity-robot": icons.Bot,
|
|
207
|
+
|
|
200
208
|
"item-add-artefact": icons.AddAlt,
|
|
201
209
|
"item-clone": icons.Copy,
|
|
202
210
|
"item-comment": icons.AddComment,
|
|
@@ -265,6 +273,7 @@ const canonicalIconNames: Record<ValidIconName, CarbonIconType> = {
|
|
|
265
273
|
"operation-fix": icons.Tools,
|
|
266
274
|
"operation-link": icons.Link,
|
|
267
275
|
"operation-logout": icons.Logout,
|
|
276
|
+
"operation-magic": icons.MagicWand,
|
|
268
277
|
"operation-merge": icons.DirectionMerge,
|
|
269
278
|
"operation-redo": icons.Redo,
|
|
270
279
|
"operation-search": icons.Search,
|
|
@@ -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;
|
|
@@ -17,25 +17,22 @@ $eccgui: "eccgui" !default;
|
|
|
17
17
|
|
|
18
18
|
// -- Configuration stack of colors --------------------------------------------
|
|
19
19
|
|
|
20
|
-
$eccgui-color-primary: rgb(254
|
|
21
|
-
$eccgui-color-primary-contrast: rgb(255
|
|
22
|
-
$eccgui-color-accent: rgb(10
|
|
23
|
-
$eccgui-color-accent-contrast: rgb(255
|
|
24
|
-
|
|
20
|
+
$eccgui-color-primary: rgb(254 143 1) !default;
|
|
21
|
+
$eccgui-color-primary-contrast: rgb(255 255 255) !default;
|
|
22
|
+
$eccgui-color-accent: rgb(10 103 163) !default;
|
|
23
|
+
$eccgui-color-accent-contrast: rgb(255 255 255) !default;
|
|
25
24
|
$eccgui-color-success-text: #1b5e20 !default;
|
|
26
|
-
$eccgui-color-success-background: rgb(232
|
|
27
|
-
$eccgui-color-info-text: rgb(21
|
|
28
|
-
$eccgui-color-info-background: rgb(227
|
|
25
|
+
$eccgui-color-success-background: rgb(232 245 233) !default;
|
|
26
|
+
$eccgui-color-info-text: rgb(21 101 192) !default;
|
|
27
|
+
$eccgui-color-info-background: rgb(227 242 253) !default;
|
|
29
28
|
$eccgui-color-warning-text: #e65100 !default;
|
|
30
|
-
$eccgui-color-warning-background: rgb(255
|
|
29
|
+
$eccgui-color-warning-background: rgb(255 243 224) !default;
|
|
31
30
|
$eccgui-color-danger-text: #b71c1c !default;
|
|
32
|
-
$eccgui-color-danger-background: rgb(255
|
|
33
|
-
|
|
31
|
+
$eccgui-color-danger-background: rgb(255 235 238) !default;
|
|
34
32
|
$eccgui-color-applicationheader-text: #222 !default;
|
|
35
33
|
$eccgui-color-applicationheader-background: #ddd !default;
|
|
36
34
|
$eccgui-color-workspace-text: #444 !default;
|
|
37
35
|
$eccgui-color-workspace-background: #f5f5f5 !default;
|
|
38
|
-
|
|
39
36
|
$eccgui-color-application-text: $eccgui-color-workspace-text !default; // deprecated
|
|
40
37
|
$eccgui-color-application-background: $eccgui-color-workspace-background !default; // deprecated
|
|
41
38
|
|
|
@@ -52,7 +49,10 @@ $eccgui-font-family-fantasy: fantasy !default;
|
|
|
52
49
|
$eccgui-font-family-default: $eccgui-font-family-sans !default;
|
|
53
50
|
$eccgui-size-typo-base: 14px !default; // size including absolute unit, preferable px
|
|
54
51
|
$eccgui-size-typo-base-lineheight: 1.39 !default; // only ratio to font size, no unit!
|
|
55
|
-
$eccgui-size-type-levelratio: math.div(
|
|
52
|
+
$eccgui-size-type-levelratio: math.div(
|
|
53
|
+
7,
|
|
54
|
+
6
|
|
55
|
+
) !default; // ratio without unit! used to calculate different text sizes, etc ...
|
|
56
56
|
|
|
57
57
|
$eccgui-font-weight-light: 300 !default;
|
|
58
58
|
$eccgui-font-weight-regular: 400 !default;
|
|
@@ -74,6 +74,11 @@ $eccgui-opacity-muted: 0.61 !default;
|
|
|
74
74
|
$eccgui-opacity-disabled: 0.39 !default;
|
|
75
75
|
$eccgui-opacity-invisible: 0 !default;
|
|
76
76
|
|
|
77
|
+
// -- Configuration stack of z-indexes -----------------------------------------
|
|
78
|
+
|
|
79
|
+
$eccgui-zindex-modals: 8001 !default; // higher than carbon ui shell header
|
|
80
|
+
$eccgui-zindex-overlays: 10001 !default; // add delta to dialog portals
|
|
81
|
+
|
|
77
82
|
// -- Calculation of more config vars ------------------------------------------
|
|
78
83
|
|
|
79
84
|
/*
|
|
@@ -81,52 +86,38 @@ $eccgui-opacity-invisible: 0 !default;
|
|
|
81
86
|
it is not recommended to do so.
|
|
82
87
|
*/
|
|
83
88
|
|
|
84
|
-
$eccgui-size-typo-caption: math.div(1, $eccgui-size-type-levelratio) *
|
|
85
|
-
|
|
86
|
-
$eccgui-size-typo-caption-lineheight: max(
|
|
87
|
-
$eccgui-size-type-levelratio * $eccgui-size-typo-base-lineheight,
|
|
88
|
-
1
|
|
89
|
-
) !default;
|
|
89
|
+
$eccgui-size-typo-caption: math.div(1, $eccgui-size-type-levelratio) * $eccgui-size-typo-base !default;
|
|
90
|
+
$eccgui-size-typo-caption-lineheight: max($eccgui-size-type-levelratio * $eccgui-size-typo-base-lineheight, 1) !default;
|
|
90
91
|
$eccgui-size-typo-text: $eccgui-size-typo-base !default; // should be `1rem` but bp3 currently do not support rem units here, leads to errors in their calculations for values of other properties
|
|
91
|
-
$eccgui-size-typo-text-lineheight: max(
|
|
92
|
-
|
|
93
|
-
1
|
|
94
|
-
) !default;
|
|
95
|
-
$eccgui-size-typo-subtitle: $eccgui-size-type-levelratio *
|
|
96
|
-
$eccgui-size-typo-text !default;
|
|
92
|
+
$eccgui-size-typo-text-lineheight: max($eccgui-size-typo-base-lineheight, 1) !default;
|
|
93
|
+
$eccgui-size-typo-subtitle: $eccgui-size-type-levelratio * $eccgui-size-typo-text !default;
|
|
97
94
|
$eccgui-size-typo-subtitle-lineheight: max(
|
|
98
95
|
math.div(1, $eccgui-size-type-levelratio) * $eccgui-size-typo-text-lineheight,
|
|
99
96
|
1
|
|
100
97
|
) !default;
|
|
101
|
-
$eccgui-size-typo-title: $eccgui-size-type-levelratio *
|
|
102
|
-
$eccgui-size-typo-subtitle !default;
|
|
98
|
+
$eccgui-size-typo-title: $eccgui-size-type-levelratio * $eccgui-size-typo-subtitle !default;
|
|
103
99
|
$eccgui-size-typo-title-lineheight: max(
|
|
104
100
|
math.div(1, $eccgui-size-type-levelratio) * $eccgui-size-typo-subtitle-lineheight,
|
|
105
101
|
1
|
|
106
102
|
) !default;
|
|
107
|
-
$eccgui-size-typo-headline: $eccgui-size-type-levelratio *
|
|
108
|
-
$eccgui-size-typo-title !default;
|
|
103
|
+
$eccgui-size-typo-headline: $eccgui-size-type-levelratio * $eccgui-size-typo-title !default;
|
|
109
104
|
$eccgui-size-typo-headline-lineheight: max(
|
|
110
105
|
math.div(1, $eccgui-size-type-levelratio) * $eccgui-size-typo-title-lineheight,
|
|
111
106
|
1
|
|
112
107
|
) !default;
|
|
113
|
-
$eccgui-size-typo-display-1: $eccgui-size-type-levelratio *
|
|
114
|
-
$eccgui-size-typo-headline !default;
|
|
108
|
+
$eccgui-size-typo-display-1: $eccgui-size-type-levelratio * $eccgui-size-typo-headline !default;
|
|
115
109
|
$eccgui-size-typo-display-1-lineheight: max(
|
|
116
110
|
math.div(1, $eccgui-size-type-levelratio) * $eccgui-size-typo-headline-lineheight,
|
|
117
111
|
1
|
|
118
112
|
) !default;
|
|
119
|
-
$eccgui-size-typo-display-2: $eccgui-size-type-levelratio *
|
|
120
|
-
$eccgui-size-typo-display-1 !default;
|
|
113
|
+
$eccgui-size-typo-display-2: $eccgui-size-type-levelratio * $eccgui-size-typo-display-1 !default;
|
|
121
114
|
$eccgui-size-typo-display-2-lineheight: max(
|
|
122
115
|
math.div(1, $eccgui-size-type-levelratio) * $eccgui-size-typo-display-1-lineheight,
|
|
123
116
|
1
|
|
124
117
|
) !default;
|
|
125
|
-
$eccgui-size-typo-display-3: $eccgui-size-type-levelratio *
|
|
126
|
-
$eccgui-size-typo-display-2 !default;
|
|
118
|
+
$eccgui-size-typo-display-3: $eccgui-size-type-levelratio * $eccgui-size-typo-display-2 !default;
|
|
127
119
|
$eccgui-size-typo-display-3-lineheight: max(
|
|
128
120
|
math.div(1, $eccgui-size-type-levelratio) * $eccgui-size-typo-display-2-lineheight,
|
|
129
121
|
1
|
|
130
122
|
) !default;
|
|
131
|
-
|
|
132
123
|
$eccgui-size-maxwidth-workview: 100 * $eccgui-size-typo-text;
|
|
@@ -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
|
+
);
|