@eccenca/gui-elements 23.0.0 → 23.1.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 +35 -1
- package/README.md +7 -0
- package/dist/cjs/cmem/ActivityControl/ActivityControlWidget.js.map +1 -1
- package/dist/cjs/cmem/react-flow/ReactFlow/ReactFlow.js +7 -2
- package/dist/cjs/cmem/react-flow/ReactFlow/ReactFlow.js.map +1 -1
- package/dist/cjs/cmem/react-flow/StickyNoteModal/StickyNoteModal.js +3 -7
- package/dist/cjs/cmem/react-flow/StickyNoteModal/StickyNoteModal.js.map +1 -1
- package/dist/cjs/cmem/react-flow/extensions/scrollOnDragHook.js +200 -0
- package/dist/cjs/cmem/react-flow/extensions/scrollOnDragHook.js.map +1 -0
- package/dist/cjs/common/Intent/index.js +7 -3
- package/dist/cjs/common/Intent/index.js.map +1 -1
- package/dist/cjs/common/utils/characters.js +82 -0
- package/dist/cjs/common/utils/characters.js.map +1 -0
- package/dist/cjs/components/Application/ApplicationTitle.js +2 -2
- package/dist/cjs/components/Application/ApplicationTitle.js.map +1 -1
- package/dist/cjs/components/Badge/Badge.js +44 -0
- package/dist/cjs/components/Badge/Badge.js.map +1 -0
- package/dist/cjs/components/Depiction/Depiction.js +111 -0
- package/dist/cjs/components/Depiction/Depiction.js.map +1 -0
- package/dist/cjs/components/Grid/Grid.js +7 -2
- package/dist/cjs/components/Grid/Grid.js.map +1 -1
- package/dist/cjs/components/Grid/GridColumn.js +6 -2
- package/dist/cjs/components/Grid/GridColumn.js.map +1 -1
- package/dist/cjs/components/Grid/GridRow.js +3 -0
- package/dist/cjs/components/Grid/GridRow.js.map +1 -1
- package/dist/cjs/components/Icon/BaseIcon.js +38 -0
- package/dist/cjs/components/Icon/BaseIcon.js.map +1 -0
- package/dist/cjs/components/Icon/Icon.js +9 -24
- package/dist/cjs/components/Icon/Icon.js.map +1 -1
- package/dist/cjs/components/Icon/IconButton.js +8 -1
- package/dist/cjs/components/Icon/IconButton.js.map +1 -1
- package/dist/cjs/components/Icon/TestIcon.js +35 -0
- package/dist/cjs/components/Icon/TestIcon.js.map +1 -0
- package/dist/cjs/components/Icon/canonicalIconNames.js +123 -621
- package/dist/cjs/components/Icon/canonicalIconNames.js.map +1 -1
- package/dist/cjs/components/Icon/index.js +11 -0
- package/dist/cjs/components/Icon/index.js.map +1 -0
- package/dist/cjs/components/Menu/MenuItem.js +1 -1
- package/dist/cjs/components/Menu/MenuItem.js.map +1 -1
- package/dist/cjs/components/MultiSelect/MultiSelect.js +56 -23
- package/dist/cjs/components/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/cjs/components/Notification/Notification.js +10 -2
- package/dist/cjs/components/Notification/Notification.js.map +1 -1
- package/dist/cjs/components/OverviewItem/OverviewItemDepiction.js +24 -0
- package/dist/cjs/components/OverviewItem/OverviewItemDepiction.js.map +1 -1
- package/dist/cjs/components/Tag/Tag.js +6 -2
- package/dist/cjs/components/Tag/Tag.js.map +1 -1
- package/dist/cjs/components/TextField/TextArea.js +4 -2
- package/dist/cjs/components/TextField/TextArea.js.map +1 -1
- package/dist/cjs/components/TextField/TextField.js +4 -2
- package/dist/cjs/components/TextField/TextField.js.map +1 -1
- package/dist/cjs/components/TextField/useTextValidation.js +84 -0
- package/dist/cjs/components/TextField/useTextValidation.js.map +1 -0
- package/dist/cjs/components/Tree/Tree.js.map +1 -1
- package/dist/cjs/components/Typography/Highlighter.js.map +1 -1
- package/dist/cjs/components/Typography/OverflowText.js.map +1 -1
- package/dist/cjs/components/Typography/WhiteSpaceContainer.js +35 -12
- package/dist/cjs/components/Typography/WhiteSpaceContainer.js.map +1 -1
- package/dist/cjs/components/Typography/index.js +21 -0
- package/dist/cjs/components/Typography/index.js.map +1 -0
- package/dist/cjs/components/Workspace/WorkspaceContent.js +1 -1
- package/dist/cjs/components/Workspace/WorkspaceContent.js.map +1 -1
- package/dist/cjs/components/index.js +18 -0
- package/dist/cjs/components/index.js.map +1 -0
- package/dist/cjs/index.js +7 -17
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/cmem/ActivityControl/ActivityControlWidget.js.map +1 -1
- package/dist/esm/cmem/react-flow/ReactFlow/ReactFlow.js +7 -2
- package/dist/esm/cmem/react-flow/ReactFlow/ReactFlow.js.map +1 -1
- package/dist/esm/cmem/react-flow/StickyNoteModal/StickyNoteModal.js +3 -6
- package/dist/esm/cmem/react-flow/StickyNoteModal/StickyNoteModal.js.map +1 -1
- package/dist/esm/cmem/react-flow/extensions/scrollOnDragHook.js +194 -0
- package/dist/esm/cmem/react-flow/extensions/scrollOnDragHook.js.map +1 -0
- package/dist/esm/common/Intent/index.js +5 -13
- package/dist/esm/common/Intent/index.js.map +1 -1
- package/dist/esm/common/utils/characters.js +96 -0
- package/dist/esm/common/utils/characters.js.map +1 -0
- package/dist/esm/components/Application/ApplicationTitle.js +2 -2
- package/dist/esm/components/Application/ApplicationTitle.js.map +1 -1
- package/dist/esm/components/Badge/Badge.js +48 -0
- package/dist/esm/components/Badge/Badge.js.map +1 -0
- package/dist/esm/components/Depiction/Depiction.js +96 -0
- package/dist/esm/components/Depiction/Depiction.js.map +1 -0
- package/dist/esm/components/Grid/Grid.js +7 -2
- package/dist/esm/components/Grid/Grid.js.map +1 -1
- package/dist/esm/components/Grid/GridColumn.js +6 -2
- package/dist/esm/components/Grid/GridColumn.js.map +1 -1
- package/dist/esm/components/Grid/GridRow.js +3 -0
- package/dist/esm/components/Grid/GridRow.js.map +1 -1
- package/dist/esm/components/Icon/BaseIcon.js +44 -0
- package/dist/esm/components/Icon/BaseIcon.js.map +1 -0
- package/dist/esm/components/Icon/Icon.js +9 -24
- package/dist/esm/components/Icon/Icon.js.map +1 -1
- package/dist/esm/components/Icon/IconButton.js +8 -1
- package/dist/esm/components/Icon/IconButton.js.map +1 -1
- package/dist/esm/components/Icon/TestIcon.js +41 -0
- package/dist/esm/components/Icon/TestIcon.js.map +1 -0
- package/dist/esm/components/Icon/canonicalIconNames.js +123 -621
- package/dist/esm/components/Icon/canonicalIconNames.js.map +1 -1
- package/dist/esm/components/Icon/index.js +4 -0
- package/dist/esm/components/Icon/index.js.map +1 -0
- package/dist/esm/components/Menu/MenuItem.js +1 -1
- package/dist/esm/components/Menu/MenuItem.js.map +1 -1
- package/dist/esm/components/MultiSelect/MultiSelect.js +61 -44
- package/dist/esm/components/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/esm/components/Notification/Notification.js +12 -4
- package/dist/esm/components/Notification/Notification.js.map +1 -1
- package/dist/esm/components/OverviewItem/OverviewItemDepiction.js +24 -0
- package/dist/esm/components/OverviewItem/OverviewItemDepiction.js.map +1 -1
- package/dist/esm/components/Tag/Tag.js +6 -2
- package/dist/esm/components/Tag/Tag.js.map +1 -1
- package/dist/esm/components/TextField/TextArea.js +4 -2
- package/dist/esm/components/TextField/TextArea.js.map +1 -1
- package/dist/esm/components/TextField/TextField.js +4 -2
- package/dist/esm/components/TextField/TextField.js.map +1 -1
- package/dist/esm/components/TextField/useTextValidation.js +78 -0
- package/dist/esm/components/TextField/useTextValidation.js.map +1 -0
- package/dist/esm/components/Tree/Tree.js.map +1 -1
- package/dist/esm/components/Typography/Highlighter.js.map +1 -1
- package/dist/esm/components/Typography/OverflowText.js.map +1 -1
- package/dist/esm/components/Typography/WhiteSpaceContainer.js +16 -14
- package/dist/esm/components/Typography/WhiteSpaceContainer.js.map +1 -1
- package/dist/esm/components/Typography/index.js +12 -0
- package/dist/esm/components/Typography/index.js.map +1 -0
- package/dist/esm/components/Workspace/WorkspaceContent.js +1 -1
- package/dist/esm/components/Workspace/WorkspaceContent.js.map +1 -1
- package/dist/esm/components/index.js +6 -0
- package/dist/esm/components/index.js.map +1 -0
- package/dist/esm/index.js +5 -10
- package/dist/esm/index.js.map +1 -1
- package/dist/types/cmem/ActivityControl/ActivityControlWidget.d.ts +2 -1
- package/dist/types/cmem/react-flow/ReactFlow/ReactFlow.d.ts +14 -0
- package/dist/types/cmem/react-flow/extensions/scrollOnDragHook.d.ts +22 -0
- package/dist/types/common/Intent/index.d.ts +4 -3
- package/dist/types/common/utils/characters.d.ts +19 -0
- package/dist/types/components/Badge/Badge.d.ts +42 -0
- package/dist/types/components/Depiction/Depiction.d.ts +71 -0
- package/dist/types/components/Grid/Grid.d.ts +21 -2
- package/dist/types/components/Grid/GridColumn.d.ts +20 -2
- package/dist/types/components/Grid/GridRow.d.ts +17 -1
- package/dist/types/components/Icon/BaseIcon.d.ts +45 -0
- package/dist/types/components/Icon/Icon.d.ts +7 -34
- package/dist/types/components/Icon/IconButton.d.ts +3 -2
- package/dist/types/components/Icon/TestIcon.d.ts +20 -0
- package/dist/types/components/Icon/canonicalIconNames.d.ts +9 -7
- package/dist/types/components/Icon/index.d.ts +4 -0
- package/dist/types/components/Menu/MenuItem.d.ts +2 -1
- package/dist/types/components/MultiSelect/MultiSelect.d.ts +3 -1
- package/dist/types/components/Notification/Notification.d.ts +13 -4
- package/dist/types/components/Tabs/Tab.d.ts +2 -0
- package/dist/types/components/Tag/Tag.d.ts +16 -3
- package/dist/types/components/TextField/TextArea.d.ts +7 -2
- package/dist/types/components/TextField/TextField.d.ts +6 -1
- package/dist/types/components/TextField/useTextValidation.d.ts +28 -0
- package/dist/types/components/Tree/Tree.d.ts +2 -1
- package/dist/types/components/Typography/Highlighter.d.ts +2 -2
- package/dist/types/components/Typography/OverflowText.d.ts +2 -2
- package/dist/types/components/Typography/WhiteSpaceContainer.d.ts +45 -4
- package/dist/types/components/Typography/index.d.ts +12 -0
- package/dist/types/components/index.d.ts +5 -0
- package/dist/types/index.d.ts +6 -11
- package/package.json +13 -16
- package/scripts/compile-sass.ts +9 -1
- package/src/_shame.scss +1 -1
- package/src/cmem/ActivityControl/ActivityControlWidget.stories.tsx +6 -4
- package/src/cmem/ActivityControl/ActivityControlWidget.tsx +3 -2
- package/src/cmem/react-flow/ReactFlow/ReactFlow.tsx +26 -1
- package/src/cmem/react-flow/StickyNoteModal/StickyNoteModal.tsx +10 -6
- package/src/cmem/react-flow/extensions/scrollOnDragHook.ts +247 -0
- package/src/common/Intent/index.ts +16 -12
- package/src/common/utils/characters.ts +111 -0
- package/src/components/Accordion/accordion.scss +4 -3
- package/src/components/Application/ApplicationTitle.tsx +2 -2
- package/src/components/Application/_config.scss +1 -1
- package/src/components/Application/_content.scss +1 -1
- package/src/components/Application/_header.scss +2 -2
- package/src/components/Application/_sidebar.scss +2 -9
- package/src/components/Application/_toolbar.scss +1 -1
- package/src/components/Application/application.scss +4 -4
- package/src/components/AutocompleteField/autoCompleteFieldUtils.tsx +13 -8
- package/src/components/Badge/Badge.stories.tsx +47 -0
- package/src/components/Badge/Badge.tsx +93 -0
- package/src/components/Badge/badge.scss +44 -0
- package/src/components/Depiction/Depiction.tsx +198 -0
- package/src/components/Depiction/depiction.scss +176 -0
- package/src/components/Depiction/stories/Depiction.stories.tsx +69 -0
- package/src/components/Depiction/stories/test-16to9.png +0 -0
- package/src/components/Depiction/stories/test-16to9.svg +41 -0
- package/src/components/Depiction/stories/test-16to9.tobase64.svg +41 -0
- package/src/components/Depiction/stories/test-16to9.tsx +44 -0
- package/src/components/Depiction/stories/test-9to16.png +0 -0
- package/src/components/Depiction/stories/test-9to16.svg +44 -0
- package/src/components/Depiction/stories/test-9to16.tobase64.svg +44 -0
- package/src/components/Depiction/stories/test-9to16.tsx +48 -0
- package/src/components/Grid/Grid.tsx +22 -4
- package/src/components/Grid/GridColumn.tsx +23 -6
- package/src/components/Grid/GridRow.tsx +17 -2
- package/src/components/Grid/grid.scss +8 -11
- package/src/components/Grid/stories/Grid.stories.tsx +27 -0
- package/src/components/Grid/stories/GridColumn.stories.tsx +66 -0
- package/src/components/Grid/stories/GridRow.stories.tsx +47 -0
- package/src/components/Icon/BaseIcon.tsx +84 -0
- package/src/components/Icon/Icon.tsx +23 -82
- package/src/components/Icon/IconButton.tsx +18 -14
- package/src/components/Icon/TestIcon.tsx +39 -0
- package/src/components/Icon/canonicalIconNames.tsx +132 -633
- package/src/components/Icon/index.ts +5 -0
- package/src/components/Icon/stories/Icon.stories.tsx +13 -0
- package/src/components/Icon/stories/IconButton.stories.tsx +14 -7
- package/src/components/Icon/stories/TestIcon.stories.tsx +28 -0
- package/src/components/Link/link.scss +2 -1
- package/src/components/Menu/MenuItem.tsx +14 -4
- package/src/components/Menu/Stories/MenuItem.stories.tsx +16 -2
- package/src/components/MultiSelect/MultiSelect.tsx +58 -27
- package/src/components/Notification/Notification.stories.tsx +4 -0
- package/src/components/Notification/Notification.tsx +26 -6
- package/src/components/OverviewItem/OverviewItemDepiction.tsx +31 -0
- package/src/components/OverviewItem/overviewitem.scss +2 -1
- package/src/components/OverviewItem/stories/OverviewItem.stories.tsx +22 -1
- package/src/components/OverviewItem/stories/OverviewItemDepiction.stories.tsx +8 -3
- package/src/components/Pagination/pagination.scss +3 -2
- package/src/components/SimpleTable/simpletable.scss +11 -12
- package/src/components/Tag/Tag.stories.tsx +7 -2
- package/src/components/Tag/Tag.tsx +24 -4
- package/src/components/Tag/tag.scss +84 -3
- package/src/components/TagInput/taginput.scss +6 -0
- package/src/components/TextField/TextArea.tsx +10 -1
- package/src/components/TextField/TextField.tsx +9 -0
- package/src/components/TextField/stories/SearchField.stories.tsx +1 -1
- package/src/components/TextField/textfield.scss +12 -0
- package/src/components/TextField/useTextValidation.ts +103 -0
- package/src/components/Tooltip/tooltip.scss +1 -1
- package/src/components/Tree/Tree.stories.tsx +7 -1
- package/src/components/Tree/Tree.tsx +2 -1
- package/src/components/Typography/Highlighter.tsx +2 -2
- package/src/components/Typography/OverflowText.tsx +2 -2
- package/src/components/Typography/WhiteSpaceContainer.tsx +69 -21
- package/src/components/Typography/index.ts +25 -0
- package/src/components/Typography/stories/WhiteSpaceContainer.stories.tsx +55 -0
- package/src/components/Typography/typography.scss +3 -2
- package/src/components/Workspace/WorkspaceContent.tsx +1 -1
- package/src/components/index.scss +5 -0
- package/src/components/index.ts +5 -0
- package/src/includes/carbon-components/_components.scss +11 -0
- package/src/includes/carbon-components/_requisits.scss +18 -0
- package/src/includes/carbon-components/_variables.scss +50 -53
- package/src/index.scss +4 -105
- package/src/index.ts +6 -16
|
@@ -1,16 +1,33 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import {default as ReactFlowOriginal, ReactFlowProps as ReactFlowOriginalProps} from "react-flow-renderer";
|
|
3
|
-
import {
|
|
3
|
+
import {ReactFlowMarkers} from "../../../extensions/react-flow/markers/ReactFlowMarkers";
|
|
4
4
|
import * as unspecifiedConfig from "./../configuration/unspecified";
|
|
5
5
|
import * as graphConfig from "./../configuration/graph";
|
|
6
6
|
import * as workflowConfig from "./../configuration/workflow";
|
|
7
7
|
import * as linkingConfig from "./../configuration/linking";
|
|
8
|
+
import {useReactFlowScrollOnDrag} from "../extensions/scrollOnDragHook";
|
|
8
9
|
|
|
9
10
|
export interface ReactFlowProps extends ReactFlowOriginalProps {
|
|
10
11
|
/**
|
|
11
12
|
* Load `ReactFlow` component with pre-configured values for `nodeTypes` and `edgeTypes`
|
|
12
13
|
*/
|
|
13
14
|
configuration?: "unspecified" | "graph" | "workflow" | "linking";
|
|
15
|
+
|
|
16
|
+
/** If defined the canvas scrolls on all drag operations (node, selection, edge connect)
|
|
17
|
+
* when the mouse pointer comes near the canvas borders or goes beyond them.
|
|
18
|
+
* The `id` property of the ReactFlow component must be set in order for this to work.
|
|
19
|
+
*
|
|
20
|
+
* NOTE: If scrollOnDrag is defined, a ReactFlowProvider must be wrapped around this component (or a parent). */
|
|
21
|
+
scrollOnDrag?: {
|
|
22
|
+
/** Time in milliseconds to wait before the canvas scrolls the next step. */
|
|
23
|
+
scrollInterval: number
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The size of each scroll step.
|
|
27
|
+
* This should be a number between 0.0 - 1.0.
|
|
28
|
+
* E.g. a value of 0.25 will lead to a scroll step size of a quarter of the visible canvas. */
|
|
29
|
+
scrollStepSize: number
|
|
30
|
+
}
|
|
14
31
|
}
|
|
15
32
|
|
|
16
33
|
/**
|
|
@@ -20,10 +37,17 @@ export interface ReactFlowProps extends ReactFlowOriginalProps {
|
|
|
20
37
|
export const ReactFlow = React.forwardRef<HTMLDivElement, ReactFlowProps>((
|
|
21
38
|
{
|
|
22
39
|
configuration = "unspecified",
|
|
40
|
+
scrollOnDrag,
|
|
23
41
|
children,
|
|
24
42
|
...originalProps
|
|
25
43
|
},
|
|
26
44
|
ref) => {
|
|
45
|
+
|
|
46
|
+
const scrollOnDragFunctions = useReactFlowScrollOnDrag({
|
|
47
|
+
reactFlowProps: originalProps,
|
|
48
|
+
scrollOnDrag
|
|
49
|
+
})
|
|
50
|
+
|
|
27
51
|
const configReactFlow = {
|
|
28
52
|
unspecified: unspecifiedConfig,
|
|
29
53
|
graph: graphConfig,
|
|
@@ -37,6 +61,7 @@ export const ReactFlow = React.forwardRef<HTMLDivElement, ReactFlowProps>((
|
|
|
37
61
|
nodeTypes={ configReactFlow[configuration].nodeTypes }
|
|
38
62
|
edgeTypes={ configReactFlow[configuration].edgeTypes }
|
|
39
63
|
{...originalProps}
|
|
64
|
+
{...scrollOnDragFunctions}
|
|
40
65
|
>
|
|
41
66
|
{ children }
|
|
42
67
|
<ReactFlowMarkers />
|
|
@@ -27,13 +27,17 @@ export interface StickyNoteModalProps {
|
|
|
27
27
|
translate: (key: StickyNoteModalTranslationKeys) => string;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
export const StickyNoteModal: React.FC<StickyNoteModalProps> = ({
|
|
30
|
+
export const StickyNoteModal: React.FC<StickyNoteModalProps> = React.memo(({
|
|
31
|
+
metaData,
|
|
32
|
+
onClose,
|
|
33
|
+
onSubmit,
|
|
34
|
+
translate
|
|
35
|
+
}) => {
|
|
31
36
|
const refNote = React.useRef<string>(metaData?.note ?? "");
|
|
32
37
|
const [color, setSelectedColor] = React.useState<string>(metaData?.color ?? "");
|
|
33
|
-
const noteColors: [string, string][] = Object.entries(getColorConfiguration("stickynotes")).map(
|
|
34
|
-
key,
|
|
35
|
-
|
|
36
|
-
]);
|
|
38
|
+
const noteColors: [string, string][] = Object.entries(getColorConfiguration("stickynotes")).map(
|
|
39
|
+
([key, value]) => [key, value as string]
|
|
40
|
+
);
|
|
37
41
|
|
|
38
42
|
React.useEffect(() => {
|
|
39
43
|
if (!color && noteColors[0][1]) {
|
|
@@ -131,4 +135,4 @@ export const StickyNoteModal: React.FC<StickyNoteModalProps> = ({ metaData, onCl
|
|
|
131
135
|
</FieldItem>
|
|
132
136
|
</SimpleDialog>
|
|
133
137
|
);
|
|
134
|
-
};
|
|
138
|
+
});
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import {OnLoadParams, useStoreState} from "react-flow-renderer";
|
|
2
|
+
import React, {MouseEvent as ReactMouseEvent, useCallback} from "react";
|
|
3
|
+
import {
|
|
4
|
+
Edge,
|
|
5
|
+
Node,
|
|
6
|
+
OnConnectStartFunc,
|
|
7
|
+
OnConnectStartParams,
|
|
8
|
+
OnConnectStopFunc,
|
|
9
|
+
Transform
|
|
10
|
+
} from "react-flow-renderer/dist/types";
|
|
11
|
+
import {ReactFlowProps} from "../ReactFlow/ReactFlow";
|
|
12
|
+
|
|
13
|
+
interface IProps {
|
|
14
|
+
/** The original react-flow props. */
|
|
15
|
+
reactFlowProps: ReactFlowProps
|
|
16
|
+
/** If defined the canvas scrolls on all drag operations (node, selection, edge connect)
|
|
17
|
+
* when the mouse pointer comes near the canvas borders or goes beyond them.
|
|
18
|
+
* The `id` property of the ReactFlow component must be set in order for this to work. */
|
|
19
|
+
scrollOnDrag?: {
|
|
20
|
+
/** Time in milliseconds to wait before the canvas scrolls the next step. */
|
|
21
|
+
scrollInterval: number
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The size of each scroll step.
|
|
25
|
+
* This should be a number between 0.0 - 1.0.
|
|
26
|
+
* E.g. a value of 0.25 will lead to a scroll step size of a quarter of the visible canvas. */
|
|
27
|
+
scrollStepSize: number
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface ScrollState {
|
|
32
|
+
// The react-flow instance
|
|
33
|
+
reactFlowInstance?: OnLoadParams
|
|
34
|
+
// The current x position of the react-flow view
|
|
35
|
+
currentX: number
|
|
36
|
+
// The current y position of the react-flow view
|
|
37
|
+
currentY: number
|
|
38
|
+
// The current Zoom level
|
|
39
|
+
currentZoom: number
|
|
40
|
+
// The current scroll function callback, when scrolling is active
|
|
41
|
+
scrollTaskId?: NodeJS.Timeout
|
|
42
|
+
// If a warning of the react-flow instance with the given ID has not been found
|
|
43
|
+
loggedWarning: boolean,
|
|
44
|
+
// If the x-axis is currently being scrolled
|
|
45
|
+
scrollX: boolean,
|
|
46
|
+
// If the y-axis is currently being scrolled
|
|
47
|
+
scrollY: boolean
|
|
48
|
+
// Only if this is true the canvas will scroll when moving the mouse past it
|
|
49
|
+
draggingOperationActive: boolean
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
type ReturnType = Pick<ReactFlowProps, "onLoad" | "onNodeDragStart" | "onNodeDragStop" | "onConnectStart" | "onConnectStop" |
|
|
53
|
+
"onSelectionDragStart" | "onSelectionDragStop" | "onEdgeUpdateStart" | "onEdgeUpdateEnd">
|
|
54
|
+
|
|
55
|
+
/** Handles the scrolling of the react-flow canvas on all drag operations when the mouse pointer gets near or over the borders.
|
|
56
|
+
* The return value contains the wrapped react-flow callback functions that need to be handed over to the react-flow component. */
|
|
57
|
+
export const useReactFlowScrollOnDrag = ({
|
|
58
|
+
reactFlowProps,
|
|
59
|
+
scrollOnDrag
|
|
60
|
+
}: IProps): ReturnType => {
|
|
61
|
+
/** Tracks the zoom on drag to border functionality. */
|
|
62
|
+
const scrollState = React.useRef<ScrollState>({
|
|
63
|
+
reactFlowInstance: undefined,
|
|
64
|
+
currentX: 0,
|
|
65
|
+
currentY: 0,
|
|
66
|
+
currentZoom: 1,
|
|
67
|
+
loggedWarning: false,
|
|
68
|
+
scrollX: false,
|
|
69
|
+
scrollY: false,
|
|
70
|
+
draggingOperationActive: false
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
const useStoreStateInternal = (): Transform => {
|
|
74
|
+
try {
|
|
75
|
+
return useStoreState((state) => state.transform)
|
|
76
|
+
} catch(ex) {
|
|
77
|
+
if(reactFlowProps.id && scrollOnDrag) {
|
|
78
|
+
console.warn("Scroll on drag is not correctly working. Reason: " + ex)
|
|
79
|
+
}
|
|
80
|
+
return [0, 0, 1]
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** The current position and zoom factor of the view port. */
|
|
85
|
+
const [currentX, currentY, currentZoom] = useStoreStateInternal()
|
|
86
|
+
scrollState.current.currentX = currentX
|
|
87
|
+
scrollState.current.currentY = currentY
|
|
88
|
+
scrollState.current.currentZoom = currentZoom
|
|
89
|
+
|
|
90
|
+
const originalOnLoad = reactFlowProps.onLoad
|
|
91
|
+
const originalOnNodeDragStart = reactFlowProps.onNodeDragStart
|
|
92
|
+
const originalOnNodeDragStop = reactFlowProps.onNodeDragStop
|
|
93
|
+
const originalOnConnectStart = reactFlowProps.onConnectStart
|
|
94
|
+
const originalOnConnectStop = reactFlowProps.onConnectStop
|
|
95
|
+
const originalOnSelectionDragStart = reactFlowProps.onSelectionDragStart
|
|
96
|
+
const originalOnSelectionDragStop = reactFlowProps.onSelectionDragStop
|
|
97
|
+
const originalOnEdgeUpdateStart = reactFlowProps.onEdgeUpdateStart
|
|
98
|
+
const originalOnEdgeUpdateEnd = reactFlowProps.onEdgeUpdateEnd
|
|
99
|
+
|
|
100
|
+
const scrollInterval = scrollOnDrag?.scrollInterval
|
|
101
|
+
const scrollStepSize = scrollOnDrag?.scrollStepSize
|
|
102
|
+
|
|
103
|
+
const reactFlowInstanceId = reactFlowProps.id
|
|
104
|
+
|
|
105
|
+
const clearIntervalIfExists = React.useCallback(() => {
|
|
106
|
+
if(scrollState.current.scrollTaskId) {
|
|
107
|
+
clearInterval(scrollState.current.scrollTaskId)
|
|
108
|
+
}
|
|
109
|
+
}, [])
|
|
110
|
+
|
|
111
|
+
const setScrolling = React.useCallback((active: boolean) => {
|
|
112
|
+
scrollState.current.draggingOperationActive = active
|
|
113
|
+
if(!active) {
|
|
114
|
+
clearIntervalIfExists()
|
|
115
|
+
}
|
|
116
|
+
}, [clearIntervalIfExists])
|
|
117
|
+
|
|
118
|
+
// Handle scrolling if any operation is active e.g. connecting or dragging a node
|
|
119
|
+
React.useEffect(() => {
|
|
120
|
+
if(scrollInterval && scrollStepSize && reactFlowInstanceId) {
|
|
121
|
+
const handleScrolling = (event: MouseEvent) => {
|
|
122
|
+
const state = scrollState.current
|
|
123
|
+
if(!state.draggingOperationActive) {
|
|
124
|
+
clearIntervalIfExists()
|
|
125
|
+
return
|
|
126
|
+
}
|
|
127
|
+
// Check if mouse pointer is outside of the canvas
|
|
128
|
+
const canvasElement = document.getElementById(reactFlowInstanceId)
|
|
129
|
+
if (!canvasElement) {
|
|
130
|
+
if (!state.loggedWarning) {
|
|
131
|
+
console.warn("No element found with ID " + reactFlowInstanceId)
|
|
132
|
+
state.loggedWarning = true
|
|
133
|
+
}
|
|
134
|
+
return
|
|
135
|
+
}
|
|
136
|
+
const boundingRect = canvasElement.getBoundingClientRect()
|
|
137
|
+
const xStepSize = boundingRect.width * scrollStepSize
|
|
138
|
+
const yStepSize = boundingRect.height * scrollStepSize
|
|
139
|
+
if (boundingRect.top > event.clientY || boundingRect.bottom < event.clientY ||
|
|
140
|
+
boundingRect.left > event.clientX || boundingRect.right < event.clientX) {
|
|
141
|
+
const scrollX: number = boundingRect.left > event.clientX ?
|
|
142
|
+
xStepSize :
|
|
143
|
+
boundingRect.right < event.clientX ?
|
|
144
|
+
-xStepSize :
|
|
145
|
+
0
|
|
146
|
+
const scrollY: number = boundingRect.top > event.clientY ?
|
|
147
|
+
yStepSize :
|
|
148
|
+
boundingRect.bottom < event.clientY ?
|
|
149
|
+
-yStepSize :
|
|
150
|
+
0
|
|
151
|
+
if (state.scrollY === (scrollY !== 0) && state.scrollX === (scrollX !== 0)) {
|
|
152
|
+
// Nothing has changed, do not change interval function
|
|
153
|
+
return
|
|
154
|
+
}
|
|
155
|
+
clearIntervalIfExists()
|
|
156
|
+
state.scrollTaskId = setInterval(() => {
|
|
157
|
+
state.reactFlowInstance?.setTransform({
|
|
158
|
+
x: state.currentX + scrollX,
|
|
159
|
+
y: state.currentY + scrollY,
|
|
160
|
+
zoom: state.currentZoom
|
|
161
|
+
})
|
|
162
|
+
}, scrollInterval)
|
|
163
|
+
} else {
|
|
164
|
+
clearIntervalIfExists()
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
const disableScrollingOnMouseUp = () => {
|
|
168
|
+
scrollState.current.draggingOperationActive = false
|
|
169
|
+
clearIntervalIfExists()
|
|
170
|
+
}
|
|
171
|
+
document.addEventListener('mousemove', handleScrolling);
|
|
172
|
+
document.addEventListener("mouseup", disableScrollingOnMouseUp)
|
|
173
|
+
return () => {
|
|
174
|
+
document.removeEventListener('mousemove', handleScrolling)
|
|
175
|
+
document.removeEventListener("mouseup", disableScrollingOnMouseUp)
|
|
176
|
+
}
|
|
177
|
+
} else {
|
|
178
|
+
return undefined
|
|
179
|
+
}
|
|
180
|
+
}, [scrollInterval, scrollStepSize, reactFlowInstanceId, clearIntervalIfExists])
|
|
181
|
+
|
|
182
|
+
const onLoad = useCallback(
|
|
183
|
+
(rfi: OnLoadParams) => {
|
|
184
|
+
scrollState.current.reactFlowInstance = rfi;
|
|
185
|
+
originalOnLoad?.(rfi)
|
|
186
|
+
},
|
|
187
|
+
[originalOnLoad]
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
/** Wrap original callbacks to turn scrolling on and off. */
|
|
191
|
+
const onConnectStart: OnConnectStartFunc = React.useCallback((event: ReactMouseEvent, params: OnConnectStartParams) => {
|
|
192
|
+
setScrolling(true)
|
|
193
|
+
originalOnConnectStart?.(event, params)
|
|
194
|
+
}, [originalOnConnectStart, setScrolling])
|
|
195
|
+
|
|
196
|
+
const onConnectStop: OnConnectStopFunc = React.useCallback((event: MouseEvent) => {
|
|
197
|
+
setScrolling(false)
|
|
198
|
+
originalOnConnectStop?.(event)
|
|
199
|
+
}, [originalOnConnectStop, setScrolling])
|
|
200
|
+
|
|
201
|
+
const onNodeDragStart = React.useCallback((event: ReactMouseEvent, node: Node) => {
|
|
202
|
+
setScrolling(true)
|
|
203
|
+
originalOnNodeDragStart?.(event, node)
|
|
204
|
+
}, [originalOnNodeDragStart, setScrolling])
|
|
205
|
+
|
|
206
|
+
const onNodeDragStop = React.useCallback((event: ReactMouseEvent, node: Node) => {
|
|
207
|
+
setScrolling(false)
|
|
208
|
+
originalOnNodeDragStop?.(event, node)
|
|
209
|
+
}, [originalOnNodeDragStop, setScrolling])
|
|
210
|
+
|
|
211
|
+
const onSelectionDragStart = React.useCallback((event: ReactMouseEvent, nodes: Node[]) => {
|
|
212
|
+
setScrolling(true)
|
|
213
|
+
originalOnSelectionDragStart?.(event, nodes)
|
|
214
|
+
}, [originalOnSelectionDragStart, setScrolling])
|
|
215
|
+
|
|
216
|
+
const onSelectionDragStop = React.useCallback((event: ReactMouseEvent, nodes: Node[]) => {
|
|
217
|
+
setScrolling(false)
|
|
218
|
+
originalOnSelectionDragStop?.(event, nodes)
|
|
219
|
+
}, [originalOnSelectionDragStop, setScrolling])
|
|
220
|
+
|
|
221
|
+
const onEdgeUpdateStart = React.useCallback((event: ReactMouseEvent, edge: Edge) => {
|
|
222
|
+
setScrolling(true)
|
|
223
|
+
originalOnEdgeUpdateStart?.(event, edge)
|
|
224
|
+
}, [originalOnEdgeUpdateStart, setScrolling])
|
|
225
|
+
|
|
226
|
+
const onEdgeUpdateEnd = React.useCallback((event: MouseEvent, edge: Edge) => {
|
|
227
|
+
setScrolling(false)
|
|
228
|
+
originalOnEdgeUpdateEnd?.(event, edge)
|
|
229
|
+
}, [originalOnEdgeUpdateEnd, setScrolling])
|
|
230
|
+
|
|
231
|
+
if (!reactFlowProps.id || !scrollOnDrag) {
|
|
232
|
+
// No instance ID or config available, return empty object that will not overwrite any react-flow config parameters
|
|
233
|
+
return {}
|
|
234
|
+
} else {
|
|
235
|
+
return {
|
|
236
|
+
onLoad,
|
|
237
|
+
onNodeDragStart,
|
|
238
|
+
onNodeDragStop,
|
|
239
|
+
onConnectStart,
|
|
240
|
+
onConnectStop,
|
|
241
|
+
onSelectionDragStart,
|
|
242
|
+
onSelectionDragStop,
|
|
243
|
+
onEdgeUpdateStart,
|
|
244
|
+
onEdgeUpdateEnd
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
2
2
|
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
export type IntentTypes = "neutral" | "primary" | "accent" | "info" | "success" | "warning" | "danger";
|
|
4
|
+
|
|
5
|
+
export const Definitions: { [key: string]: IntentTypes; } = {
|
|
6
|
+
PRIMARY: "primary",
|
|
7
|
+
ACCENT: "accent",
|
|
8
|
+
NEUTRAL: "neutral",
|
|
9
|
+
SUCCESS: "success",
|
|
10
|
+
INFO: "info",
|
|
11
|
+
WARNING: "warning",
|
|
12
|
+
DANGER: "danger",
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const intentClassName = (intent: IntentTypes) => {
|
|
16
|
+
return `${eccgui}-intent--${intent}`
|
|
11
17
|
}
|
|
12
18
|
|
|
13
19
|
const classNamesCreation = () => {
|
|
14
|
-
const intentClasses = {
|
|
20
|
+
const intentClasses : { [key: string]: string; } = {};
|
|
15
21
|
for (let intentDefinition in Definitions) {
|
|
16
|
-
intentClasses[intentDefinition] =
|
|
22
|
+
intentClasses[intentDefinition] = intentClassName(Definitions[intentDefinition]);
|
|
17
23
|
}
|
|
18
24
|
return intentClasses;
|
|
19
25
|
}
|
|
20
26
|
|
|
21
27
|
export const ClassNames = classNamesCreation();
|
|
22
|
-
|
|
23
|
-
export type IntentTypes = typeof Definitions[keyof typeof Definitions];
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/** Zero width invisible characters, i.e. they do not change the space between 2 other characters. */
|
|
2
|
+
const internalInvisibleZeroWidthCharacterCodePoints: InternalInvisibleCharacter[] = [
|
|
3
|
+
{ codePoint: 11, label: "Vertical Tabulation" },
|
|
4
|
+
{ codePoint: 173, label: "Soft hyphen" },
|
|
5
|
+
{ codePoint: 847, label: "Combining grapheme joiner" },
|
|
6
|
+
{ codePoint: 1564, label: "Arabic letter mark" },
|
|
7
|
+
{ codePoint: [6068, 6069], label: "Khmer vowel inherent" },
|
|
8
|
+
{ codePoint: [6155, 6158], label: "Mongolian special characters" },
|
|
9
|
+
{ codePoint: 8203, label: "Zero Width Space" },
|
|
10
|
+
{ codePoint: 8204, label: "Zero Width Non-Joiner" },
|
|
11
|
+
{ codePoint: 8205, label: "Zero Width Joiner" },
|
|
12
|
+
{ codePoint: 8206, label: "Left-To-Right Mark" },
|
|
13
|
+
{ codePoint: 8207, label: "Right-To-Left Mark" },
|
|
14
|
+
{ codePoint: [8234, 8238], label: "zero width character" },
|
|
15
|
+
// Word joiner - Nominal Digit Shapes
|
|
16
|
+
{ codePoint: [8288, 8303], label: "zero width character" },
|
|
17
|
+
{ codePoint: [65024, 65039], label: "Variation selectors" },
|
|
18
|
+
{ codePoint: 65279, label: "Zero Width No-Break Space" },
|
|
19
|
+
{ codePoint: [65520, 65528], label: "Specials" },
|
|
20
|
+
{ codePoint: 65532, label: "Object Replacement Character" },
|
|
21
|
+
{ codePoint: [119155, 119162], label: "Invisible Musical Symbol" },
|
|
22
|
+
{ codePoint: [917504, 917631], label: "Tags" },
|
|
23
|
+
{ codePoint: [917760, 917999], label: "Variation Selectors" }
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
const toHex = (codepoint: number): string => codepoint.toString(16).toUpperCase()
|
|
27
|
+
|
|
28
|
+
const padWithZeroes = (hexString: string): string => {
|
|
29
|
+
if(hexString.length % 2 === 1) {
|
|
30
|
+
return `0${hexString}`
|
|
31
|
+
}
|
|
32
|
+
return hexString
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** All characters that are considered invisible zero-width characters that e.g. need to be handled in input fields. */
|
|
36
|
+
const invisibleZeroWidthCharacterCodePoints: InvisibleCharacter[] = internalInvisibleZeroWidthCharacterCodePoints.map(cp => {
|
|
37
|
+
const create = (codePoint: number, label?: string) => {
|
|
38
|
+
const hexString = toHex(codePoint)
|
|
39
|
+
const unicodeHexRepresentation = `U+${padWithZeroes(hexString)}`
|
|
40
|
+
return {
|
|
41
|
+
codePoint: codePoint,
|
|
42
|
+
label: label ?? unicodeHexRepresentation,
|
|
43
|
+
hexString,
|
|
44
|
+
fullLabel: label ? `${label} (${unicodeHexRepresentation})` : unicodeHexRepresentation
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if(Array.isArray(cp.codePoint)) {
|
|
48
|
+
const codePoints: InvisibleCharacter[] = []
|
|
49
|
+
const [from, to] = cp.codePoint
|
|
50
|
+
if(from < 0 || to < 0 || from > to) {
|
|
51
|
+
throw new Error(`Invalid code point range specified: [${from}, ${to}]`)
|
|
52
|
+
}
|
|
53
|
+
for(let currentCp = from; currentCp <= to; currentCp++) {
|
|
54
|
+
codePoints.push(create(currentCp, cp.label))
|
|
55
|
+
}
|
|
56
|
+
return codePoints
|
|
57
|
+
} else {
|
|
58
|
+
return create(cp.codePoint, cp.label)
|
|
59
|
+
}
|
|
60
|
+
}).flat()
|
|
61
|
+
|
|
62
|
+
const createInvisibleZeroWidthCharacterCodePointsRegex = () => {
|
|
63
|
+
return new RegExp(
|
|
64
|
+
`([${
|
|
65
|
+
invisibleZeroWidthCharacterCodePoints
|
|
66
|
+
.map(cp => `\\u{${cp.hexString}}`)
|
|
67
|
+
.join("")
|
|
68
|
+
}])`,
|
|
69
|
+
"ug"
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Map from codepoint to invisible character. */
|
|
74
|
+
const invisibleZeroWidthCharacterCodePointsMap: Map<number, InvisibleCharacter> = new Map(
|
|
75
|
+
invisibleZeroWidthCharacterCodePoints.map(cp => [cp.codePoint, cp])
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
const clearStringFromInvisibleCharacters = (inputString: string): string => {
|
|
79
|
+
const regex = createInvisibleZeroWidthCharacterCodePointsRegex()
|
|
80
|
+
return inputString.replaceAll(regex, "")
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
interface InternalInvisibleCharacter {
|
|
84
|
+
/** Code point or code point range (inclusive on both sides). */
|
|
85
|
+
codePoint: number | [number, number],
|
|
86
|
+
/** Human readable label for code point. */
|
|
87
|
+
label?: string
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
type InvisibleCharacter = {
|
|
91
|
+
/** Code point. */
|
|
92
|
+
codePoint: number,
|
|
93
|
+
/** Human readable label for code point. */
|
|
94
|
+
label: string
|
|
95
|
+
/** The hex representation of the code point, e.g. "200B" */
|
|
96
|
+
hexString: string
|
|
97
|
+
/** The label plus the hex value. */
|
|
98
|
+
fullLabel: string
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const invisibleZeroWidthCharacters = {
|
|
102
|
+
codePoints: invisibleZeroWidthCharacterCodePoints,
|
|
103
|
+
codePointMap: invisibleZeroWidthCharacterCodePointsMap,
|
|
104
|
+
createRegex: createInvisibleZeroWidthCharacterCodePointsRegex,
|
|
105
|
+
clearString: clearStringFromInvisibleCharacters
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const moduleObject = {
|
|
109
|
+
invisibleZeroWidthCharacters
|
|
110
|
+
}
|
|
111
|
+
export default moduleObject
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
// lib import
|
|
2
|
+
@use "~@carbon/styles/scss/components/accordion/accordion";
|
|
3
|
+
@include accordion.accordion;
|
|
4
|
+
|
|
1
5
|
// own vars
|
|
2
6
|
$eccgui-color-accordion-background-elevated: rgba($eccgui-color-accent, 0.1) !default;
|
|
3
7
|
$eccgui-color-accordion-toggler-hover: $menu-item-color-hover !default;
|
|
4
8
|
$eccgui-color-accordion-toggler-elevated-hover: mix($eccgui-color-accordion-background-elevated, $eccgui-color-accordion-toggler-hover, 50%) !default;
|
|
5
9
|
|
|
6
|
-
// lib import
|
|
7
|
-
@import "~carbon-components/scss/components/accordion/accordion";
|
|
8
|
-
|
|
9
10
|
// changes
|
|
10
11
|
|
|
11
12
|
.#{$prefix}--accordion__heading {
|
|
@@ -58,7 +58,7 @@ function ApplicationTitle({
|
|
|
58
58
|
}: IApplicationTitleProps) {
|
|
59
59
|
|
|
60
60
|
const classApplication = `${eccgui}-application__title`;
|
|
61
|
-
const classNotDisplayed = isNotDisplayed || (!isApplicationSidebarExpanded && typeof isNotDisplayed === "undefined") ? "
|
|
61
|
+
const classNotDisplayed = isNotDisplayed || (!isApplicationSidebarExpanded && typeof isNotDisplayed === "undefined") ? "cds--visually-hidden" : "";
|
|
62
62
|
const classAlignedSidebar = isAlignedWithSidebar || isApplicationSidebarExpanded ? `${eccgui}-application__title--withsidebar` : "";
|
|
63
63
|
|
|
64
64
|
return (
|
|
@@ -77,7 +77,7 @@ function ApplicationTitle({
|
|
|
77
77
|
)}
|
|
78
78
|
{!!prefix && (
|
|
79
79
|
<>
|
|
80
|
-
<span className="
|
|
80
|
+
<span className="cds--header__name--prefix">{prefix}</span>
|
|
81
81
|
|
|
82
82
|
</>
|
|
83
83
|
)}
|
|
@@ -45,10 +45,10 @@ $shell-header-icon-02: $eccgui-color-applicationheader-text !default;
|
|
|
45
45
|
$shell-header-icon-03: $eccgui-color-applicationheader-text !default;
|
|
46
46
|
|
|
47
47
|
/// Item link
|
|
48
|
-
$shell-header-link: $
|
|
48
|
+
$shell-header-link: $blue-60 !default;
|
|
49
49
|
|
|
50
50
|
// load library sub component
|
|
51
|
-
@import '
|
|
51
|
+
@import '~@carbon/styles/scss/components/ui-shell/header/index';
|
|
52
52
|
|
|
53
53
|
// tweack original layout
|
|
54
54
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
$ui-02: $eccgui-color-workspace-background !default;
|
|
2
2
|
|
|
3
|
-
@import '
|
|
3
|
+
@import '~@carbon/styles/scss/components/ui-shell/side-nav/index';
|
|
4
4
|
|
|
5
|
-
//
|
|
5
|
+
// tweak original layout
|
|
6
6
|
|
|
7
7
|
.#{$prefix}--side-nav--ux {
|
|
8
8
|
top: mini-units(8);
|
|
@@ -10,13 +10,6 @@ $ui-02: $eccgui-color-workspace-background !default;
|
|
|
10
10
|
max-width: mini-units(40);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
/*
|
|
14
|
-
.#{$prefix}--side-nav.#{$prefix}--side-nav--rail:not(.#{$prefix}--side-nav--fixed):hover,
|
|
15
|
-
.#{$prefix}--side-nav--expanded, .#{$prefix}--side-nav--collapsed {
|
|
16
|
-
width: mini-units(40);
|
|
17
|
-
}
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
13
|
.#{$prefix}--side-nav.#{$prefix}--side-nav--rail:not(.#{$prefix}--side-nav--fixed) {
|
|
21
14
|
transform: translateX(0);
|
|
22
15
|
width: mini-units(8);
|
|
@@ -30,7 +30,7 @@ $shell-panel-text-02: $eccgui-color-applicationheader-text !default;
|
|
|
30
30
|
/// Header panel focus border
|
|
31
31
|
$shell-panel-focus: adjust-color($eccgui-color-applicationheader-text, $lightness: 39%) !default;
|
|
32
32
|
|
|
33
|
-
@import "
|
|
33
|
+
@import "~@carbon/styles/scss/components/ui-shell/header-panel/index";
|
|
34
34
|
|
|
35
35
|
// tweack original layout
|
|
36
36
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @import 'config';
|
|
2
|
-
@import '
|
|
2
|
+
@import '~@carbon/styles/scss/components/ui-shell/functions';
|
|
3
3
|
@import 'header';
|
|
4
4
|
@import 'toolbar';
|
|
5
|
-
// @import '
|
|
6
|
-
// @import '
|
|
5
|
+
// @import '~@carbon/styles/scss/components/ui-shell/product-switcher';
|
|
6
|
+
// @import '~@carbon/styles/scss/components/ui-shell/switcher';
|
|
7
7
|
@import 'sidebar';
|
|
8
|
-
// @import '
|
|
8
|
+
// @import '~@carbon/styles/scss/components/ui-shell/navigation-menu';
|
|
9
9
|
@import 'content';
|
|
@@ -1,24 +1,29 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {IElementWidth, IRenderModifiers} from "./AutoCompleteField";
|
|
2
|
+
import { IElementWidth, IRenderModifiers } from "./AutoCompleteField";
|
|
3
3
|
import OverflowText from "../Typography/OverflowText";
|
|
4
4
|
import MenuItem from "../Menu/MenuItem";
|
|
5
|
-
import {
|
|
5
|
+
import { TestIconProps } from "./../Icon/TestIcon";
|
|
6
|
+
import { ValidIconName } from "../Icon/canonicalIconNames";
|
|
6
7
|
|
|
7
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Returns a function to be used in an AutoComplete widget for rendering custom elements based on the query string.
|
|
8
10
|
*
|
|
9
11
|
* @param itemTextRenderer The text or element that should be displayed for the new custom item suggestion.
|
|
10
12
|
* @param iconName Optional icon to show left to the text.
|
|
11
13
|
*/
|
|
12
14
|
export const createNewItemRendererFactory = (
|
|
13
15
|
itemTextRenderer: (query: string, styleWidth: IElementWidth) => string | JSX.Element,
|
|
14
|
-
iconName?: ValidIconName
|
|
16
|
+
iconName?: ValidIconName | React.ReactElement<TestIconProps>
|
|
17
|
+
) => {
|
|
15
18
|
// Return custom render function
|
|
16
19
|
return (query: string, modifiers: IRenderModifiers, handleClick: React.MouseEventHandler<HTMLElement>) => {
|
|
17
20
|
let textElement = itemTextRenderer(query, modifiers.styleWidth)
|
|
18
|
-
if(typeof textElement === "string") {
|
|
19
|
-
textElement =
|
|
20
|
-
{
|
|
21
|
-
|
|
21
|
+
if (typeof textElement === "string") {
|
|
22
|
+
textElement = (
|
|
23
|
+
<OverflowText style={modifiers.styleWidth}>
|
|
24
|
+
{textElement.trim() !== "" ? textElement : `Create option '${query}'`}
|
|
25
|
+
</OverflowText>
|
|
26
|
+
)
|
|
22
27
|
}
|
|
23
28
|
return (
|
|
24
29
|
<MenuItem
|