Skip to content

Commit aab7c64

Browse files
committed
Merge remote-tracking branch 'origin/develop' into feature/newMappingSuggestion-CMEM-5433
2 parents ac704c5 + aabf710 commit aab7c64

28 files changed

Lines changed: 1343 additions & 144 deletions

CHANGELOG.md

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

99
### Added
1010

11-
- New icons: "item-magic-edit"
11+
- `CntentGroup` component
12+
- Manage display of a grouped content section.
13+
- Add info, actions and context annotations by using its properties.
14+
- Can be nested into each other.
15+
- `<CodeEditor />`
16+
- implemented support for linting which is enabled via `useLinting` prop
17+
- `turtle` and `javascript` are currently supported languages for linting
18+
- editor is focused on load if `autoFocus` prop is set to `true`
19+
- implemented support for `disabled` state in code editor
20+
- implemented support for `intent` states in code editor
21+
- `Label` component
22+
- added `additionalElements` property to display elements at the end of the label
23+
- `<NodeContent />`
24+
- `resizeDirections` to specifiy the axis that can be used to resize the node
25+
- `resizeMaxDimensions` to add maximum values for resizing height/width
26+
- New icons:
27+
- "item-magic-edit": icon for "magic" edit suggestions
28+
- "artefact-task-concatenatetofile": icon for "Concatenate to file" operator
29+
30+
### Changed
31+
32+
- `<ReactFlow />`
33+
- property color for `graph` configuration was adjusted
34+
35+
## [24.0.1] - 2025-02-06
1236

1337
### Changed
1438

@@ -17,7 +41,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
1741
### Fixed
1842

1943
- `MultiSelect`:
20-
- Old suggestions might be shown for a very short time when typing in a new search query.
44+
- Old suggestions might be shown for a very short time when typing in a new search query.
45+
- `CodeEditor`:
46+
- Broken highlighting for editor modes that leveraged adapted legacy modes.
2147

2248
## [24.0.0] - 2024-12-17
2349

@@ -97,8 +123,6 @@ This is a major release, and it might be not compatible with your current usage
97123
- link color and separation char were adjusted
98124
- `<Markdown/>`
99125
- align blocks for language specific code to default code blocks
100-
- `<ReactFlow />`
101-
- property color for `graph` configuration was adjusted
102126
- switch icons for `item-clone` and `item-copy` to Carbon's `<Replicate/>` and `<Copy/>`
103127
- Remove duplicated icon names `artefact-customtask*` and only keep `artefact-task*` names.
104128
- `<OverviewItemDepiction/>`

package.json

Lines changed: 11 additions & 3 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.0",
4+
"version": "24.0.1",
55
"license": "Apache-2.0",
66
"homepage": "https://github.com/eccenca/gui-elements",
77
"bugs": "https://github.com/eccenca/gui-elements/issues",
@@ -72,17 +72,23 @@
7272
"@blueprintjs/core": "^5.16.2",
7373
"@blueprintjs/select": "^5.3.7",
7474
"@carbon/icons": "^11.53.0",
75-
"@carbon/react": "^1.72.0",
75+
"@carbon/react": "1.72.0",
76+
"@codemirror/lang-javascript": "^6.2.2",
7677
"@codemirror/lang-json": "^6.0.1",
7778
"@codemirror/lang-markdown": "^6.3.1",
79+
"@codemirror/lang-sql": "^6.8.0",
7880
"@codemirror/lang-xml": "^6.1.0",
81+
"@codemirror/lang-yaml": "^6.1.2",
7982
"@codemirror/legacy-modes": "^6.4.2",
8083
"@mavrin/remark-typograf": "^2.2.0",
84+
"classnames": "^2.5.1",
8185
"codemirror": "^6.0.1",
8286
"color": "^4.2.3",
8387
"compute-scroll-into-view": "^3.1.0",
88+
"jshint": "^2.13.6",
8489
"lodash": "^4.17.21",
85-
"re-resizable": "^6.10.1",
90+
"n3": "^1.23.1",
91+
"re-resizable": "^6.10.3",
8692
"react": "^16.13.1",
8793
"react-dom": "^16.13.1",
8894
"react-flow-renderer": "9.7.4",
@@ -126,7 +132,9 @@
126132
"@types/codemirror": "^5.60.15",
127133
"@types/color": "^3.0.6",
128134
"@types/jest": "^29.5.14",
135+
"@types/jshint": "^2.12.4",
129136
"@types/lodash": "^4.17.13",
137+
"@types/n3": "^1.21.1",
130138
"@types/react-syntax-highlighter": "^15.5.13",
131139
"@typescript-eslint/eslint-plugin": "^8.18.1",
132140
"@typescript-eslint/parser": "^8.18.1",

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

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { EditorState } from "@codemirror/state";
44
import { EditorView, lineNumbers, Rect } from "@codemirror/view";
55

66
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
7-
import { CodeEditor } from "../../extensions/codemirror/CodeMirror";
7+
import { CodeEditor, CodeEditorProps } from "../../extensions/codemirror/CodeMirror";
88
//hooks
99
import { SupportedCodeEditorModes } from "../../extensions/codemirror/hooks/useCodemirrorModeExtension.hooks";
1010

