Skip to content

Commit 6afcca3

Browse files
Merge pull request #258 from eccenca/feature/coloredWorkbench-MappingAdditions
Feature/colored workbench mapping additions
2 parents 924e2f3 + 4f8c39e commit 6afcca3

11 files changed

Lines changed: 83 additions & 25 deletions

File tree

CHANGELOG.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
88

99
### Added
1010

11-
- Added custom icon for "Concatenate to file" operator (CMEM-6476).
1211
- `<ContentGroup />` component
1312
- Manage display of a grouped content section.
1413
- Add info, actions and context annotations by using its properties.
@@ -20,7 +19,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
2019
- implemented support for `disabled` state in code editor
2120
- implemented support for `intent` states in code editor
2221
- `<Label />`
23-
- added `additionalElements` property to display elements at the end of the label
22+
- `additionalElements` property to display elements at the end of the label
23+
- `inline` property to display the label component as inline block
2424
- `<NodeContent />`
2525
- `resizeDirections` to specifiy the axis that can be used to resize the node
2626
- `resizeMaxDimensions` to add maximum values for resizing height/width
@@ -30,15 +30,30 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
3030
- `actionsProps` property to forward `CardActions` properties, e.g. `noWrap`
3131
- `<MenutItem />`
3232
- `tooltip` property to dislay tooltip on menu item label
33+
- `<NodeContent />`
34+
- `resizeDirections` to specifiy the axis that can be used to resize the node
35+
- `resizeMaxDimensions` to add maximum values for resizing height/width
36+
- New icons:
37+
- "item-magic-edit": icon for "magic" edit suggestions
38+
- "artefact-task-concatenatetofile": icon for "Concatenate to file" operator
3339

3440
### Fixed
3541

36-
- `CodeAutocompleteField`:
37-
- Code editor resets to initial value on every code editor instance re-init
42+
- `<CodeAutocompleteField />`:
43+
- Code editor resets to initial value on every code editor instance re-init
44+
- `<OverviewItemActions />`
45+
- `hiddenInteractions` stay visible if they contain focused elements or opened overlays (e.g. context menus)
46+
- `<TagList />`
47+
- do not create empty list items
3848

3949
### Changed
4050

41-
- StickyNote data structure: Refactored position and dimension (breaking change)
51+
- `<ReactFlow />`
52+
- property color for `graph` configuration was adjusted
53+
- `<Switch />`
54+
- use always `<Label/>` component for `label` value
55+
- `<StickyNoteNode />`
56+
- Refactored data structure position and dimension (breaking change)
4257

4358
## [24.0.1] - 2025-02-06
4459

src/cmem/react-flow/configuration/_colors-graph.scss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
$reactflow-color-graph-node: #745a85 !default;
22
$reactflow-color-class-node: #3a7896 !default;
33
$reactflow-color-instance-node: #0097a7 !default;
4-
$reactflow-color-property-node: #ffd54f !default;
4+
$reactflow-color-property-node: #40a691 !default;
55
$reactflow-color-implicit-edge: #ae3c74 !default;
66
$reactflow-color-import-edge: $reactflow-color-graph-node !default;
77
$reactflow-color-subclass-edge: $reactflow-color-class-node !default;
@@ -13,6 +13,8 @@ $reactflow-color-rdftype-edge: $reactflow-color-instance-node !default;
1313
}
1414

1515
.#{eccgui}-configuration--colors__react-flow-graph {
16+
/* stylelint-disable custom-property-pattern */
17+
// TODO: we should correct custom property names later but atm this would lead to broken consumer apps
1618
--graphNode: #{$reactflow-color-graph-node};
1719
--classNode: #{$reactflow-color-class-node};
1820
--instanceNode: #{$reactflow-color-instance-node};
@@ -31,4 +33,5 @@ $reactflow-color-rdftype-edge: $reactflow-color-instance-node !default;
3133
--subclassEdgeBright: #{bright($reactflow-color-subclass-edge)};
3234
--subpropertyEdgeBright: #{bright($reactflow-color-subproperty-edge)};
3335
--rdftypeEdgeBright: #{bright($reactflow-color-rdftype-edge)};
36+
/* stylelint-enable custom-property-pattern */
3437
}

