Skip to content

Commit 4cb4eef

Browse files
authored
Merge branch 'develop' into feature/concatFiles-CMEM-6476
2 parents 9996d27 + eba8881 commit 4cb4eef

27 files changed

Lines changed: 1266 additions & 123 deletions

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,21 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
99
### Added
1010

1111
- Added custom icon for "Concatenate to file" operator (CMEM-6476).
12+
- `CntentGroup` component
13+
- Manage display of a grouped content section.
14+
- Add info, actions and context annotations by using its properties.
15+
- Can be nested into each other.
16+
- `<CodeEditor />`
17+
- implemented support for linting which is enabled via `useLinting` prop
18+
- `turtle` and `javascript` are currently supported languages for linting
19+
- editor is focused on load if `autoFocus` prop is set to `true`
20+
- implemented support for `disabled` state in code editor
21+
- implemented support for `intent` states in code editor
22+
- `Label` component
23+
- added `additionalElements` property to display elements at the end of the label
24+
- `<NodeContent />`
25+
- `resizeDirections` to specifiy the axis that can be used to resize the node
26+
- `resizeMaxDimensions` to add maximum values for resizing height/width
1227

1328
## [24.0.1] - 2025-02-06
1429

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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",
@@ -129,7 +132,9 @@
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",

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)