Skip to content

Commit e4caa6e

Browse files
authored
Merge pull request #243 from eccenca/release/v24.1.0
Release v24.1.0 into main branch
2 parents 0d7243c + 0b41d31 commit e4caa6e

62 files changed

Lines changed: 2923 additions & 930 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.storybook/helpers.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Icon, TestIcon } from "../src/";
55
import { Definitions as IntentDefinitions } from "../src/common/Intent";
66

77
import canonicalIcons from "./../src/components/Icon/canonicalIconNames";
8+
89
// argTypes helpers
910

1011
const allIcons = new Map([
@@ -20,17 +21,19 @@ export const helpersArgTypes = {
2021
mapping: {
2122
"Not set": undefined,
2223
Handler: () => {
24+
// eslint-disable-next-line no-undef
2325
alert("clicked");
2426
},
2527
},
2628
},
2729
exampleIcon: {
2830
control: "select",
29-
options: ["Not set", "Test icon", ...Object.keys(canonicalIcons)],
31+
options: ["Not set", "Test icon", ...Object.keys(canonicalIcons), "Icon with tooltip"],
3032
mapping: {
3133
"Not set": undefined,
3234
"Test icon": <TestIcon tryout={LogoReact} className="testclass-icon" />,
3335
...Object.fromEntries(allIcons),
36+
"Icon with tooltip": <Icon name={"item-info"} intent="info" tooltipText="Example tooltip" />,
3437
},
3538
},
3639
exampleIntent: {

CHANGELOG.md

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

77
## [Unreleased]
88

9+
### Added
10+
11+
- `<CardActions />`
12+
- `noWrap` property to display them without wrapping its children on multiple lines
13+
- `<ContentGroup />` component
14+
- Manage display of a grouped content section.
15+
- Add info, actions and context annotations by using its properties.
16+
- Can be nested into each other.
17+
- `<CodeEditor />`
18+
- implemented support for linting which is enabled via `useLinting` prop
19+
- `turtle` and `javascript` are currently supported languages for linting
20+
- `useToolbar` property to display toolbar if the `mode` is supported
21+
- currently `markdown` mode is integrated, including support for headlines `<h1-6>`, `<blockquote>`, `<code>` block and inline, `<b>` bold, `<i>`, italic, `<del>` strike through, `<ul>`, `<ol>` and checkbox lists, `<a>` links and `<img>` images
22+
- editor is focused on load if `autoFocus` prop is set to `true`
23+
- implemented support for `disabled` state in code editor
24+
- implemented support for `intent` states in code editor
25+
- `<Label />`
26+
- `additionalElements` property to display elements at the end of the label
27+
- `inline` property to display the label component as inline block
28+
- `<MenutItem />`
29+
- `tooltip` property to dislay tooltip on menu item label
30+
- `<NodeContent />`
31+
- `resizeDirections` to specifiy the axis that can be used to resize the node
32+
- `resizeMaxDimensions` to add maximum values for resizing height/width
33+
- `<OverviewItem />`
34+
- `hasCardWrapper` property to use a `Card` component as wrapper around it, simplifies the process to put it in a box, use `cardProps` to forward basic properties to that `Card` wrapper
35+
- `<SimpleDialog />`
36+
- `actionsProps` property to forward `CardActions` properties, e.g. `noWrap`
37+
- New icons:
38+
- `artefact-task-concatenatetofile`
39+
- `artefact-task-pivot`
40+
- `artefact-task-unpivot`
41+
- `item-magic-edit`
42+
- `operation-format-text-code`
43+
- `operation-format-text-bold`
44+
- `operation-format-text-italic`
45+
- `operation-format-text-strikethrough`
46+
- `operation-format-list-bullet`
47+
- `operation-format-list-checked`
48+
- `operation-format-list-numbered`
49+
50+
### Fixed
51+
52+
- `<CodeAutocompleteField />`:
53+
- Code editor resets to initial value on every code editor instance re-init
54+
- `<CodeEditor />`
55+
- re-render the component if the `wrapLines` property is changed after the component's render
56+
- only fire `onChange` event when the document has actually changed
57+
- `<OverviewItem />`
58+
- whitespace after `Depiction` element when the `OverviewItem` ist used with `densityHigh` and `hasSpacing`
59+
- `<OverviewItemActions />`
60+
- `hiddenInteractions` stay visible if they contain focused elements or opened overlays (e.g. context menus)
61+
- `<TagList />`
62+
- do not create empty list items
63+
- `<SearchField />`
64+
- allow to use `onClearanceHandler` and `rightElement` together
65+
- fix display of `Icon` with `tooltipText` as direct child in `rightElement`
66+
67+
### Changed
68+
69+
- `<ActivityControlWidget />`
70+
- display running time after label if there is an status info to prevent a third line
71+
- `<ReactFlow />`
72+
- property color for `graph` configuration was adjusted
73+
- `<SearchField />`
74+
- internally forced to be managed controlled to keep `onClearanceHandler` independent from outer `value` property
75+
- `<Switch />`
76+
- use always `<Label/>` component for `label` value
77+
- `<StickyNoteNode />`
78+
- Refactored data structure position and dimension (breaking change)
79+
80+
### Deprecated
81+
82+
- `<CodeEditor />`
83+
- fallback of static test id is removed, need then always to be set if necessary
84+
- `<OverflowText />`
85+
- component won't accept properties of any name in future, only data attributes for test IDs and basic HTML element properties
86+
- `<OverviewItemList />`
87+
- `densityHigh` property will be removed, use it directly on `OverviewItem` children
88+
989
## [24.0.1] - 2025-02-06
1090

1191
### Changed

babel.config.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"presets": ["@babel/preset-env", "@babel/preset-react", "@babel/preset-typescript", "@babel/preset-flow"],
33
"plugins": [
4-
["@babel/plugin-proposal-private-methods", { "loose": true }],
5-
["@babel/plugin-proposal-private-property-in-object", { "loose": true }],
6-
["@babel/plugin-proposal-class-properties", { "loose": true }]
4+
["@babel/plugin-transform-private-methods", { "loose": true }],
5+
["@babel/plugin-transform-private-property-in-object", { "loose": true }],
6+
["@babel/plugin-transform-class-properties", { "loose": true }]
77
]
88
}

package.json

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@eccenca/gui-elements",
33
"description": "GUI elements based on other libraries, usable in React application, written in Typescript.",
4-
"version": "24.0.1",
4+
"version": "24.1.0-rc.7",
55
"license": "Apache-2.0",
66
"homepage": "https://github.com/eccenca/gui-elements",
77
"bugs": "https://github.com/eccenca/gui-elements/issues",
@@ -81,11 +81,14 @@
8181
"@codemirror/lang-yaml": "^6.1.2",
8282
"@codemirror/legacy-modes": "^6.4.2",
8383
"@mavrin/remark-typograf": "^2.2.0",
84+
"classnames": "^2.5.1",
8485
"codemirror": "^6.0.1",
8586
"color": "^4.2.3",
8687
"compute-scroll-into-view": "^3.1.0",
88+
"jshint": "^2.13.6",
8789
"lodash": "^4.17.21",
88-
"re-resizable": "^6.10.1",
90+
"n3": "^1.23.1",
91+
"re-resizable": "^6.10.3",
8992
"react": "^16.13.1",
9093
"react-dom": "^16.13.1",
9194
"react-flow-renderer": "9.7.4",
@@ -103,38 +106,40 @@
103106
"xml-formatter": "^3.6.3"
104107
},
105108
"devDependencies": {
106-
"@babel/core": "^7.26.0",
107-
"@babel/plugin-proposal-class-properties": "^7.18.6",
108-
"@babel/plugin-proposal-private-methods": "^7.18.6",
109-
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
110-
"@babel/preset-env": "^7.26.0",
109+
"@babel/core": "^7.26.10",
110+
"@babel/plugin-transform-class-properties": "^7.25.9",
111+
"@babel/plugin-transform-private-methods": "^7.25.9",
112+
"@babel/plugin-transform-private-property-in-object": "^7.25.9",
113+
"@babel/preset-env": "^7.26.9",
111114
"@babel/preset-flow": "^7.25.9",
112115
"@babel/preset-react": "^7.26.3",
113-
"@babel/preset-typescript": "^7.26.0",
116+
"@babel/preset-typescript": "^7.27.0",
114117
"@eslint/compat": "^1.2.4",
115118
"@eslint/eslintrc": "^3.2.0",
116119
"@eslint/js": "^9.17.0",
117-
"@storybook/addon-actions": "^8.4.7",
118-
"@storybook/addon-essentials": "^8.4.7",
119-
"@storybook/addon-jest": "^8.4.7",
120-
"@storybook/addon-links": "^8.4.7",
121-
"@storybook/addon-webpack5-compiler-babel": "^3.0.3",
122-
"@storybook/cli": "^8.4.7",
120+
"@storybook/addon-actions": "^8.6.9",
121+
"@storybook/addon-essentials": "^8.6.9",
122+
"@storybook/addon-jest": "^8.6.9",
123+
"@storybook/addon-links": "^8.6.9",
124+
"@storybook/addon-webpack5-compiler-babel": "^3.0.5",
125+
"@storybook/cli": "^8.6.9",
123126
"@storybook/preset-scss": "^1.0.3",
124-
"@storybook/react": "^8.4.7",
125-
"@storybook/react-webpack5": "^8.4.7",
126-
"@storybook/test": "^8.4.7",
127+
"@storybook/react": "^8.6.9",
128+
"@storybook/react-webpack5": "^8.6.9",
129+
"@storybook/test": "^8.6.9",
127130
"@testing-library/jest-dom": "^6.6.3",
128131
"@testing-library/react": "^12.1.2",
129132
"@types/codemirror": "^5.60.15",
130133
"@types/color": "^3.0.6",
131134
"@types/jest": "^29.5.14",
135+
"@types/jshint": "^2.12.4",
132136
"@types/lodash": "^4.17.13",
137+
"@types/n3": "^1.21.1",
133138
"@types/react-syntax-highlighter": "^15.5.13",
134139
"@typescript-eslint/eslint-plugin": "^8.18.1",
135140
"@typescript-eslint/parser": "^8.18.1",
136141
"babel-jest": "^29.7.0",
137-
"chromatic": "^11.20.2",
142+
"chromatic": "^11.27.0",
138143
"eslint": "^9.17.0",
139144
"eslint-plugin-react": "^7.37.2",
140145
"eslint-plugin-react-hooks": "^5.1.0",
@@ -154,7 +159,7 @@
154159
"rimraf": "^5.0.10",
155160
"sass": "1.62.1",
156161
"sass-loader": "10.3.1",
157-
"storybook": "^8.4.7",
162+
"storybook": "^8.6.9",
158163
"stylelint": "^15.11.0",
159164
"stylelint-config-recess-order": "^4.6.0",
160165
"stylelint-config-standard-scss": "^9.0.0",
@@ -173,7 +178,9 @@
173178
"**/@types/react": "^17.0.83",
174179
"node-sass-package-importer/**/postcss": "^8.4.49",
175180
"**/cross-spawn": "^7.0.5 ",
176-
"**/micromatch": "^4.0.8"
181+
"**/micromatch": "^4.0.8",
182+
"**/@babel/runtime": "^7.26.10",
183+
"**/@babel/helpers": "^7.26.10"
177184
},
178185
"husky": {
179186
"hooks": {

src/cmem/ActivityControl/ActivityControlWidget.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ interface IActivityContextMenu extends TestableComponent {
9292

9393
export interface ActivityControlWidgetAction extends TestableComponent {
9494
// The action that should be triggered
95-
action: () => any;
95+
action: () => void;
9696
// The tooltip that should be shown over the action icon
9797
tooltip?: string;
9898
// The icon of the action button
@@ -147,6 +147,7 @@ export function ActivityControlWidget(props: ActivityControlWidgetProps) {
147147
{props.label && (
148148
<OverviewItemLine small={small}>
149149
{React.cloneElement(labelWrapper, {}, props.label)}
150+
{timerExecutionMsg && (props.statusMessage || tags) && <>&nbsp;({timerExecutionMsg})</>}
150151
</OverviewItemLine>
151152
)}
152153
{(props.statusMessage || tags) && (
@@ -170,7 +171,9 @@ export function ActivityControlWidget(props: ActivityControlWidgetProps) {
170171
)}
171172
</OverviewItemLine>
172173
)}
173-
{timerExecutionMsg && <OverviewItemLine small>{timerExecutionMsg}</OverviewItemLine>}
174+
{timerExecutionMsg && !(props.statusMessage || tags) && (
175+
<OverviewItemLine small>{timerExecutionMsg}</OverviewItemLine>
176+
)}
174177
</OverviewItemDescription>
175178
<OverviewItemActions>
176179
{activityActions &&

src/cmem/react-flow/StickyNoteModal/StickyNoteModal.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,16 @@ import getColorConfiguration from "../../../common/utils/getColorConfiguration";
44
import { CodeEditor } from "../../../extensions";
55
import { ReactFlowHotkeyContext } from "../extensions/ReactFlowHotkeyContext";
66

7-
import { Button, FieldItem, Icon, SimpleDialog, SimpleDialogProps, Tag, TagList } from "./../../../index";
7+
import {
8+
Button,
9+
CodeEditorProps,
10+
FieldItem,
11+
Icon,
12+
SimpleDialog,
13+
SimpleDialogProps,
14+
Tag,
15+
TagList,
16+
} from "./../../../index";
817

918
export type StickyNoteModalTranslationKeys = "modalTitle" | "noteLabel" | "colorLabel" | "saveButton" | "cancelButton";
1019

@@ -32,10 +41,14 @@ export interface StickyNoteModalProps {
3241
* Forward other properties to the `SimpleModal` element that is used for this dialog.
3342
*/
3443
simpleDialogProps?: Omit<SimpleDialogProps, "size" | "title" | "hasBorder" | "isOpen" | "onClose" | "actions">;
44+
/**
45+
* Code editor props
46+
*/
47+
codeEditorProps?: Omit<CodeEditorProps, "defaultValue" | "onChange" | "preventLinuNumbers" | "id" | "name">;
3548
}
3649

3750
export const StickyNoteModal: React.FC<StickyNoteModalProps> = React.memo(
38-
({ metaData, onClose, onSubmit, translate, simpleDialogProps }) => {
51+
({ metaData, onClose, onSubmit, translate, simpleDialogProps, codeEditorProps }) => {
3952
const refNote = React.useRef<string>(metaData?.note ?? "");
4053
const [color, setSelectedColor] = React.useState<string>(metaData?.color ?? "");
4154
const noteColors: [string, string][] = Object.entries(getColorConfiguration("stickynotes")).map(
@@ -123,6 +136,7 @@ export const StickyNoteModal: React.FC<StickyNoteModalProps> = React.memo(
123136
refNote.current = value;
124137
}}
125138
defaultValue={refNote.current}
139+
{...codeEditorProps}
126140
/>
127141
</FieldItem>
128142
<FieldItem

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/AutoSuggestion/AutoSuggestion.tsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ const AutoSuggestion = ({
219219
CodeAutocompleteFieldSuggestionWithReplacementInfo | undefined
220220
>(undefined);
221221
const [cm, setCM] = React.useState<EditorView>();
222+
const currentCm = React.useRef<EditorView>()
223+
currentCm.current = cm
222224
const isFocused = React.useRef(false);
223225
const autoSuggestionDivRef = React.useRef<HTMLDivElement>(null);
224226
/** Mutable editor state, since this needs to be current in scope of the SingleLineEditorComponent. */
@@ -235,12 +237,21 @@ const AutoSuggestion = ({
235237
const pathIsValid = validationResponse?.valid ?? true;
236238

237239
React.useEffect(() => {
238-
if (reInitOnInitialValueChange && initialValue != null && cm) {
240+
if (reInitOnInitialValueChange && initialValue != null && currentCm.current) {
239241
dispatch({
240-
changes: { from: 0, to: cm?.state?.doc.length, insert: initialValue },
242+
changes: { from: 0, to: currentCm.current.state?.doc.length, insert: initialValue },
241243
});
244+
// Validate initial value change
245+
checkValuePathValidity(initialValue)
242246
}
243-
}, [initialValue, cm, reInitOnInitialValueChange]);
247+
}, [initialValue, reInitOnInitialValueChange]);
248+
249+
React.useEffect(() => {
250+
if(currentCm.current) {
251+
// Validate initial value
252+
checkValuePathValidity(initialValue)
253+
}
254+
}, [currentCm.current!!])
244255

245256
const setCurrentIndex = (newIndex: number) => {
246257
editorState.index = newIndex;

0 commit comments

Comments
 (0)