src/cmem/react-flow/configuration/_colors-workflow.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
$reactflow-color-project-node: #A5356E !default; // Cannot be part of a workflow but we have no other place atm to configure it
12
$reactflow-color-dataset-node: #3a7896 !default;
23
$reactflow-color-linking-node: #0097a7 !default;
34
$reactflow-color-transform-node: #40a691 !default;
@@ -10,12 +11,14 @@ $reactflow-color-replaceable-input: #faa854 !default;
1011
}
1112

1213
.#{eccgui}-configuration--colors__react-flow-workflow {
14+
--projectNode: #{$reactflow-color-project-node};
1315
--datasetNode: #{$reactflow-color-dataset-node};
1416
--linkingNode: #{$reactflow-color-linking-node};
1517
--transformNode: #{$reactflow-color-transform-node};
1618
--taskNode: #{$reactflow-color-task-node};
1719
--workflowNode: #{$reactflow-color-workflow-node};
1820
--replaceableInput: #{$reactflow-color-replaceable-input};
21+
--projectNodeBright: #{bright($reactflow-color-project-node)};
1922
--datasetNodeBright: #{bright($reactflow-color-dataset-node)};
2023
--linkingNodeBright: #{bright($reactflow-color-linking-node)};
2124
--transformNodeBright: #{bright($reactflow-color-transform-node)};