@@ -15,23 +15,23 @@ export interface IRange {
1515

1616
export interface ExtendedCodeEditorProps {
1717
// Is called with the editor instance that allows access via the CodeMirror API
18-
setCM: (editor: EditorView | undefined) => any;
18+
setCM: (editor: EditorView | undefined) => void;
1919
// Called whenever the editor content changes
20-
onChange: (value: string) => any;
20+
onChange: (value: string) => void;
2121
// Called when the cursor position changes
22-
onCursorChange: (pos: number, coords: Rect, scrollinfo: HTMLElement, cm: EditorView) => any;
22+
onCursorChange: (pos: number, coords: Rect, scrollinfo: HTMLElement, cm: EditorView) => void;
2323
// The editor theme, e.g. "sparql"
2424
mode?: SupportedCodeEditorModes;
2525
// The initial value of the editor
2626
initialValue: string;
2727
// Called when the focus status changes
28-
onFocusChange: (focused: boolean) => any;
28+
onFocusChange: (focused: boolean) => void;
2929
// Called when the user presses a key
3030
onKeyDown: (event: KeyboardEvent) => boolean;
3131
// function invoked when any click occurs
3232
onMouseDown?: (view: EditorView) => void;
3333
// Called when the user selects text
34-
onSelection: (ranges: IRange[]) => any;
34+
onSelection: (ranges: IRange[]) => void;
3535
// If the <Tab> key is enabled as normal input, i.e. it won't have the behavior of changing to the next input element, expected in a web app.
3636
enableTab?: boolean;
3737
/** Placeholder to be shown when no text has been entered, yet. */
@@ -40,6 +40,27 @@ export interface ExtendedCodeEditorProps {
4040
showScrollBar?: boolean;
4141
/** allow multiline entries when new line characters are entered */
4242
multiline?: boolean;
43+
/**
44+
* Code editor props
45+
*/
46+
codeEditorProps?: Omit<
47+
CodeEditorProps,
48+
| "defaultValue"
49+
| "setEditorView"
50+
| "onChange"
51+
| "onCursorChange"
52+
| "onFocusChange"
53+
| "onKeyDown"
54+
| "onSelection"
55+
| "onMouseDown"
56+
| "shouldHaveMinimalSetup"
57+
| "preventLineNumbers"
58+
| "mode"
59+
| "name"
60+
| "enableTab"
61+
| "additionalExtensions"
62+
| "outerDivAttributes"
63+
>;
4364
}
4465

4566
export type IEditorProps = ExtendedCodeEditorProps;
@@ -58,6 +79,7 @@ export const ExtendedCodeEditor = ({
5879
placeholder,
5980
onCursorChange,
6081
onSelection,
82+
codeEditorProps,
6183
}: ExtendedCodeEditorProps) => {
6284
const initialContent = React.useRef(multiline ? initialValue : initialValue.replace(/[\r\n]/g, " "));
6385
const multilineExtensions = multiline
@@ -88,6 +110,7 @@ export const ExtendedCodeEditor = ({
88110
multiline ? "codeeditor" : `singlelinecodeeditor ${BlueprintClassNames.INPUT}`
89111
}`,
90112
}}
113+
{...codeEditorProps}
91114
/>
92115
);
93116
};
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import React from "react";
2+
import { LoremIpsum } from "react-lorem-ipsum";
3+
import { Meta, StoryFn } from "@storybook/react";
4+
5+
import { Badge, ContentGroup, HtmlContentBlock, IconButton, Tag } from "../../../index";
6+
7+
export default {
8+
title: "Components/ContentGroup",
9+
component: ContentGroup,
10+
argTypes: {
11+
handlerToggleCollapse: {
12+
action: "toggle collapse",
13+
},
14+
},
15+
} as Meta<typeof ContentGroup>;
16+
17+
const TemplateFull: StoryFn<typeof ContentGroup> = (args) => <ContentGroup {...args} />;
18+
19+
export const BasicExample = TemplateFull.bind({});
20+
BasicExample.args = {
21+
title: "Content group title",
22+
contextInfo: <Badge children={100} maxLength={3} intent={"warning"} title="Found warnings context." />,
23+
annotation: (
24+
<Tag backgroundColor={"purple"} round>
25+
Context tag
26+
</Tag>
27+
),
28+
actionOptions: (
29+
<>
30+
<IconButton name="item-remove" text="Example remove tooltip" disruptive />
31+
</>
32+
),
33+
isCollapsed: false,
34+
handlerToggleCollapse: () => {},
35+
borderMainConnection: true,
36+
borderSubConnection: ["red", "blue"],
37+
level: 1,
38+
minimumHeadlineLevel: 5,
39+
whitespaceSize: "small",
40+
description: "More context description by tooltip.",
41+
hideGroupDivider: false,
42+
children: (
43+
<HtmlContentBlock>
44+
<LoremIpsum p={3} avgSentencesPerParagraph={4} random={false} />
45+
</HtmlContentBlock>
46+
),
47+
};

0 commit comments

Comments
 (0)