@eccenca/gui-elements 23.0.0-rc.1 → 23.0.0-rc.3
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 +41 -0
- package/dist/cjs/cmem/ActivityControl/ActivityControlWidget.js +4 -10
- package/dist/cjs/cmem/ActivityControl/ActivityControlWidget.js.map +1 -1
- package/dist/cjs/cmem/index.js +3 -1
- package/dist/cjs/cmem/index.js.map +1 -1
- package/dist/cjs/cmem/react-flow/ReactFlow/ReactFlow.js +2 -1
- package/dist/cjs/cmem/react-flow/ReactFlow/ReactFlow.js.map +1 -1
- package/dist/cjs/cmem/react-flow/StickyNoteModal/StickyNoteModal.js +64 -0
- package/dist/cjs/cmem/react-flow/StickyNoteModal/StickyNoteModal.js.map +1 -0
- package/dist/cjs/cmem/react-flow/configuration/graph.js.map +1 -1
- package/dist/cjs/cmem/react-flow/configuration/linking.js +2 -0
- package/dist/cjs/cmem/react-flow/configuration/linking.js.map +1 -1
- package/dist/cjs/cmem/react-flow/configuration/typing.js +35 -0
- package/dist/cjs/cmem/react-flow/configuration/typing.js.map +1 -0
- package/dist/cjs/cmem/react-flow/configuration/workflow.js +2 -0
- package/dist/cjs/cmem/react-flow/configuration/workflow.js.map +1 -1
- package/dist/cjs/cmem/react-flow/nodes/StickyNoteNode.js +42 -0
- package/dist/cjs/cmem/react-flow/nodes/StickyNoteNode.js.map +1 -0
- package/dist/cjs/common/utils/CssCustomProperties.js +114 -0
- package/dist/cjs/common/utils/CssCustomProperties.js.map +1 -0
- package/dist/cjs/common/utils/getColorConfiguration.js +21 -0
- package/dist/cjs/common/utils/getColorConfiguration.js.map +1 -0
- package/dist/cjs/components/AutoSuggestion/AutoSuggestion.js +19 -19
- package/dist/cjs/components/AutoSuggestion/AutoSuggestion.js.map +1 -1
- package/dist/cjs/components/AutoSuggestion/AutoSuggestionList.js +4 -12
- package/dist/cjs/components/AutoSuggestion/AutoSuggestionList.js.map +1 -1
- package/dist/cjs/components/AutocompleteField/AutoCompleteField.js +15 -6
- package/dist/cjs/components/AutocompleteField/AutoCompleteField.js.map +1 -1
- package/dist/cjs/components/Breadcrumb/BreadcrumbItem.js +13 -4
- package/dist/cjs/components/Breadcrumb/BreadcrumbItem.js.map +1 -1
- package/dist/cjs/components/Breadcrumb/BreadcrumbList.js +11 -4
- package/dist/cjs/components/Breadcrumb/BreadcrumbList.js.map +1 -1
- package/dist/cjs/components/Button/Button.js +2 -2
- package/dist/cjs/components/Button/Button.js.map +1 -1
- package/dist/cjs/components/ContextOverlay/ContextMenu.js +6 -5
- package/dist/cjs/components/ContextOverlay/ContextMenu.js.map +1 -1
- package/dist/cjs/components/ContextOverlay/ContextOverlay.js +6 -8
- package/dist/cjs/components/ContextOverlay/ContextOverlay.js.map +1 -1
- package/dist/cjs/components/Form/FieldItem.js +2 -2
- package/dist/cjs/components/Form/FieldItem.js.map +1 -1
- package/dist/cjs/components/Icon/Icon.js +2 -2
- package/dist/cjs/components/Icon/Icon.js.map +1 -1
- package/dist/cjs/components/Icon/IconButton.js +2 -2
- package/dist/cjs/components/Icon/IconButton.js.map +1 -1
- package/dist/cjs/components/Icon/canonicalIconNames.js +124 -114
- package/dist/cjs/components/Icon/canonicalIconNames.js.map +1 -1
- package/dist/cjs/components/Label/Label.js +6 -6
- package/dist/cjs/components/Label/Label.js.map +1 -1
- package/dist/cjs/components/Menu/MenuItem.js +2 -5
- package/dist/cjs/components/Menu/MenuItem.js.map +1 -1
- package/dist/cjs/components/MultiSelect/MultiSelect.js +8 -10
- package/dist/cjs/components/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/cjs/components/Select/Select.js +29 -0
- package/dist/cjs/components/Select/Select.js.map +1 -0
- package/dist/cjs/components/Tabs/TabTitle.js +2 -4
- package/dist/cjs/components/Tabs/TabTitle.js.map +1 -1
- package/dist/cjs/components/Tag/Tag.js +2 -1
- package/dist/cjs/components/Tag/Tag.js.map +1 -1
- package/dist/cjs/components/Tooltip/Tooltip.js +7 -4
- package/dist/cjs/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/cjs/extensions/codemirror/CodeMirror.js +3 -3
- package/dist/cjs/extensions/codemirror/CodeMirror.js.map +1 -1
- package/dist/cjs/extensions/react-flow/edges/EdgeTools.js +2 -1
- package/dist/cjs/extensions/react-flow/edges/EdgeTools.js.map +1 -1
- package/dist/cjs/extensions/react-flow/handles/HandleContent.js +1 -1
- package/dist/cjs/extensions/react-flow/handles/HandleContent.js.map +1 -1
- package/dist/cjs/extensions/react-flow/index.js +6 -1
- package/dist/cjs/extensions/react-flow/index.js.map +1 -1
- package/dist/cjs/extensions/react-flow/minimap/MiniMap.js +3 -2
- package/dist/cjs/extensions/react-flow/minimap/MiniMap.js.map +1 -1
- package/dist/cjs/extensions/react-flow/minimap/utils.js +12 -6
- package/dist/cjs/extensions/react-flow/minimap/utils.js.map +1 -1
- package/dist/cjs/extensions/react-flow/nodes/NodeContent.js +74 -25
- package/dist/cjs/extensions/react-flow/nodes/NodeContent.js.map +1 -1
- package/dist/cjs/extensions/react-flow/nodes/NodeContentExtension.js +10 -6
- package/dist/cjs/extensions/react-flow/nodes/NodeContentExtension.js.map +1 -1
- package/dist/cjs/extensions/react-flow/nodes/NodeTools.js +1 -3
- package/dist/cjs/extensions/react-flow/nodes/NodeTools.js.map +1 -1
- package/dist/cjs/extensions/react-flow/nodes/nodeUtils.js +49 -0
- package/dist/cjs/extensions/react-flow/nodes/nodeUtils.js.map +1 -0
- package/dist/cjs/index.js +3 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/legacy-replacements/Tabs/Tabs.js +1 -1
- package/dist/cjs/legacy-replacements/Tabs/Tabs.js.map +1 -1
- package/dist/cjs/legacy-replacements/TextField/TextField.js +5 -8
- package/dist/cjs/legacy-replacements/TextField/TextField.js.map +1 -1
- package/dist/esm/cmem/ActivityControl/ActivityControlWidget.js +4 -10
- package/dist/esm/cmem/ActivityControl/ActivityControlWidget.js.map +1 -1
- package/dist/esm/cmem/index.js +1 -0
- package/dist/esm/cmem/index.js.map +1 -1
- package/dist/esm/cmem/react-flow/ReactFlow/ReactFlow.js +2 -1
- package/dist/esm/cmem/react-flow/ReactFlow/ReactFlow.js.map +1 -1
- package/dist/esm/cmem/react-flow/StickyNoteModal/StickyNoteModal.js +89 -0
- package/dist/esm/cmem/react-flow/StickyNoteModal/StickyNoteModal.js.map +1 -0
- package/dist/esm/cmem/react-flow/configuration/graph.js +1 -1
- package/dist/esm/cmem/react-flow/configuration/graph.js.map +1 -1
- package/dist/esm/cmem/react-flow/configuration/linking.js +3 -1
- package/dist/esm/cmem/react-flow/configuration/linking.js.map +1 -1
- package/dist/esm/cmem/react-flow/configuration/typing.js +32 -0
- package/dist/esm/cmem/react-flow/configuration/typing.js.map +1 -0
- package/dist/esm/cmem/react-flow/configuration/workflow.js +3 -1
- package/dist/esm/cmem/react-flow/configuration/workflow.js.map +1 -1
- package/dist/esm/cmem/react-flow/nodes/StickyNoteNode.js +31 -0
- package/dist/esm/cmem/react-flow/nodes/StickyNoteNode.js.map +1 -0
- package/dist/esm/common/utils/CssCustomProperties.js +154 -0
- package/dist/esm/common/utils/CssCustomProperties.js.map +1 -0
- package/dist/esm/common/utils/getColorConfiguration.js +16 -0
- package/dist/esm/common/utils/getColorConfiguration.js.map +1 -0
- package/dist/esm/components/AutoSuggestion/AutoSuggestion.js +23 -21
- package/dist/esm/components/AutoSuggestion/AutoSuggestion.js.map +1 -1
- package/dist/esm/components/AutoSuggestion/AutoSuggestionList.js +4 -12
- package/dist/esm/components/AutoSuggestion/AutoSuggestionList.js.map +1 -1
- package/dist/esm/components/AutocompleteField/AutoCompleteField.js +32 -23
- package/dist/esm/components/AutocompleteField/AutoCompleteField.js.map +1 -1
- package/dist/esm/components/Breadcrumb/BreadcrumbItem.js +13 -4
- package/dist/esm/components/Breadcrumb/BreadcrumbItem.js.map +1 -1
- package/dist/esm/components/Breadcrumb/BreadcrumbList.js +11 -4
- package/dist/esm/components/Breadcrumb/BreadcrumbList.js.map +1 -1
- package/dist/esm/components/Button/Button.js +2 -2
- package/dist/esm/components/Button/Button.js.map +1 -1
- package/dist/esm/components/ContextOverlay/ContextMenu.js +6 -5
- package/dist/esm/components/ContextOverlay/ContextMenu.js.map +1 -1
- package/dist/esm/components/ContextOverlay/ContextOverlay.js +6 -8
- package/dist/esm/components/ContextOverlay/ContextOverlay.js.map +1 -1
- package/dist/esm/components/Form/FieldItem.js +2 -2
- package/dist/esm/components/Form/FieldItem.js.map +1 -1
- package/dist/esm/components/Icon/Icon.js +2 -2
- package/dist/esm/components/Icon/Icon.js.map +1 -1
- package/dist/esm/components/Icon/IconButton.js +2 -2
- package/dist/esm/components/Icon/IconButton.js.map +1 -1
- package/dist/esm/components/Icon/canonicalIconNames.js +124 -114
- package/dist/esm/components/Icon/canonicalIconNames.js.map +1 -1
- package/dist/esm/components/Label/Label.js +6 -6
- package/dist/esm/components/Label/Label.js.map +1 -1
- package/dist/esm/components/Menu/MenuItem.js +2 -5
- package/dist/esm/components/Menu/MenuItem.js.map +1 -1
- package/dist/esm/components/MultiSelect/MultiSelect.js +5 -7
- package/dist/esm/components/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/esm/components/Select/Select.js +35 -0
- package/dist/esm/components/Select/Select.js.map +1 -0
- package/dist/esm/components/Tabs/TabTitle.js +2 -4
- package/dist/esm/components/Tabs/TabTitle.js.map +1 -1
- package/dist/esm/components/Tag/Tag.js +2 -1
- package/dist/esm/components/Tag/Tag.js.map +1 -1
- package/dist/esm/components/Tooltip/Tooltip.js +7 -4
- package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/extensions/codemirror/CodeMirror.js +3 -3
- package/dist/esm/extensions/codemirror/CodeMirror.js.map +1 -1
- package/dist/esm/extensions/react-flow/edges/EdgeTools.js +2 -1
- package/dist/esm/extensions/react-flow/edges/EdgeTools.js.map +1 -1
- package/dist/esm/extensions/react-flow/handles/HandleContent.js +1 -1
- package/dist/esm/extensions/react-flow/handles/HandleContent.js.map +1 -1
- package/dist/esm/extensions/react-flow/index.js +1 -0
- package/dist/esm/extensions/react-flow/index.js.map +1 -1
- package/dist/esm/extensions/react-flow/minimap/MiniMap.js +3 -2
- package/dist/esm/extensions/react-flow/minimap/MiniMap.js.map +1 -1
- package/dist/esm/extensions/react-flow/minimap/utils.js +10 -5
- package/dist/esm/extensions/react-flow/minimap/utils.js.map +1 -1
- package/dist/esm/extensions/react-flow/nodes/NodeContent.js +76 -27
- package/dist/esm/extensions/react-flow/nodes/NodeContent.js.map +1 -1
- package/dist/esm/extensions/react-flow/nodes/NodeContentExtension.js +26 -6
- package/dist/esm/extensions/react-flow/nodes/NodeContentExtension.js.map +1 -1
- package/dist/esm/extensions/react-flow/nodes/NodeTools.js +1 -3
- package/dist/esm/extensions/react-flow/nodes/NodeTools.js.map +1 -1
- package/dist/esm/extensions/react-flow/nodes/nodeUtils.js +44 -0
- package/dist/esm/extensions/react-flow/nodes/nodeUtils.js.map +1 -0
- package/dist/esm/index.js +3 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/legacy-replacements/Tabs/Tabs.js +1 -1
- package/dist/esm/legacy-replacements/Tabs/Tabs.js.map +1 -1
- package/dist/esm/legacy-replacements/TextField/TextField.js +2 -5
- package/dist/esm/legacy-replacements/TextField/TextField.js.map +1 -1
- package/dist/types/cmem/index.d.ts +1 -0
- package/dist/types/cmem/react-flow/StickyNoteModal/StickyNoteModal.d.ts +26 -0
- package/dist/types/cmem/react-flow/configuration/graph.d.ts +3 -8
- package/dist/types/cmem/react-flow/configuration/linking.d.ts +3 -9
- package/dist/types/cmem/react-flow/configuration/typing.d.ts +28 -0
- package/dist/types/cmem/react-flow/configuration/workflow.d.ts +3 -9
- package/dist/types/cmem/react-flow/nodes/StickyNoteNode.d.ts +3 -0
- package/dist/types/common/utils/CssCustomProperties.d.ts +28 -0
- package/dist/types/common/utils/getColorConfiguration.d.ts +8 -0
- package/dist/types/components/AutocompleteField/AutoCompleteField.d.ts +7 -4
- package/dist/types/components/Breadcrumb/BreadcrumbItem.d.ts +7 -3
- package/dist/types/components/Breadcrumb/BreadcrumbList.d.ts +20 -8
- package/dist/types/components/Button/Button.d.ts +2 -2
- package/dist/types/components/ContextOverlay/ContextMenu.d.ts +37 -3
- package/dist/types/components/ContextOverlay/ContextOverlay.d.ts +12 -1
- package/dist/types/components/Form/FieldItem.d.ts +3 -2
- package/dist/types/components/Icon/Icon.d.ts +32 -7
- package/dist/types/components/Icon/IconButton.d.ts +21 -7
- package/dist/types/components/Icon/canonicalIconNames.d.ts +1 -1
- package/dist/types/components/Label/Label.d.ts +30 -2
- package/dist/types/components/Menu/MenuItem.d.ts +3 -7
- package/dist/types/components/MultiSelect/MultiSelect.d.ts +13 -9
- package/dist/types/components/Select/Select.d.ts +22 -0
- package/dist/types/components/Tag/Tag.d.ts +5 -1
- package/dist/types/components/Tooltip/Tooltip.d.ts +13 -11
- package/dist/types/components/interfaces.d.ts +1 -0
- package/dist/types/extensions/codemirror/CodeMirror.d.ts +5 -1
- package/dist/types/extensions/react-flow/edges/EdgeTools.d.ts +2 -2
- package/dist/types/extensions/react-flow/index.d.ts +1 -0
- package/dist/types/extensions/react-flow/minimap/MiniMap.d.ts +1 -1
- package/dist/types/extensions/react-flow/minimap/utils.d.ts +1 -0
- package/dist/types/extensions/react-flow/nodes/NodeContent.d.ts +17 -1
- package/dist/types/extensions/react-flow/nodes/NodeContentExtension.d.ts +2 -2
- package/dist/types/extensions/react-flow/nodes/NodeTools.d.ts +2 -2
- package/dist/types/extensions/react-flow/nodes/nodeUtils.d.ts +14 -0
- package/dist/types/index.d.ts +3 -2
- package/dist/types/legacy-replacements/Tabs/Tabs.d.ts +1 -1
- package/package.json +19 -15
- package/scripts/compile-sass.ts +9 -0
- package/scripts/fix-cjs-dist +5 -0
- package/scripts/fix-esm-dist +6 -0
- package/scripts/sassConfig.js +13 -0
- package/src/_shame.scss +17 -0
- package/src/cmem/ActivityControl/ActivityControlWidget.stories.tsx +2 -2
- package/src/cmem/ActivityControl/ActivityControlWidget.tsx +5 -10
- package/src/cmem/index.ts +1 -0
- package/src/cmem/markdown/markdown.scss +1 -1
- package/src/cmem/react-flow/ReactFlow/ReactFlow.stories.tsx +48 -15
- package/src/cmem/react-flow/ReactFlow/ReactFlow.tsx +2 -0
- package/src/cmem/react-flow/StickyNoteModal/StickyNoteModal.tsx +134 -0
- package/src/cmem/react-flow/_index.scss +1 -1
- package/src/cmem/react-flow/_minimap.scss +6 -2
- package/src/cmem/react-flow/configuration/graph.ts +3 -5
- package/src/cmem/react-flow/configuration/linking.ts +5 -6
- package/src/cmem/react-flow/configuration/typing.ts +30 -0
- package/src/cmem/react-flow/configuration/workflow.ts +5 -5
- package/src/cmem/react-flow/nodes/StickyNoteNode.tsx +13 -0
- package/src/cmem/react-flow/{_nodes.scss → nodes/_colors.scss} +0 -0
- package/src/cmem/react-flow/nodes/_index.scss +2 -0
- package/src/cmem/react-flow/nodes/_stickynote.scss +72 -0
- package/src/common/utils/CssCustomProperties.ts +14 -12
- package/src/common/utils/getColorConfiguration.ts +1 -2
- package/src/components/Accordion/accordion.scss +11 -11
- package/src/components/Application/_header.scss +4 -3
- package/src/components/AutoSuggestion/AutoSuggestion.tsx +23 -23
- package/src/components/AutoSuggestion/AutoSuggestionList.tsx +15 -17
- package/src/components/AutoSuggestion/tests/AutoSuggestionList.test.tsx +1 -1
- package/src/components/AutocompleteField/AutoCompleteField.tsx +44 -19
- package/src/components/AutocompleteField/autocompletefield.scss +5 -3
- package/src/components/AutocompleteField/stories/AutoCompleteField.stories.tsx +75 -0
- package/src/components/Breadcrumb/BreadcrumbItem.tsx +15 -6
- package/src/components/Breadcrumb/BreadcrumbList.tsx +36 -14
- package/src/components/Breadcrumb/breadcrumb.scss +24 -1
- package/src/components/Breadcrumb/stories/BreadcrumbItem.stories.tsx +19 -0
- package/src/components/Breadcrumb/stories/BreadcrumbList.stories.tsx +26 -0
- package/src/components/Button/Button.tsx +3 -3
- package/src/components/Button/button.scss +43 -6
- package/src/components/Card/card.scss +5 -5
- package/src/components/ContextOverlay/ContextMenu.stories.tsx +33 -0
- package/src/components/ContextOverlay/ContextMenu.tsx +46 -8
- package/src/components/ContextOverlay/ContextOverlay.stories.tsx +148 -0
- package/src/components/ContextOverlay/ContextOverlay.tsx +16 -9
- package/src/components/ContextOverlay/contextoverlay.scss +17 -5
- package/src/components/Dialog/dialog.scss +10 -8
- package/src/components/Form/FieldItem.tsx +4 -4
- package/src/components/Form/form.scss +6 -6
- package/src/components/Icon/Icon.tsx +33 -18
- package/src/components/Icon/IconButton.tsx +24 -19
- package/src/components/Icon/canonicalIconNames.tsx +134 -121
- package/src/components/Icon/icon.scss +1 -1
- package/src/components/Icon/stories/Icon.stories.tsx +52 -0
- package/src/components/Icon/stories/IconButton.stories.tsx +27 -0
- package/src/components/Label/Label.stories.tsx +27 -0
- package/src/components/Label/Label.tsx +47 -15
- package/src/components/Label/label.scss +2 -2
- package/src/components/Menu/MenuItem.tsx +9 -16
- package/src/components/Menu/menu.scss +10 -9
- package/src/components/MultiSelect/MultiSelect.tsx +30 -18
- package/src/components/Notification/notification.scss +3 -1
- package/src/components/OverviewItem/overviewitem.scss +8 -8
- package/src/components/PropertyValuePair/propertyvalue.scss +9 -7
- package/src/components/Select/Select.stories.tsx +35 -0
- package/src/components/Select/Select.tsx +38 -0
- package/src/components/Select/_select.scss +8 -0
- package/src/components/Separation/separation.scss +6 -6
- package/src/components/SimpleTable/simpletable.scss +5 -5
- package/src/components/Tabs/TabTitle.tsx +2 -4
- package/src/components/Tabs/tabs.scss +3 -3
- package/src/components/Tag/Tag.tsx +6 -0
- package/src/components/Tag/tag.scss +62 -33
- package/src/components/TextField/textfield.scss +6 -4
- package/src/components/Tooltip/Tooltip.stories.tsx +36 -0
- package/src/components/Tooltip/Tooltip.tsx +23 -18
- package/src/components/Tooltip/tooltip.scss +7 -7
- package/src/components/Typography/typography.scss +5 -4
- package/src/components/interfaces.ts +3 -1
- package/src/configuration/_variables.scss +11 -9
- package/src/extensions/codemirror/CodeMirror.tsx +9 -4
- package/src/extensions/react-flow/edges/EdgeTools.tsx +6 -4
- package/src/extensions/react-flow/edges/_edges.scss +3 -3
- package/src/extensions/react-flow/handles/HandleContent.tsx +0 -1
- package/src/extensions/react-flow/handles/_handles.scss +13 -13
- package/src/extensions/react-flow/index.ts +1 -0
- package/src/extensions/react-flow/minimap/MiniMap.tsx +16 -1
- package/src/extensions/react-flow/minimap/_minimap.scss +6 -6
- package/src/extensions/react-flow/minimap/utils.ts +8 -3
- package/src/extensions/react-flow/nodes/NodeContent.tsx +253 -166
- package/src/extensions/react-flow/nodes/NodeContentExtension.tsx +17 -11
- package/src/extensions/react-flow/nodes/NodeTools.tsx +10 -7
- package/src/extensions/react-flow/nodes/_nodes.scss +44 -12
- package/src/extensions/react-flow/nodes/nodeUtils.tsx +53 -0
- package/src/extensions/react-flow/nodes/stories/NodeContent.stories.tsx +41 -12
- package/src/extensions/react-flow/nodes/stories/NodeContentExtension.stories.tsx +39 -47
- package/src/includes/blueprintjs/_variables.scss +4 -2
- package/src/includes/carbon-components/_variables.scss +7 -5
- package/src/index.scss +9 -5
- package/src/index.ts +4 -2
- package/src/legacy-replacements/Tabs/Tabs.tsx +3 -1
- package/src/legacy-replacements/TextField/TextField.tsx +7 -5
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
1
|
import { EdgeStep } from "./../../../extensions/react-flow/edges/EdgeStep";
|
|
3
2
|
import { NodeDefault } from "./../../../extensions/react-flow/nodes/NodeDefault";
|
|
3
|
+
import { StickyNoteNode } from "./../nodes/StickyNoteNode";
|
|
4
|
+
import { LINKING_NODE_TYPES } from "./typing";
|
|
4
5
|
|
|
5
6
|
const edgeTypes = {
|
|
6
7
|
default: EdgeStep,
|
|
@@ -11,16 +12,14 @@ const edgeTypes = {
|
|
|
11
12
|
danger: EdgeStep,
|
|
12
13
|
};
|
|
13
14
|
|
|
14
|
-
const nodeTypes = {
|
|
15
|
+
const nodeTypes: Record<LINKING_NODE_TYPES, React.ReactNode> = {
|
|
15
16
|
default: NodeDefault,
|
|
16
17
|
sourcepath: NodeDefault,
|
|
17
18
|
targetpath: NodeDefault,
|
|
18
19
|
transformation: NodeDefault,
|
|
19
20
|
comparator: NodeDefault,
|
|
20
21
|
aggregator: NodeDefault,
|
|
22
|
+
stickynote: StickyNoteNode,
|
|
21
23
|
};
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
edgeTypes,
|
|
25
|
-
nodeTypes,
|
|
26
|
-
}
|
|
25
|
+
export { edgeTypes, nodeTypes };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** node types for linking editor nodes */
|
|
2
|
+
export enum LINKING_NODE_TYPES {
|
|
3
|
+
default = "default",
|
|
4
|
+
sourcepath = "sourcepath",
|
|
5
|
+
targetpath = "targetpath",
|
|
6
|
+
transformation = "transformation",
|
|
7
|
+
comparator = "comparator",
|
|
8
|
+
aggregator = "aggregator",
|
|
9
|
+
stickynote = "stickynote",
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** node types for workflow editor nodes */
|
|
13
|
+
export enum WORKFLOW_NODE_TYPES {
|
|
14
|
+
default = "default",
|
|
15
|
+
dataset = "dataset",
|
|
16
|
+
linking = "linking",
|
|
17
|
+
transform = "transform",
|
|
18
|
+
task = "task",
|
|
19
|
+
workflow = "workflow",
|
|
20
|
+
stickynote = "stickynote",
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** node types for graph editor */
|
|
24
|
+
export enum GRAPH_NODE_TYPES {
|
|
25
|
+
default = "default",
|
|
26
|
+
graph = "graph",
|
|
27
|
+
class = "class",
|
|
28
|
+
instance = "instance",
|
|
29
|
+
property = "property",
|
|
30
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { EdgeStep } from "./../../../extensions/react-flow/edges/EdgeStep";
|
|
2
2
|
import { NodeDefault } from "./../../../extensions/react-flow/nodes/NodeDefault";
|
|
3
|
+
import { StickyNoteNode } from "./../nodes/StickyNoteNode";
|
|
4
|
+
import { WORKFLOW_NODE_TYPES } from "./typing";
|
|
3
5
|
|
|
4
6
|
const edgeTypes = {
|
|
5
7
|
default: EdgeStep,
|
|
@@ -8,16 +10,14 @@ const edgeTypes = {
|
|
|
8
10
|
danger: EdgeStep,
|
|
9
11
|
};
|
|
10
12
|
|
|
11
|
-
const nodeTypes = {
|
|
13
|
+
const nodeTypes: Record<WORKFLOW_NODE_TYPES, React.ReactNode> = {
|
|
12
14
|
default: NodeDefault,
|
|
13
15
|
dataset: NodeDefault,
|
|
14
16
|
linking: NodeDefault,
|
|
15
17
|
transform: NodeDefault,
|
|
16
18
|
task: NodeDefault,
|
|
17
19
|
workflow: NodeDefault,
|
|
20
|
+
stickynote: StickyNoteNode,
|
|
18
21
|
};
|
|
19
22
|
|
|
20
|
-
|
|
21
|
-
edgeTypes,
|
|
22
|
-
nodeTypes,
|
|
23
|
-
}
|
|
23
|
+
export { edgeTypes, nodeTypes };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React, { memo } from "react";
|
|
2
|
+
import { NodeDefault, NodeProps } from "./../../../extensions/react-flow/nodes/NodeDefault";
|
|
3
|
+
|
|
4
|
+
export const StickyNoteNode = memo((node: NodeProps<any>) => {
|
|
5
|
+
const {
|
|
6
|
+
data,
|
|
7
|
+
...otherNodeProps
|
|
8
|
+
} = node;
|
|
9
|
+
|
|
10
|
+
data.minimalShape = data.minimalShape??"none";
|
|
11
|
+
|
|
12
|
+
return <NodeDefault data={data} {...otherNodeProps} />;
|
|
13
|
+
});
|
|
File without changes
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
.react-flow__node-stickynote {
|
|
2
|
+
.#{$eccgui}-graphviz__node {
|
|
3
|
+
&:not(.#{$eccgui}-graphviz__node--minimal-rectangular),
|
|
4
|
+
&:not(.#{$eccgui}-graphviz__node--minimal-circular) {
|
|
5
|
+
.#{$eccgui}-graphviz__node__header {
|
|
6
|
+
color: currentColor;
|
|
7
|
+
position: absolute;
|
|
8
|
+
width: 100%;
|
|
9
|
+
height: 0px;
|
|
10
|
+
top: 0;
|
|
11
|
+
align-items: flex-start;
|
|
12
|
+
min-height: unset;
|
|
13
|
+
}
|
|
14
|
+
.#{$eccgui}-graphviz__node__header-label {
|
|
15
|
+
visibility: hidden;
|
|
16
|
+
}
|
|
17
|
+
.#{$eccgui}-graphviz__node__content {
|
|
18
|
+
color: currentColor;
|
|
19
|
+
background: transparent;
|
|
20
|
+
padding: $eccgui-size-block-whitespace / 2;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
.#{$eccgui}-graphviz__node__header-menu {
|
|
25
|
+
display: none;
|
|
26
|
+
}
|
|
27
|
+
&.selected, &:hover {
|
|
28
|
+
.#{$eccgui}-graphviz__node__header-menu {
|
|
29
|
+
display: block;
|
|
30
|
+
opacity: $eccgui-opacity-muted;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
&.selected {
|
|
34
|
+
.#{$eccgui}-graphviz__node__header-menu {
|
|
35
|
+
opacity: $eccgui-opacity-regular;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
.#{$eccgui}-typography__contentblock {
|
|
39
|
+
h1 {
|
|
40
|
+
font-size: $eccgui-size-typo-subtitle;
|
|
41
|
+
line-height: $eccgui-size-typo-subtitle-lineheight;
|
|
42
|
+
font-weight: $eccgui-font-weight-bold;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
h2 {
|
|
46
|
+
font-size: $eccgui-size-typo-subtitle;
|
|
47
|
+
line-height: $eccgui-size-typo-subtitle-lineheight;
|
|
48
|
+
font-weight: $eccgui-font-weight-regular;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
h3 {
|
|
52
|
+
font-size: $eccgui-size-typo-text;
|
|
53
|
+
line-height: $eccgui-size-typo-text-lineheight;
|
|
54
|
+
font-weight: $eccgui-font-weight-bold;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
h4 {
|
|
58
|
+
font-size: $eccgui-size-typo-text;
|
|
59
|
+
line-height: $eccgui-size-typo-text-lineheight;
|
|
60
|
+
font-weight: $eccgui-font-weight-regular;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.#{eccgui}-configuration--colors__stickynotes {
|
|
66
|
+
--yellowish: #ffd54f;
|
|
67
|
+
--blueish: #3a7896;
|
|
68
|
+
--purplish: #ae3c74;
|
|
69
|
+
--success: #{$eccgui-color-success-text};
|
|
70
|
+
--warning: #{$eccgui-color-warning-text};
|
|
71
|
+
--danger: #{$eccgui-color-danger-text};
|
|
72
|
+
}
|
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
* @see https://css-tricks.com/how-to-get-all-custom-properties-on-a-page-in-javascript/
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
type AllowedCSSRule = CSSStyleRule | CSSPageRule; // they have necessary `selectorText` and `style` properties
|
|
7
|
+
|
|
6
8
|
interface getLocalCssStyleRulesProps {
|
|
7
|
-
cssRuleType?: "CSSStyleRule";
|
|
9
|
+
cssRuleType?: "CSSStyleRule" | "CSSPageRule";
|
|
8
10
|
selectorText?: string;
|
|
9
11
|
}
|
|
10
12
|
interface getLocalCssStyleRulePropertiesProps extends getLocalCssStyleRulesProps {
|
|
@@ -43,7 +45,7 @@ export default class CssCustomProperties {
|
|
|
43
45
|
|
|
44
46
|
static listLocalStylesheets = (): CSSStyleSheet[] => {
|
|
45
47
|
if (document && document.styleSheets) {
|
|
46
|
-
return Array.from(document.styleSheets)
|
|
48
|
+
return (Array.from(document.styleSheets) as CSSStyleSheet[])
|
|
47
49
|
.filter((stylesheet) => {
|
|
48
50
|
// is inline stylesheet or from same domain
|
|
49
51
|
if (!stylesheet.href) {
|
|
@@ -53,7 +55,7 @@ export default class CssCustomProperties {
|
|
|
53
55
|
});
|
|
54
56
|
}
|
|
55
57
|
|
|
56
|
-
return [];
|
|
58
|
+
return [] as CSSStyleSheet[];
|
|
57
59
|
}
|
|
58
60
|
|
|
59
61
|
static listLocalCssRules = (): CSSRule[] => {
|
|
@@ -64,16 +66,16 @@ export default class CssCustomProperties {
|
|
|
64
66
|
.flat();
|
|
65
67
|
}
|
|
66
68
|
|
|
67
|
-
static listLocalCssStyleRules = (filter: getLocalCssStyleRulesProps = {}):
|
|
69
|
+
static listLocalCssStyleRules = (filter: getLocalCssStyleRulesProps = {}): AllowedCSSRule[] => {
|
|
68
70
|
const {cssRuleType = "CSSStyleRule", selectorText} = filter;
|
|
69
71
|
const cssStyleRules = CssCustomProperties.listLocalCssRules()
|
|
70
|
-
.filter((
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (
|
|
72
|
+
.filter((rule) => {
|
|
73
|
+
const cssrule = rule as AllowedCSSRule;
|
|
74
|
+
if((cssrule).style) {
|
|
75
|
+
if (cssrule.constructor.name !== cssRuleType) {
|
|
74
76
|
return false;
|
|
75
77
|
}
|
|
76
|
-
if (!!selectorText &&
|
|
78
|
+
if (!!selectorText && cssrule.selectorText !== selectorText) {
|
|
77
79
|
return false;
|
|
78
80
|
}
|
|
79
81
|
return true;
|
|
@@ -81,18 +83,18 @@ export default class CssCustomProperties {
|
|
|
81
83
|
return false;
|
|
82
84
|
}
|
|
83
85
|
})
|
|
84
|
-
return cssStyleRules as
|
|
86
|
+
return cssStyleRules as AllowedCSSRule[]
|
|
85
87
|
}
|
|
86
88
|
|
|
87
89
|
static listLocalCssStyleRuleProperties = (filter: getLocalCssStyleRulePropertiesProps = {}) => {
|
|
88
90
|
const { propertyType = "all", ...otherFilters } = filter;
|
|
89
91
|
return CssCustomProperties.listLocalCssStyleRules(otherFilters)
|
|
90
92
|
.map((cssrule) => {
|
|
91
|
-
return [...cssrule.style]
|
|
93
|
+
return [...(cssrule as CSSStyleRule).style]
|
|
92
94
|
.map((propertyname) => {
|
|
93
95
|
return [
|
|
94
96
|
propertyname.trim(),
|
|
95
|
-
cssrule.style.getPropertyValue(propertyname).trim()
|
|
97
|
+
(cssrule as CSSStyleRule).style.getPropertyValue(propertyname).trim()
|
|
96
98
|
];
|
|
97
99
|
});
|
|
98
100
|
})
|
|
@@ -2,7 +2,7 @@ import CssCustomProperties from "./CssCustomProperties";
|
|
|
2
2
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
3
3
|
|
|
4
4
|
// Configurations can be found in `src/cmem/react-flow/configuration/_colors-*.scss`
|
|
5
|
-
type colorconfigs = "react-flow-graph" | "react-flow-linking" | "react-flow-workflow";
|
|
5
|
+
type colorconfigs = "react-flow-graph" | "react-flow-linking" | "react-flow-workflow" | "stickynotes";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Read and returns color values provided by CSS custom properties.
|
|
@@ -12,7 +12,6 @@ type colorconfigs = "react-flow-graph" | "react-flow-linking" | "react-flow-work
|
|
|
12
12
|
const getColorConfiguration = (configId: colorconfigs) => {
|
|
13
13
|
return new CssCustomProperties({
|
|
14
14
|
selectorText: `.${eccgui}-configuration--colors__${configId}`,
|
|
15
|
-
cssRuleType: "CSSStyleRule",
|
|
16
15
|
removeDashPrefix: true,
|
|
17
16
|
returnObject: true,
|
|
18
17
|
}).customProperties();
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
color: inherit;
|
|
10
10
|
|
|
11
11
|
.#{$prefix}--accordion__arrow {
|
|
12
|
-
margin: 0 $eccgui-size-block-whitespace
|
|
12
|
+
margin: 0 $eccgui-size-block-whitespace * 0.5 0 0;
|
|
13
13
|
|
|
14
14
|
.#{$prefix}--accordion--start & {
|
|
15
|
-
margin: 0 0 0 $eccgui-size-block-whitespace
|
|
15
|
+
margin: 0 0 0 $eccgui-size-block-whitespace * 0.5;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -25,27 +25,27 @@
|
|
|
25
25
|
margin: 0 0 0 $eccgui-size-block-whitespace;
|
|
26
26
|
|
|
27
27
|
.#{$prefix}--accordion--start & {
|
|
28
|
-
margin: 0 0 0 $eccgui-size-block-whitespace
|
|
28
|
+
margin: 0 0 0 $eccgui-size-block-whitespace * 0.5;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
.#{$prefix}--accordion__content {
|
|
33
|
-
padding: $eccgui-size-block-whitespace
|
|
34
|
-
margin: 0 calc(1rem + #{$eccgui-size-block-whitespace
|
|
33
|
+
padding: $eccgui-size-block-whitespace * 0.5;
|
|
34
|
+
margin: 0 calc(1rem + #{$eccgui-size-block-whitespace * 0.5}) 0 $eccgui-size-block-whitespace * 0.5;
|
|
35
35
|
display: block;
|
|
36
36
|
opacity: 0;
|
|
37
37
|
position: fixed;
|
|
38
38
|
left: -5000em;
|
|
39
39
|
|
|
40
40
|
.#{$prefix}--accordion__item--active & {
|
|
41
|
-
padding: $eccgui-size-block-whitespace
|
|
41
|
+
padding: $eccgui-size-block-whitespace * 0.5 $eccgui-size-block-whitespace * 0.5 $eccgui-size-block-whitespace $eccgui-size-block-whitespace * 0.5;
|
|
42
42
|
opacity: 1;
|
|
43
43
|
position: static;
|
|
44
44
|
left: auto;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
.#{$prefix}--accordion--start & {
|
|
48
|
-
margin: 0 $eccgui-size-block-whitespace
|
|
48
|
+
margin: 0 $eccgui-size-block-whitespace * 0.5 0 calc(1rem + #{$eccgui-size-block-whitespace * 0.5});
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
.#{$eccgui}-accordion__item--fullwidth & {
|
|
@@ -84,19 +84,19 @@
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
.#{$prefix}--accordion__title {
|
|
87
|
-
margin: 0 0 0 $eccgui-size-block-whitespace
|
|
87
|
+
margin: 0 0 0 $eccgui-size-block-whitespace * 0.25;
|
|
88
88
|
|
|
89
89
|
.#{$prefix}--accordion--start & {
|
|
90
|
-
margin: 0 0 0 $eccgui-size-block-whitespace
|
|
90
|
+
margin: 0 0 0 $eccgui-size-block-whitespace * 0.25;
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
.#{$prefix}--accordion__content {
|
|
96
|
-
padding: $eccgui-size-block-whitespace
|
|
96
|
+
padding: $eccgui-size-block-whitespace * 0.25 0;
|
|
97
97
|
|
|
98
98
|
.#{$prefix}--accordion__item--active & {
|
|
99
|
-
padding: $eccgui-size-block-whitespace
|
|
99
|
+
padding: $eccgui-size-block-whitespace * 0.25 0;
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
}
|
|
@@ -68,12 +68,13 @@ $shell-header-link: $carbon--blue-60 !default;
|
|
|
68
68
|
|
|
69
69
|
|
|
70
70
|
span.#{$prefix}--header__name {
|
|
71
|
-
@extend a.#{$prefix}--header__name;
|
|
71
|
+
// @extend a.#{$prefix}--header__name;
|
|
72
|
+
@extend .#{$prefix}--header__name;
|
|
72
73
|
}
|
|
73
74
|
|
|
74
75
|
.#{$prefix}--header__name {
|
|
75
76
|
&.#{$eccgui}-application__title--withsidebar {
|
|
76
|
-
padding-right: $eccgui-size-block-whitespace
|
|
77
|
+
padding-right: $eccgui-size-block-whitespace * 0.5;
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
80
|
|
|
@@ -91,7 +92,7 @@ span.#{$prefix}--header__name {
|
|
|
91
92
|
|
|
92
93
|
.#{$eccgui}-application__title--depiction {
|
|
93
94
|
display: inline-block;
|
|
94
|
-
margin-right: $eccgui-size-block-whitespace
|
|
95
|
+
margin-right: $eccgui-size-block-whitespace * 0.5;
|
|
95
96
|
|
|
96
97
|
& > * {
|
|
97
98
|
display: none;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, {useEffect, useMemo, useState} from "react";
|
|
2
2
|
import CodeMirror from "codemirror";
|
|
3
3
|
import {FieldItem, IconButton, Spinner, Toolbar, ToolbarSection} from "./../../";
|
|
4
4
|
import {Classes as BlueprintClassNames} from "@blueprintjs/core";
|
|
@@ -235,7 +235,7 @@ const AutoSuggestion = ({
|
|
|
235
235
|
editorState.index = 0
|
|
236
236
|
}, [suggestionResponse, editorState]);
|
|
237
237
|
|
|
238
|
-
const asyncCheckInput = async (inputString: string) => {
|
|
238
|
+
const asyncCheckInput = useMemo(() => async (inputString: string) => {
|
|
239
239
|
if(!checkInput) {
|
|
240
240
|
return
|
|
241
241
|
}
|
|
@@ -249,16 +249,29 @@ const AutoSuggestion = ({
|
|
|
249
249
|
} finally {
|
|
250
250
|
setPathValidationPending(false)
|
|
251
251
|
}
|
|
252
|
-
}
|
|
252
|
+
}, [checkInput])
|
|
253
253
|
|
|
254
|
-
const checkValuePathValidity =
|
|
255
|
-
debounce((inputString: string) => asyncCheckInput(inputString),
|
|
256
|
-
[
|
|
254
|
+
const checkValuePathValidity = useMemo(
|
|
255
|
+
() => debounce((inputString: string) => asyncCheckInput(inputString), 1000),
|
|
256
|
+
[asyncCheckInput]
|
|
257
257
|
)
|
|
258
258
|
|
|
259
|
-
const
|
|
260
|
-
|
|
261
|
-
|
|
259
|
+
const asyncHandleEditorInputChange = useMemo(() => async (inputString: string, cursorPosition: number) => {
|
|
260
|
+
setSuggestionsPending(true)
|
|
261
|
+
try {
|
|
262
|
+
const result: IPartialAutoCompleteResult | undefined = await fetchSuggestions(inputString, cursorPosition)
|
|
263
|
+
setSuggestionResponse(result)
|
|
264
|
+
} catch(e) {
|
|
265
|
+
setSuggestionResponse(undefined)
|
|
266
|
+
// TODO: Error handling
|
|
267
|
+
} finally {
|
|
268
|
+
setSuggestionsPending(false)
|
|
269
|
+
}
|
|
270
|
+
}, [fetchSuggestions])
|
|
271
|
+
|
|
272
|
+
const handleEditorInputChange = useMemo(() =>
|
|
273
|
+
debounce((inputString: string, cursorPosition: number) => asyncHandleEditorInputChange(inputString, cursorPosition), 1000),
|
|
274
|
+
[asyncHandleEditorInputChange]
|
|
262
275
|
)
|
|
263
276
|
|
|
264
277
|
React.useEffect(() => {
|
|
@@ -276,19 +289,6 @@ const AutoSuggestion = ({
|
|
|
276
289
|
return checkValuePathValidity.cancel
|
|
277
290
|
}, [value, checkValuePathValidity])
|
|
278
291
|
|
|
279
|
-
const asyncHandleEditorInputChange = async (inputString: string, cursorPosition: number) => {
|
|
280
|
-
setSuggestionsPending(true)
|
|
281
|
-
try {
|
|
282
|
-
const result: IPartialAutoCompleteResult | undefined = await fetchSuggestions(inputString, cursorPosition)
|
|
283
|
-
setSuggestionResponse(result)
|
|
284
|
-
} catch(e) {
|
|
285
|
-
setSuggestionResponse(undefined)
|
|
286
|
-
// TODO: Error handling
|
|
287
|
-
} finally {
|
|
288
|
-
setSuggestionsPending(false)
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
|
|
292
292
|
const handleChange = (val: string) => {
|
|
293
293
|
setValue(val);
|
|
294
294
|
onChange(val)
|
|
@@ -427,7 +427,7 @@ const AutoSuggestion = ({
|
|
|
427
427
|
|
|
428
428
|
return label ? (
|
|
429
429
|
<FieldItem
|
|
430
|
-
|
|
430
|
+
labelProps={{
|
|
431
431
|
text: (
|
|
432
432
|
<>
|
|
433
433
|
{label}
|
|
@@ -143,23 +143,21 @@ export const AutoSuggestionList = ({
|
|
|
143
143
|
{options.map((item, index) => (
|
|
144
144
|
<MenuItem
|
|
145
145
|
key={index}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
},
|
|
146
|
+
active={currentlyFocusedIndex === index}
|
|
147
|
+
onMouseDown={(e: any) => e.preventDefault()}
|
|
148
|
+
onClick={() => onItemSelectionChange(item)}
|
|
149
|
+
text={(
|
|
150
|
+
<Item
|
|
151
|
+
ref={generateRef(index)}
|
|
152
|
+
item={item}
|
|
153
|
+
/>
|
|
154
|
+
)}
|
|
155
|
+
onMouseEnter={() => setHoveredItem(item)}
|
|
156
|
+
onMouseLeave={() => setHoveredItem(undefined)}
|
|
157
|
+
onMouseOver={() => {
|
|
158
|
+
if (item.value !== hoveredItem?.value) {
|
|
159
|
+
setHoveredItem(item);
|
|
160
|
+
}
|
|
163
161
|
}}
|
|
164
162
|
/>
|
|
165
163
|
))}
|
|
@@ -84,7 +84,7 @@ describe("Dropdown list", () => {
|
|
|
84
84
|
options: mockOptions
|
|
85
85
|
}
|
|
86
86
|
const {container} = render(<AutoSuggestionList {...props} />)
|
|
87
|
-
const activeListItems = Array.from(container.querySelectorAll("li .
|
|
87
|
+
const activeListItems = Array.from(container.querySelectorAll("li .bp4-menu-item.bp4-active"))
|
|
88
88
|
expect(activeListItems.length).toBe(1)
|
|
89
89
|
})
|
|
90
90
|
|
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
import React, {useEffect, useRef, useState} from "react";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import {
|
|
3
|
+
HTMLInputProps as BlueprintHTMLInputProps,
|
|
4
|
+
InputGroupProps as BlueprintInputGroupProps,
|
|
5
|
+
IRefObject
|
|
6
|
+
} from "@blueprintjs/core";
|
|
7
|
+
import {
|
|
8
|
+
Suggest2 as Suggest
|
|
9
|
+
} from "@blueprintjs/select";
|
|
10
|
+
import {
|
|
11
|
+
Highlighter,
|
|
12
|
+
IconButton,
|
|
13
|
+
Menu,
|
|
14
|
+
Notification,
|
|
15
|
+
MenuItem,
|
|
16
|
+
OverflowText,
|
|
17
|
+
Spinner,
|
|
18
|
+
ContextOverlayProps,
|
|
19
|
+
} from "../../index";
|
|
5
20
|
import {CLASSPREFIX as eccgui} from "../../configuration/constants";
|
|
6
21
|
|
|
7
22
|
type SearchFunction<T extends any> = (value: string) => T[];
|
|
@@ -70,12 +85,12 @@ export interface IAutoCompleteFieldProps<T extends any, UPDATE_VALUE extends any
|
|
|
70
85
|
* `query` and `onQueryChange` instead of `inputProps.value` and
|
|
71
86
|
* `inputProps.onChange`.
|
|
72
87
|
*/
|
|
73
|
-
inputProps?:
|
|
88
|
+
inputProps?: BlueprintInputGroupProps & BlueprintHTMLInputProps;
|
|
74
89
|
|
|
75
90
|
/**
|
|
76
|
-
* Optional props of the
|
|
91
|
+
* Optional props of the internally used `<ContextOverlay/>` element..
|
|
77
92
|
*/
|
|
78
|
-
|
|
93
|
+
contextOverlayProps?: Partial<Omit<ContextOverlayProps, "content" | "children">>
|
|
79
94
|
|
|
80
95
|
/** Defines if a value can be reset, i.e. a reset icon is shown and the value is set to a specific value.
|
|
81
96
|
* When undefined, a value cannot be reset.
|
|
@@ -122,6 +137,9 @@ export interface IAutoCompleteFieldProps<T extends any, UPDATE_VALUE extends any
|
|
|
122
137
|
* @param selectedValue The currently selected value.
|
|
123
138
|
*/
|
|
124
139
|
resetQueryToValue?(selectedValue: T): string
|
|
140
|
+
|
|
141
|
+
/** If an error occurs during the auto-completion request, the error details will be prefixed with this string. */
|
|
142
|
+
requestErrorPrefix?: string
|
|
125
143
|
}
|
|
126
144
|
|
|
127
145
|
AutoCompleteField.defaultProps = {
|
|
@@ -160,6 +178,7 @@ export function AutoCompleteField<T extends any, UPDATE_VALUE extends any>(props
|
|
|
160
178
|
itemValueRenderer,
|
|
161
179
|
resetQueryToValue,
|
|
162
180
|
itemValueString,
|
|
181
|
+
requestErrorPrefix = "",
|
|
163
182
|
...otherProps
|
|
164
183
|
} = props;
|
|
165
184
|
const [selectedItem, setSelectedItem] = useState<T | undefined>(initialValue);
|
|
@@ -169,11 +188,12 @@ export function AutoCompleteField<T extends any, UPDATE_VALUE extends any>(props
|
|
|
169
188
|
const [query, setQuery] = useState<string>("");
|
|
170
189
|
const [hasFocus, setHasFocus] = useState<boolean>(false);
|
|
171
190
|
const [highlightingEnabled, setHighlightingEnabled] = useState<boolean>(true);
|
|
191
|
+
const [requestError, setRequestError] = useState<string | undefined>(undefined)
|
|
172
192
|
|
|
173
193
|
// The suggestions that match the user's input
|
|
174
194
|
const [filtered, setFiltered] = useState<T[]>([]);
|
|
175
195
|
|
|
176
|
-
const
|
|
196
|
+
const BlueprintSuggestAutocomplete = Suggest.ofType<T>();
|
|
177
197
|
|
|
178
198
|
// Sets the query to the item value if it has a valid string value
|
|
179
199
|
const setQueryToSelectedValue = (item?: T) => {
|
|
@@ -262,6 +282,7 @@ export function AutoCompleteField<T extends any, UPDATE_VALUE extends any>(props
|
|
|
262
282
|
// Fetches the results for the given query
|
|
263
283
|
const fetchQueryResults = async (input: string) => {
|
|
264
284
|
setListLoading(true);
|
|
285
|
+
setRequestError(undefined)
|
|
265
286
|
try {
|
|
266
287
|
let result = await onSearch(input);
|
|
267
288
|
const onlySelectItemReturned = result.length <= 1 && selectedItem && input.length > 0 &&
|
|
@@ -282,8 +303,9 @@ export function AutoCompleteField<T extends any, UPDATE_VALUE extends any>(props
|
|
|
282
303
|
}
|
|
283
304
|
setHighlightingEnabled(enableHighlighting);
|
|
284
305
|
setFiltered(result);
|
|
285
|
-
} catch (e) {
|
|
286
|
-
|
|
306
|
+
} catch (e: any) {
|
|
307
|
+
const details = e?.message ?? ""
|
|
308
|
+
setRequestError(requestErrorPrefix + details)
|
|
287
309
|
} finally {
|
|
288
310
|
setListLoading(false);
|
|
289
311
|
}
|
|
@@ -325,6 +347,9 @@ export function AutoCompleteField<T extends any, UPDATE_VALUE extends any>(props
|
|
|
325
347
|
onChange?.(resetValue);
|
|
326
348
|
setQuery("");
|
|
327
349
|
};
|
|
350
|
+
const requestErrorRenderer = () => {
|
|
351
|
+
return <Notification danger={true} message={requestError} />
|
|
352
|
+
}
|
|
328
353
|
// Optional clear button to reset the selected value
|
|
329
354
|
const clearButton = reset &&
|
|
330
355
|
selectedItem != null &&
|
|
@@ -339,21 +364,20 @@ export function AutoCompleteField<T extends any, UPDATE_VALUE extends any>(props
|
|
|
339
364
|
/>
|
|
340
365
|
) : undefined;
|
|
341
366
|
// Additional properties for the input element of the auto-completion widget
|
|
342
|
-
const updatedInputProps:
|
|
367
|
+
const updatedInputProps: BlueprintInputGroupProps & BlueprintHTMLInputProps = {
|
|
343
368
|
rightElement: clearButton,
|
|
344
369
|
autoFocus: autoFocus,
|
|
345
370
|
onBlur: handleOnFocusOut,
|
|
346
371
|
onFocus: handleOnFocusIn,
|
|
347
372
|
...otherProps.inputProps,
|
|
348
373
|
};
|
|
349
|
-
const
|
|
374
|
+
const updatedContextOverlayProps: Partial<Omit<ContextOverlayProps, "content" | "children">> = {
|
|
350
375
|
minimal: true,
|
|
351
|
-
|
|
376
|
+
placement: "bottom-start",
|
|
352
377
|
popoverClassName: `${eccgui}-autocompletefield__options`,
|
|
353
|
-
|
|
354
|
-
boundary: "window",
|
|
378
|
+
rootBoundary: "viewport",
|
|
355
379
|
onClosed: onPopoverClose,
|
|
356
|
-
...otherProps.
|
|
380
|
+
...otherProps.contextOverlayProps,
|
|
357
381
|
}
|
|
358
382
|
if(selectedItem !== undefined) {
|
|
359
383
|
// Makes sure that even when an empty string is selected, the placeholder won't be shown.
|
|
@@ -375,12 +399,13 @@ export function AutoCompleteField<T extends any, UPDATE_VALUE extends any>(props
|
|
|
375
399
|
} : {}
|
|
376
400
|
return (
|
|
377
401
|
<div ref={fieldRef}>
|
|
378
|
-
<
|
|
402
|
+
<BlueprintSuggestAutocomplete
|
|
379
403
|
className={`${eccgui}-autocompletefield__input`}
|
|
380
404
|
disabled={disabled}
|
|
381
|
-
|
|
405
|
+
// Need to display error messages in list
|
|
406
|
+
items={requestError ? [requestError as T] : filtered}
|
|
382
407
|
inputValueRenderer={selectedItem !== undefined ? itemValueRenderer : () => ""}
|
|
383
|
-
itemRenderer={optionRenderer}
|
|
408
|
+
itemRenderer={requestError ? requestErrorRenderer : optionRenderer}
|
|
384
409
|
itemsEqual={areEqualItems}
|
|
385
410
|
noResults={<MenuItem disabled={true} text={noResultText} style={fieldWidthLimits} />}
|
|
386
411
|
onItemSelect={onSelectionChange}
|
|
@@ -388,7 +413,7 @@ export function AutoCompleteField<T extends any, UPDATE_VALUE extends any>(props
|
|
|
388
413
|
closeOnSelect={true}
|
|
389
414
|
query={query}
|
|
390
415
|
// This leads to odd compile errors without "as any"
|
|
391
|
-
popoverProps={
|
|
416
|
+
popoverProps={updatedContextOverlayProps as any}
|
|
392
417
|
selectedItem={selectedItem}
|
|
393
418
|
fill
|
|
394
419
|
{...createNewItemProps}
|