src/components/AutocompleteField/AutoCompleteField.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,13 +301,15 @@ function AutoCompleteField<T, UPDATE_VALUE>(props: AutoCompleteFieldProps<T, UPD
301301
let enableHighlighting = true;
302302
if (onlySelectItemReturned) {
303303
// If the auto-completion only returns no suggestion or the selected item itself, query with empty string.
304-
const emptyStringResults = await onSearch("");
304+
const emptyStringResults: T[] = await onSearch("");
305305
// Disable highlighting, since we used empty string search
306306
enableHighlighting = false;
307307
// Put selected item at the top if it is not in the result list
308308
if (!!selectedItem && itemIndexOf(emptyStringResults, selectedItem) > -1) {
309-
emptyStringResults.splice(itemIndexOf(emptyStringResults, selectedItem), 1);
310-
result = [selectedItem, ...emptyStringResults];
309+
// Do not mutate original array
310+
const withoutSelected = [...emptyStringResults]
311+
withoutSelected.splice(itemIndexOf(emptyStringResults, selectedItem), 1);
312+
result = [selectedItem, ...withoutSelected];
311313
} else {
312314
result = emptyStringResults;
313315
}

src/components/Card/CardContent.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,16 @@ export interface CardContentProps extends React.HTMLAttributes<HTMLDivElement> {
1515
* Holds the card content.
1616
* Display scrollbars in case there is not enough space for it.
1717
*/
18-
export const CardContent = ({ children, className = "", noFlexHeight, ...otherProps }: CardContentProps) => {
18+
export const CardContent = React.forwardRef<HTMLDivElement, CardContentProps>(({
19+
children,
20+
className='',
21+
noFlexHeight,
22+
...otherProps
23+
}: CardContentProps, ref) => {
1924
return (
2025
<div
2126
{...otherProps}
27+
ref={ref}
2228
className={
2329
`${eccgui}-card__content` +
2430
(noFlexHeight ? ` ${eccgui}-card__content--noflexheight` : "") +
@@ -28,6 +34,4 @@ export const CardContent = ({ children, className = "", noFlexHeight, ...otherPr
2834
{children}
2935
</div>
3036
);
31-
};
32-
33-
export default CardContent;
37+
});

src/components/Icon/canonicalIconNames.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ const canonicalIcons = {
6666
"item-download": icons.Download,
6767
"item-draggable": icons.Draggable,
6868
"item-edit": icons.Edit,
69+
"item-magic-edit": icons.MagicWand,
6970
"item-evaluation": icons.Analytics,
7071
"item-execution": icons.Run,
7172
"item-info": icons.Information,

src/components/Label/Label.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ export interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement>
3939
* Add other elements to the end of the label content
4040
*/
4141
additionalElements?: React.ReactNode | React.ReactNode[];
42+
/** Force label to get displayed as inline block element. */
43+
inline?: boolean;
4244
}
4345

4446
export const Label = ({
@@ -52,6 +54,7 @@ export const Label = ({
5254
isLayoutForElement = "label",
5355
emphasis = "normal",
5456
additionalElements,
57+
inline,
5558
...otherLabelProps
5659
}: LabelProps) => {
5760
let htmlElementstring = isLayoutForElement;
@@ -85,6 +88,7 @@ export const Label = ({
8588
className:
8689
`${eccgui}-label ${eccgui}-label--${emphasis}` +
8790
(className ? " " + className : "") +
91+
(inline ? ` ${eccgui}-label--inline` : "") +
8892
(disabled ? ` ${eccgui}-label--disabled` : ""),
8993
...otherLabelProps,
9094
},

src/components/Label/label.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ $eccgui-color-label-info: rgba($eccgui-color-workspace-text, $eccgui-opacity-mut
88
font-size: $eccgui-size-typo-label;
99
line-height: $eccgui-size-typo-label-lineheight;
1010
color: $eccgui-color-label-text;
11-
vertical-align: middle;
1211

1312
.#{$eccgui}-typography__overflowtext--passdown > & {
1413
display: flex;
@@ -17,6 +16,11 @@ $eccgui-color-label-info: rgba($eccgui-color-workspace-text, $eccgui-opacity-mut
1716
}
1817
}
1918

19+
.#{$eccgui}-label--inline {
20+
display: inline-block;
21+
vertical-align: middle;
22+
}
23+
2024
.#{$eccgui}-label--disabled {
2125
opacity: $eccgui-opacity-disabled;
2226
}

src/components/OverviewItem/overviewitem.scss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,10 @@ $eccgui-size-overviewitem-line-typo-large-lineheight: $eccgui-size-typo-subtitle
193193

194194
.#{$eccgui}-overviewitem__item:hover &,
195195
.#{$eccgui}-overviewitem__item:focus &,
196-
.#{$eccgui}-overviewitem__item:active & {
196+
.#{$eccgui}-overviewitem__item:active &,
197+
&:focus-within,
198+
&:has(.#{$ns}-active),
199+
&:has(.#{$ns}-popover-open) {
197200
display: flex;
198201
}
199202
}

src/components/Switch/Switch.tsx

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,45 @@
1-
import React, { memo, SyntheticEvent } from "react";
2-
import { Switch as BlueprintSwitch, SwitchProps as BlueprintSwitchProps } from "@blueprintjs/core";
1+
import React, { memo } from "react";
2+
import {
3+
Classes as BlueprintClasses,
4+
Switch as BlueprintSwitch,
5+
SwitchProps as BlueprintSwitchProps,
6+
} from "@blueprintjs/core";
37

48
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
9+
import { Label } from "../Label/Label";
510

611
export interface SwitchProps extends Omit<BlueprintSwitchProps, "onChange"> {
712
/**
813
* Event handler for changed state.
914
*/
10-
onChange?: (value: boolean) => any;
15+
onChange?: (value: boolean) => void;
1116
/**
1217
* class names
1318
*/
1419
className?: string;
1520
}
1621

17-
export const Switch = ({ onChange, className, ...otherProps }: SwitchProps) => {
18-
const handleChange = (e: SyntheticEvent<HTMLInputElement>) => {
19-
const checked = !!(e as any).target?.checked;
20-
onChange && onChange(checked);
22+
export const Switch = ({ onChange, className, label, ...otherProps }: SwitchProps) => {
23+
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
24+
if (onChange) {
25+
onChange(!!e.target?.checked);
26+
}
2127
};
2228

23-
return <BlueprintSwitch className={`${eccgui}-switch ${className}`} {...otherProps} onChange={handleChange} />;
29+
return (
30+
<BlueprintSwitch
31+
className={`${eccgui}-switch ${className ?? ""} ${
32+
label && !otherProps.labelElement ? BlueprintClasses.INLINE : ""
33+
}`}
34+
labelElement={
35+
label ? (
36+
<Label text={label} isLayoutForElement="span" disabled={otherProps.disabled} inline />
37+
) : undefined
38+
}
39+
{...otherProps}
40+
onChange={handleChange}
41+
/>
42+
);
2443
};
2544

2645
export default memo(Switch);

0 commit comments

Comments
 (0)