@eccenca/gui-elements 23.2.0-rc.0 → 23.2.0-rc.1
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 +28 -3
- package/dist/cjs/components/AutoSuggestion/AutoSuggestion.js +24 -20
- package/dist/cjs/components/AutoSuggestion/AutoSuggestion.js.map +1 -1
- package/dist/cjs/components/AutocompleteField/AutoCompleteField.js +59 -50
- package/dist/cjs/components/AutocompleteField/AutoCompleteField.js.map +1 -1
- package/dist/cjs/components/AutocompleteField/autoCompleteFieldUtils.js +3 -3
- package/dist/cjs/components/AutocompleteField/autoCompleteFieldUtils.js.map +1 -1
- package/dist/cjs/components/Breadcrumb/BreadcrumbItem.js +9 -6
- package/dist/cjs/components/Breadcrumb/BreadcrumbItem.js.map +1 -1
- package/dist/cjs/components/CodeAutocompleteField/CodeAutocompleteField.js +33 -0
- package/dist/cjs/components/CodeAutocompleteField/CodeAutocompleteField.js.map +1 -0
- package/dist/cjs/components/CodeAutocompleteField/index.js +14 -0
- package/dist/cjs/components/CodeAutocompleteField/index.js.map +1 -0
- package/dist/cjs/components/Depiction/Depiction.js +13 -13
- package/dist/cjs/components/Depiction/Depiction.js.map +1 -1
- package/dist/cjs/components/Icon/IconButton.js +9 -3
- package/dist/cjs/components/Icon/IconButton.js.map +1 -1
- package/dist/cjs/components/Icon/canonicalIconNames.js +2 -0
- package/dist/cjs/components/Icon/canonicalIconNames.js.map +1 -1
- package/dist/cjs/components/MultiSelect/MultiSelect.js +45 -17
- package/dist/cjs/components/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/cjs/components/MultiSuggestField/MultiSuggestField.js +33 -0
- package/dist/cjs/components/MultiSuggestField/MultiSuggestField.js.map +1 -0
- package/dist/cjs/components/OverviewItem/OverviewItem.js +8 -10
- package/dist/cjs/components/OverviewItem/OverviewItem.js.map +1 -1
- package/dist/cjs/components/PropertyValuePair/PropertyName.js +4 -3
- package/dist/cjs/components/PropertyValuePair/PropertyName.js.map +1 -1
- package/dist/cjs/components/Select/Select.js +17 -3
- package/dist/cjs/components/Select/Select.js.map +1 -1
- package/dist/cjs/components/SuggestField/SuggestField.js +39 -0
- package/dist/cjs/components/SuggestField/SuggestField.js.map +1 -0
- package/dist/cjs/components/SuggestField/index.js +19 -0
- package/dist/cjs/components/SuggestField/index.js.map +1 -0
- package/dist/cjs/components/index.js +3 -0
- package/dist/cjs/components/index.js.map +1 -1
- package/dist/cjs/extensions/react-flow/nodes/NodeContent.js +54 -41
- package/dist/cjs/extensions/react-flow/nodes/NodeContent.js.map +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/components/AutoSuggestion/AutoSuggestion.js +23 -18
- package/dist/esm/components/AutoSuggestion/AutoSuggestion.js.map +1 -1
- package/dist/esm/components/AutocompleteField/AutoCompleteField.js +68 -59
- package/dist/esm/components/AutocompleteField/AutoCompleteField.js.map +1 -1
- package/dist/esm/components/AutocompleteField/autoCompleteFieldUtils.js +3 -3
- package/dist/esm/components/AutocompleteField/autoCompleteFieldUtils.js.map +1 -1
- package/dist/esm/components/Breadcrumb/BreadcrumbItem.js +9 -6
- package/dist/esm/components/Breadcrumb/BreadcrumbItem.js.map +1 -1
- package/dist/esm/components/CodeAutocompleteField/CodeAutocompleteField.js +37 -0
- package/dist/esm/components/CodeAutocompleteField/CodeAutocompleteField.js.map +1 -0
- package/dist/esm/components/CodeAutocompleteField/index.js +2 -0
- package/dist/esm/components/CodeAutocompleteField/index.js.map +1 -0
- package/dist/esm/components/Depiction/Depiction.js +12 -12
- package/dist/esm/components/Depiction/Depiction.js.map +1 -1
- package/dist/esm/components/Icon/IconButton.js +10 -4
- package/dist/esm/components/Icon/IconButton.js.map +1 -1
- package/dist/esm/components/Icon/canonicalIconNames.js +2 -0
- package/dist/esm/components/Icon/canonicalIconNames.js.map +1 -1
- package/dist/esm/components/MultiSelect/MultiSelect.js +52 -22
- package/dist/esm/components/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/esm/components/MultiSuggestField/MultiSuggestField.js +37 -0
- package/dist/esm/components/MultiSuggestField/MultiSuggestField.js.map +1 -0
- package/dist/esm/components/OverviewItem/OverviewItem.js +8 -10
- package/dist/esm/components/OverviewItem/OverviewItem.js.map +1 -1
- package/dist/esm/components/PropertyValuePair/PropertyName.js +4 -3
- package/dist/esm/components/PropertyValuePair/PropertyName.js.map +1 -1
- package/dist/esm/components/Select/Select.js +18 -4
- package/dist/esm/components/Select/Select.js.map +1 -1
- package/dist/esm/components/SuggestField/SuggestField.js +43 -0
- package/dist/esm/components/SuggestField/SuggestField.js.map +1 -0
- package/dist/esm/components/SuggestField/index.js +6 -0
- package/dist/esm/components/SuggestField/index.js.map +1 -0
- package/dist/esm/components/index.js +3 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/extensions/react-flow/nodes/NodeContent.js +51 -39
- package/dist/esm/extensions/react-flow/nodes/NodeContent.js.map +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/types/components/AutoSuggestion/AutoSuggestion.d.ts +35 -4
- package/dist/types/components/AutocompleteField/AutoCompleteField.d.ts +23 -6
- package/dist/types/components/AutocompleteField/autoCompleteFieldUtils.d.ts +3 -3
- package/dist/types/components/AutocompleteField/index.d.ts +1 -1
- package/dist/types/components/AutocompleteField/interfaces.d.ts +1 -1
- package/dist/types/components/CodeAutocompleteField/CodeAutocompleteField.d.ts +10 -0
- package/dist/types/components/CodeAutocompleteField/index.d.ts +1 -0
- package/dist/types/components/Icon/IconButton.d.ts +2 -2
- package/dist/types/components/Icon/canonicalIconNames.d.ts +1 -1
- package/dist/types/components/MultiSelect/MultiSelect.d.ts +20 -2
- package/dist/types/components/MultiSuggestField/MultiSuggestField.d.ts +10 -0
- package/dist/types/components/PropertyValuePair/PropertyName.d.ts +5 -1
- package/dist/types/components/Select/Select.d.ts +28 -9
- package/dist/types/components/SuggestField/SuggestField.d.ts +16 -0
- package/dist/types/components/SuggestField/index.d.ts +5 -0
- package/dist/types/components/index.d.ts +3 -0
- package/dist/types/extensions/react-flow/nodes/NodeContent.d.ts +7 -7
- package/dist/types/index.d.ts +2 -1
- package/package.json +1 -1
- package/src/components/AutoSuggestion/AutoSuggestion.stories.tsx +14 -0
- package/src/components/AutoSuggestion/AutoSuggestion.tsx +280 -221
- package/src/components/AutocompleteField/AutoCompleteField.stories.tsx +14 -0
- package/src/components/AutocompleteField/AutoCompleteField.tsx +157 -121
- package/src/components/AutocompleteField/autoCompleteFieldUtils.tsx +10 -16
- package/src/components/AutocompleteField/interfaces.ts +5 -6
- package/src/components/Breadcrumb/BreadcrumbItem.tsx +19 -18
- package/src/components/Breadcrumb/breadcrumb.scss +18 -16
- package/src/components/Breadcrumb/stories/BreadcrumbList.stories.tsx +18 -15
- package/src/components/CodeAutocompleteField/CodeAutocompleteField.stories.tsx +89 -0
- package/src/components/CodeAutocompleteField/CodeAutocompleteField.tsx +22 -0
- package/src/components/CodeAutocompleteField/index.ts +1 -0
- package/src/components/ContextOverlay/contextoverlay.scss +10 -2
- package/src/components/Depiction/Depiction.tsx +57 -55
- package/src/components/Icon/IconButton.tsx +25 -11
- package/src/components/Icon/canonicalIconNames.tsx +4 -0
- package/src/components/MultiSelect/MultiSelect.stories.tsx +9 -47
- package/src/components/MultiSelect/MultiSelect.tsx +110 -66
- package/src/components/MultiSuggestField/MultiSuggestField.stories.tsx +58 -0
- package/src/components/MultiSuggestField/MultiSuggestField.tsx +22 -0
- package/src/components/Notification/notification.scss +20 -17
- package/src/components/OverviewItem/OverviewItem.tsx +11 -20
- package/src/components/PropertyValuePair/PropertyName.tsx +17 -4
- package/src/components/PropertyValuePair/propertyvalue.scss +17 -1
- package/src/components/Select/Select.stories.tsx +49 -20
- package/src/components/Select/Select.tsx +93 -18
- package/src/components/Select/_select.scss +13 -1
- package/src/components/SuggestField/SuggestField.stories.tsx +99 -0
- package/src/components/SuggestField/SuggestField.tsx +28 -0
- package/src/components/SuggestField/index.ts +5 -0
- package/src/components/TagInput/taginput.scss +14 -0
- package/src/components/index.scss +1 -1
- package/src/components/index.ts +3 -0
- package/src/extensions/react-flow/nodes/NodeContent.tsx +105 -87
- package/src/index.ts +2 -5
- package/src/components/AutoSuggestion/stories/AutoSuggestion.stories.tsx +0 -83
- package/src/components/AutocompleteField/stories/AutoCompleteField.stories.tsx +0 -86
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import Color from "color";
|
|
3
|
-
import { Resizable } from "re-resizable";
|
|
4
2
|
import { Position, useStoreState as getStoreStateFlowLegacy } from "react-flow-renderer";
|
|
5
3
|
import { useStore as getStoreStateFlowNext } from "react-flow-renderer-lts";
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
|
|
4
|
+
import Color from "color";
|
|
5
|
+
import { Resizable } from "re-resizable";
|
|
6
|
+
|
|
7
|
+
import { intentClassName, IntentTypes } from "../../../common/Intent";
|
|
9
8
|
import { DepictionProps } from "../../../components/Depiction/Depiction";
|
|
10
|
-
import {
|
|
9
|
+
import { ValidIconName } from "../../../components/Icon/canonicalIconNames";
|
|
10
|
+
import { CLASSPREFIX as eccgui } from "../../../configuration/constants";
|
|
11
|
+
import { Depiction, Icon, OverflowText } from "../../../index";
|
|
11
12
|
import { ReacFlowVersionSupportProps, useReactFlowVersion } from "../versionsupport";
|
|
12
|
-
|
|
13
|
-
import {
|
|
13
|
+
|
|
14
|
+
import { HandleDefault, HandleNextProps, HandleProps } from "./../handles/HandleDefault";
|
|
14
15
|
import { NodeContentExtensionProps } from "./NodeContentExtension";
|
|
16
|
+
import { NodeProps } from "./NodeDefault";
|
|
15
17
|
import { HighlightingState, NodeHighlightColor } from "./sharedTypes";
|
|
16
18
|
|
|
17
19
|
// @deprecated use `NodeContentProps<any>['highlightedState']` (or import from `src/extensions/react-flow/nodes/sharedTypes`)
|
|
@@ -24,7 +26,7 @@ interface NodeContentHandleLegacyProps extends HandleProps {
|
|
|
24
26
|
// @deprecated use `NodeContentHandleProps`
|
|
25
27
|
export type IHandleProps = NodeContentHandleLegacyProps;
|
|
26
28
|
|
|
27
|
-
interface NodeContentHandleNextProps extends HandleNextProps {
|
|
29
|
+
export interface NodeContentHandleNextProps extends HandleNextProps {
|
|
28
30
|
category?: "configuration";
|
|
29
31
|
}
|
|
30
32
|
|
|
@@ -74,7 +76,8 @@ interface NodeContentData<CONTENT_PROPS = any> {
|
|
|
74
76
|
}
|
|
75
77
|
|
|
76
78
|
export interface NodeContentProps<NODE_DATA, NODE_CONTENT_PROPS = any>
|
|
77
|
-
extends NodeContentData,
|
|
79
|
+
extends NodeContentData,
|
|
80
|
+
ReacFlowVersionSupportProps,
|
|
78
81
|
Omit<React.HTMLAttributes<HTMLDivElement>, "content"> {
|
|
79
82
|
/**
|
|
80
83
|
* Size of the node.
|
|
@@ -174,12 +177,12 @@ export interface NodeContentProps<NODE_DATA, NODE_CONTENT_PROPS = any>
|
|
|
174
177
|
* This property is only forwarded from the `NodeDefault` element.
|
|
175
178
|
* If set then it will be always overwritten internally.
|
|
176
179
|
*/
|
|
177
|
-
targetPosition?: typeof Position[keyof typeof Position];
|
|
180
|
+
targetPosition?: (typeof Position)[keyof typeof Position];
|
|
178
181
|
/**
|
|
179
182
|
* This property is only forwarded from the `NodeDefault` element.
|
|
180
183
|
* If set then it will be always overwritten internally.
|
|
181
184
|
*/
|
|
182
|
-
sourcePosition?: typeof Position[keyof typeof Position];
|
|
185
|
+
sourcePosition?: (typeof Position)[keyof typeof Position];
|
|
183
186
|
/**
|
|
184
187
|
* This property is only forwarded from the `NodeDefault` element.
|
|
185
188
|
* If set then it will be always overwritten internally.
|
|
@@ -230,7 +233,7 @@ const defaultHandles = (flowVersion: ReacFlowVersionSupportProps["flowVersion"])
|
|
|
230
233
|
default:
|
|
231
234
|
return [];
|
|
232
235
|
}
|
|
233
|
-
}
|
|
236
|
+
};
|
|
234
237
|
|
|
235
238
|
const getDefaultMinimalTooltipData = (node: any) => {
|
|
236
239
|
return {
|
|
@@ -241,7 +244,14 @@ const getDefaultMinimalTooltipData = (node: any) => {
|
|
|
241
244
|
};
|
|
242
245
|
};
|
|
243
246
|
|
|
244
|
-
const addHandles = (
|
|
247
|
+
const addHandles = (
|
|
248
|
+
handles: any,
|
|
249
|
+
position: any,
|
|
250
|
+
posDirection: any,
|
|
251
|
+
isConnectable: any,
|
|
252
|
+
nodeStyle: any,
|
|
253
|
+
flowVersion: any = "legacy"
|
|
254
|
+
) => {
|
|
245
255
|
return handles[position].map((handle: any, idx: any) => {
|
|
246
256
|
const { className, style = {}, category } = handle;
|
|
247
257
|
const styleAdditions: { [key: string]: string } = {
|
|
@@ -255,7 +265,7 @@ const addHandles = (handles: any, position: any, posDirection: any, isConnectabl
|
|
|
255
265
|
style: { ...style, ...styleAdditions },
|
|
256
266
|
posdirection: posDirection,
|
|
257
267
|
isConnectable: typeof handle.isConnectable !== "undefined" ? handle.isConnectable : isConnectable,
|
|
258
|
-
className:
|
|
268
|
+
className: category
|
|
259
269
|
? (className ? className + " " : "") +
|
|
260
270
|
gethighlightedStateClasses(category, `${eccgui}-graphviz__handle`)
|
|
261
271
|
: className,
|
|
@@ -265,14 +275,9 @@ const addHandles = (handles: any, position: any, posDirection: any, isConnectabl
|
|
|
265
275
|
});
|
|
266
276
|
};
|
|
267
277
|
|
|
268
|
-
const gethighlightedStateClasses = (
|
|
269
|
-
state
|
|
270
|
-
|
|
271
|
-
) => {
|
|
272
|
-
let hightlights = typeof state === "string" ? [state] : state;
|
|
273
|
-
return hightlights.map(
|
|
274
|
-
(item : HighlightingState) => `${baseClassName}--highlight-${item}`
|
|
275
|
-
).join(" ");
|
|
278
|
+
const gethighlightedStateClasses = (state: HighlightingState | HighlightingState[], baseClassName: string) => {
|
|
279
|
+
const hightlights = typeof state === "string" ? [state] : state;
|
|
280
|
+
return hightlights.map((item: HighlightingState) => `${baseClassName}--highlight-${item}`).join(" ");
|
|
276
281
|
};
|
|
277
282
|
|
|
278
283
|
const MemoHandler = React.memo(
|
|
@@ -281,9 +286,8 @@ const MemoHandler = React.memo(
|
|
|
281
286
|
return (
|
|
282
287
|
// we only test a few properties to control re-rendering
|
|
283
288
|
// need to be extended if also other properties need to be changed late
|
|
284
|
-
prev.style[prev.posdirection] === next.style[next.posdirection]
|
|
285
|
-
|
|
286
|
-
)
|
|
289
|
+
prev.style[prev.posdirection] === next.style[next.posdirection] && prev.isConnectable === next.isConnectable
|
|
290
|
+
);
|
|
287
291
|
}
|
|
288
292
|
);
|
|
289
293
|
|
|
@@ -336,27 +340,36 @@ export function NodeContent<CONTENT_PROPS = any>({
|
|
|
336
340
|
const evaluateFlowVersion = useReactFlowVersion();
|
|
337
341
|
const flowVersionCheck = flowVersion || evaluateFlowVersion;
|
|
338
342
|
|
|
339
|
-
const {
|
|
340
|
-
handles = defaultHandles(flowVersionCheck),
|
|
341
|
-
...otherProps
|
|
342
|
-
} = otherDomProps;
|
|
343
|
+
const { handles = defaultHandles(flowVersionCheck), ...otherProps } = otherDomProps;
|
|
343
344
|
|
|
344
|
-
const isResizeable =
|
|
345
|
+
const isResizeable = !!onNodeResize && minimalShape === "none";
|
|
345
346
|
const [width, setWidth] = React.useState<number>(nodeDimensions?.width ?? 0);
|
|
346
347
|
const [height, setHeight] = React.useState<number>(nodeDimensions?.height ?? 0);
|
|
347
348
|
let zoom = 1;
|
|
348
|
-
if (isResizeable)
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
349
|
+
if (isResizeable)
|
|
350
|
+
try {
|
|
351
|
+
[, , zoom] =
|
|
352
|
+
flowVersionCheck === "legacy"
|
|
353
|
+
? getStoreStateFlowLegacy((state) => state.transform)
|
|
354
|
+
: getStoreStateFlowNext((state) => state.transform);
|
|
355
|
+
} catch (error) {
|
|
356
|
+
// do not handle error but at least push it to the console
|
|
357
|
+
console.error(error);
|
|
358
|
+
}
|
|
353
359
|
const [adjustedContentProps, setAdjustedContentProps] = React.useState<Partial<CONTENT_PROPS>>({});
|
|
354
360
|
const nodeContentRef = React.useRef<any>();
|
|
355
|
-
const handleStack =
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
handleStack[Position.
|
|
361
|
+
const handleStack =
|
|
362
|
+
flowVersionCheck === "legacy"
|
|
363
|
+
? ({} as { [key: string]: NodeContentHandleLegacyProps[] })
|
|
364
|
+
: ({} as { [key: string]: NodeContentHandleNextProps[] });
|
|
365
|
+
handleStack[Position.Top] =
|
|
366
|
+
flowVersionCheck === "legacy" ? ([] as NodeContentHandleLegacyProps[]) : ([] as NodeContentHandleNextProps[]);
|
|
367
|
+
handleStack[Position.Right] =
|
|
368
|
+
flowVersionCheck === "legacy" ? ([] as NodeContentHandleLegacyProps[]) : ([] as NodeContentHandleNextProps[]);
|
|
369
|
+
handleStack[Position.Bottom] =
|
|
370
|
+
flowVersionCheck === "legacy" ? ([] as NodeContentHandleLegacyProps[]) : ([] as NodeContentHandleNextProps[]);
|
|
371
|
+
handleStack[Position.Left] =
|
|
372
|
+
flowVersionCheck === "legacy" ? ([] as NodeContentHandleLegacyProps[]) : ([] as NodeContentHandleNextProps[]);
|
|
360
373
|
|
|
361
374
|
// initial dimension before resize
|
|
362
375
|
React.useEffect(() => {
|
|
@@ -383,7 +396,7 @@ export function NodeContent<CONTENT_PROPS = any>({
|
|
|
383
396
|
|
|
384
397
|
if (handles.length > 0) {
|
|
385
398
|
handles.forEach((handle) => {
|
|
386
|
-
if (
|
|
399
|
+
if (handle.position) {
|
|
387
400
|
handleStack[handle.position].push(handle);
|
|
388
401
|
} else if (handle.category === "configuration") {
|
|
389
402
|
handleStack[Position.Top].push(handle);
|
|
@@ -397,7 +410,7 @@ export function NodeContent<CONTENT_PROPS = any>({
|
|
|
397
410
|
}
|
|
398
411
|
});
|
|
399
412
|
}
|
|
400
|
-
const styleExpandDimensions: { [key: string]: string | number } =
|
|
413
|
+
const styleExpandDimensions: { [key: string]: string | number } = Object.create(null);
|
|
401
414
|
if (
|
|
402
415
|
typeof adaptHeightForHandleMinCount !== "undefined" &&
|
|
403
416
|
(minimalShape === "none" || !!selected) &&
|
|
@@ -410,12 +423,13 @@ export function NodeContent<CONTENT_PROPS = any>({
|
|
|
410
423
|
styleExpandDimensions["minHeight"] = Math.max(minHeightLeft, minHeightRight);
|
|
411
424
|
}
|
|
412
425
|
|
|
413
|
-
const {
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
426
|
+
const { highlightClassNameSuffix, highlightCustomPropertySettings } = evaluateHighlightColors(
|
|
427
|
+
"--node-highlight",
|
|
428
|
+
highlightColor
|
|
429
|
+
);
|
|
417
430
|
|
|
418
|
-
const resizableStyles =
|
|
431
|
+
const resizableStyles =
|
|
432
|
+
!!onNodeResize === true && minimalShape === "none" && width + height > 0 ? { width, height } : {};
|
|
419
433
|
const nodeContent = (
|
|
420
434
|
<>
|
|
421
435
|
<section
|
|
@@ -430,10 +444,11 @@ export function NodeContent<CONTENT_PROPS = any>({
|
|
|
430
444
|
(border ? ` ${eccgui}-graphviz__node--border-${border}` : "") +
|
|
431
445
|
(intent ? ` ${intentClassName(intent)}` : "") +
|
|
432
446
|
(highlightClassNameSuffix.length > 0
|
|
433
|
-
? highlightClassNameSuffix
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
447
|
+
? highlightClassNameSuffix
|
|
448
|
+
.map((highlight) => ` ${eccgui}-graphviz__node--highlight-${highlight}`)
|
|
449
|
+
.join("")
|
|
450
|
+
: "") +
|
|
451
|
+
(highlightedState
|
|
437
452
|
? " " + gethighlightedStateClasses(highlightedState, `${eccgui}-graphviz__node`)
|
|
438
453
|
: "") +
|
|
439
454
|
(animated ? ` ${eccgui}-graphviz__node--animated` : "") +
|
|
@@ -441,13 +456,15 @@ export function NodeContent<CONTENT_PROPS = any>({
|
|
|
441
456
|
(letPassWheelEvents === false ? ` nowheel` : "")
|
|
442
457
|
}
|
|
443
458
|
>
|
|
444
|
-
<header
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
459
|
+
<header
|
|
460
|
+
className={
|
|
461
|
+
`${eccgui}-graphviz__node__header` +
|
|
462
|
+
(enlargeHeader && minimalShape === "none" ? ` ${eccgui}-graphviz__node__header--large` : "")
|
|
463
|
+
}
|
|
464
|
+
>
|
|
448
465
|
{(!!iconName || !!depiction || !!leftElement) && (
|
|
449
466
|
<div className={`${eccgui}-graphviz__node__header-depiction`}>
|
|
450
|
-
{
|
|
467
|
+
{leftElement}
|
|
451
468
|
{!!depiction && !leftElement && typeof depiction === "string" && (
|
|
452
469
|
<Depiction
|
|
453
470
|
image={<img src={depiction} alt="" />}
|
|
@@ -459,7 +476,9 @@ export function NodeContent<CONTENT_PROPS = any>({
|
|
|
459
476
|
forceInlineSvg
|
|
460
477
|
/>
|
|
461
478
|
)}
|
|
462
|
-
{!!depiction &&
|
|
479
|
+
{!!depiction &&
|
|
480
|
+
!leftElement &&
|
|
481
|
+
typeof depiction !== "string" &&
|
|
463
482
|
React.cloneElement(depiction, {
|
|
464
483
|
caption: minimalShape === "none" || selected ? typeLabel : undefined,
|
|
465
484
|
captionPosition: "tooltip",
|
|
@@ -467,8 +486,7 @@ export function NodeContent<CONTENT_PROPS = any>({
|
|
|
467
486
|
ratio: "1:1",
|
|
468
487
|
resizing: "contain",
|
|
469
488
|
forceInlineSvg: true,
|
|
470
|
-
})
|
|
471
|
-
)}
|
|
489
|
+
})}
|
|
472
490
|
{!!iconName && !leftElement && !depiction && (
|
|
473
491
|
<Depiction
|
|
474
492
|
image={<Icon name={iconName} />}
|
|
@@ -482,16 +500,19 @@ export function NodeContent<CONTENT_PROPS = any>({
|
|
|
482
500
|
)}
|
|
483
501
|
</div>
|
|
484
502
|
)}
|
|
485
|
-
<div
|
|
486
|
-
{
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
503
|
+
<div
|
|
504
|
+
className={`${eccgui}-graphviz__node__header-label`}
|
|
505
|
+
title={typeof label === "string" ? label : undefined}
|
|
506
|
+
>
|
|
507
|
+
{typeof label === "string" ? (
|
|
508
|
+
<OverflowText className={`${eccgui}-graphviz__node__header-label__mainline`}>
|
|
509
|
+
{label}
|
|
510
|
+
</OverflowText>
|
|
511
|
+
) : (
|
|
512
|
+
<div className={`${eccgui}-graphviz__node__header-label__mainline`}>{label}</div>
|
|
513
|
+
)}
|
|
491
514
|
{!!labelSubline && (
|
|
492
|
-
<div className={`${eccgui}-graphviz__node__header-label__subline`}>
|
|
493
|
-
{ labelSubline }
|
|
494
|
-
</div>
|
|
515
|
+
<div className={`${eccgui}-graphviz__node__header-label__subline`}>{labelSubline}</div>
|
|
495
516
|
)}
|
|
496
517
|
</div>
|
|
497
518
|
{(menuButtons || (showExecutionButtons && executionButtons)) && (
|
|
@@ -509,11 +530,7 @@ export function NodeContent<CONTENT_PROPS = any>({
|
|
|
509
530
|
</div>
|
|
510
531
|
)}
|
|
511
532
|
{contentExtension}
|
|
512
|
-
|
|
513
|
-
<footer className={`${eccgui}-graphviz__node__footer`}>
|
|
514
|
-
{ footerContent }
|
|
515
|
-
</footer>
|
|
516
|
-
)}
|
|
533
|
+
{footerContent && <footer className={`${eccgui}-graphviz__node__footer`}>{footerContent}</footer>}
|
|
517
534
|
</section>
|
|
518
535
|
{!!handles && (
|
|
519
536
|
<>
|
|
@@ -553,7 +570,7 @@ export function NodeContent<CONTENT_PROPS = any>({
|
|
|
553
570
|
</Resizable>
|
|
554
571
|
);
|
|
555
572
|
|
|
556
|
-
return
|
|
573
|
+
return isResizeable ? resizableNode() : nodeContent;
|
|
557
574
|
}
|
|
558
575
|
|
|
559
576
|
const evaluateHighlightColors = (
|
|
@@ -565,8 +582,8 @@ const evaluateHighlightColors = (
|
|
|
565
582
|
[`${baseCustomProperty}-alternate-color`]: undefined,
|
|
566
583
|
} as React.CSSProperties;
|
|
567
584
|
const classesHightlightColors = [] as string[];
|
|
568
|
-
if (
|
|
569
|
-
const highlightingColors =
|
|
585
|
+
if (highlightColor) {
|
|
586
|
+
const highlightingColors = typeof highlightColor === "string" ? [highlightColor] : highlightColor;
|
|
570
587
|
(highlightingColors as Array<string>).map((color, idx) => {
|
|
571
588
|
switch (color) {
|
|
572
589
|
case "default":
|
|
@@ -575,26 +592,27 @@ const evaluateHighlightColors = (
|
|
|
575
592
|
case "alternate":
|
|
576
593
|
classesHightlightColors.push("alternate");
|
|
577
594
|
break;
|
|
578
|
-
default:
|
|
595
|
+
default: {
|
|
579
596
|
classesHightlightColors.push("custom");
|
|
580
|
-
let customColor = Color("#ffffff")
|
|
597
|
+
let customColor = Color("#ffffff");
|
|
581
598
|
try {
|
|
582
599
|
customColor = Color(color);
|
|
583
|
-
} catch(ex) {
|
|
584
|
-
console.warn("Received invalid color for highlight: " + color)
|
|
600
|
+
} catch (ex) {
|
|
601
|
+
console.warn("Received invalid color for highlight: " + color);
|
|
585
602
|
}
|
|
586
603
|
if (idx === 0) {
|
|
587
604
|
styleHighlightColors = {
|
|
588
605
|
...styleHighlightColors,
|
|
589
606
|
[`${baseCustomProperty}-default-color`]: customColor.rgb().toString(),
|
|
590
|
-
} as React.CSSProperties
|
|
607
|
+
} as React.CSSProperties;
|
|
591
608
|
} else {
|
|
592
609
|
styleHighlightColors = {
|
|
593
610
|
...styleHighlightColors,
|
|
594
611
|
[`${baseCustomProperty}-alternate-color`]: customColor.rgb().toString(),
|
|
595
|
-
} as React.CSSProperties
|
|
612
|
+
} as React.CSSProperties;
|
|
596
613
|
}
|
|
597
614
|
break;
|
|
615
|
+
}
|
|
598
616
|
}
|
|
599
617
|
return color;
|
|
600
618
|
});
|
|
@@ -603,10 +621,10 @@ const evaluateHighlightColors = (
|
|
|
603
621
|
return {
|
|
604
622
|
highlightClassNameSuffix: classesHightlightColors,
|
|
605
623
|
highlightCustomPropertySettings: styleHighlightColors,
|
|
606
|
-
}
|
|
607
|
-
}
|
|
624
|
+
};
|
|
625
|
+
};
|
|
608
626
|
|
|
609
627
|
export const nodeContentUtils = {
|
|
610
628
|
evaluateHighlightColors,
|
|
611
|
-
gethighlightedStateClasses
|
|
612
|
-
}
|
|
629
|
+
gethighlightedStateClasses,
|
|
630
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -9,13 +9,10 @@ const ClassNames = {
|
|
|
9
9
|
// @deprecated use `ClassNames`
|
|
10
10
|
const HelperClasses = ClassNames;
|
|
11
11
|
|
|
12
|
+
export * from "./configuration/constants";
|
|
12
13
|
export * from "./common";
|
|
13
14
|
export * from "./components";
|
|
14
15
|
export * from "./extensions";
|
|
15
16
|
export * from "./cmem";
|
|
16
17
|
|
|
17
|
-
export {
|
|
18
|
-
ClassNames,
|
|
19
|
-
HelperClasses,
|
|
20
|
-
LegacyReplacements,
|
|
21
|
-
};
|
|
18
|
+
export { ClassNames, HelperClasses, LegacyReplacements };
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { StoryFn, Meta } from "@storybook/react";
|
|
3
|
-
import { AutoSuggestion, AutoSuggestionProps } from "../../../../index";
|
|
4
|
-
import { IPartialAutoCompleteResult } from "../AutoSuggestion";
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: "Forms/AutoSuggestion",
|
|
8
|
-
component: AutoSuggestion,
|
|
9
|
-
argTypes: {}
|
|
10
|
-
} as Meta<typeof AutoSuggestion>;
|
|
11
|
-
|
|
12
|
-
const Template: StoryFn<typeof AutoSuggestion> = (args) => (
|
|
13
|
-
<AutoSuggestion {...args}></AutoSuggestion>
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
const resultList = [
|
|
17
|
-
"find me",
|
|
18
|
-
"item",
|
|
19
|
-
"auto-completion result"
|
|
20
|
-
]
|
|
21
|
-
|
|
22
|
-
const defaultProps: AutoSuggestionProps = {
|
|
23
|
-
initialValue: "",
|
|
24
|
-
fetchSuggestions(inputString: string, cursorPosition: number): IPartialAutoCompleteResult | undefined | Promise<IPartialAutoCompleteResult | undefined> {
|
|
25
|
-
const stringBeforeCursor = inputString.substring(0, cursorPosition)
|
|
26
|
-
const lastSpaceIdx = stringBeforeCursor.lastIndexOf(" ")
|
|
27
|
-
const searchWordStart = lastSpaceIdx >= 0 ? lastSpaceIdx + 1 : 0
|
|
28
|
-
const lastWordBeforeCursor = stringBeforeCursor.substring(searchWordStart, stringBeforeCursor.length).toLowerCase().trim()
|
|
29
|
-
const replacements = resultList.filter(item => item.toLowerCase().includes(lastWordBeforeCursor))
|
|
30
|
-
if (replacements.length) {
|
|
31
|
-
return {
|
|
32
|
-
cursorPosition: cursorPosition,
|
|
33
|
-
inputString: inputString,
|
|
34
|
-
replacementResults: [{
|
|
35
|
-
extractedQuery: lastWordBeforeCursor,
|
|
36
|
-
replacementInterval: {
|
|
37
|
-
from: searchWordStart,
|
|
38
|
-
length: lastWordBeforeCursor.length
|
|
39
|
-
},
|
|
40
|
-
replacements: replacements.map((v) => ({
|
|
41
|
-
label: `Label of '${v}'`,
|
|
42
|
-
description: `Description of '${v}'`,
|
|
43
|
-
value: v
|
|
44
|
-
}))
|
|
45
|
-
}]
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
placeholder: "The word before the cursor will be auto-completed. At the beginning or after a space, all results are shown.",
|
|
50
|
-
onChange(): any {
|
|
51
|
-
// Do nothing
|
|
52
|
-
},
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/** Offers basic auto-completion for the word right before the cursor. */
|
|
56
|
-
export const Default = Template.bind({});
|
|
57
|
-
|
|
58
|
-
Default.args = defaultProps
|
|
59
|
-
|
|
60
|
-
/** Shows validation error if the input string contains the word 'not'. */
|
|
61
|
-
export const WithValidation = Template.bind({});
|
|
62
|
-
|
|
63
|
-
WithValidation.args = {
|
|
64
|
-
...defaultProps,
|
|
65
|
-
initialValue: "Contains not",
|
|
66
|
-
checkInput: (inputString) => {
|
|
67
|
-
const notIndex = inputString.indexOf("not")
|
|
68
|
-
if(notIndex >= 0) {
|
|
69
|
-
return {
|
|
70
|
-
valid: false,
|
|
71
|
-
parseError: {
|
|
72
|
-
message: "Strings containing the sub-string 'not' are NOT allowed.",
|
|
73
|
-
start: notIndex,
|
|
74
|
-
end: notIndex + 3
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
} else {
|
|
78
|
-
return {
|
|
79
|
-
valid: true
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {ComponentMeta, ComponentStory} from "@storybook/react";
|
|
3
|
-
|
|
4
|
-
import {AutoCompleteField, IAutoCompleteFieldProps} from "../AutoCompleteField";
|
|
5
|
-
import {extractSearchWords, matchesAllWords} from "../../Typography/Highlighter";
|
|
6
|
-
import {createNewItemRendererFactory} from "../autoCompleteFieldUtils";
|
|
7
|
-
|
|
8
|
-
const AutoCompleteFieldStory: ComponentMeta<typeof AutoCompleteField> = {
|
|
9
|
-
title: "Forms/AutoCompleteField",
|
|
10
|
-
component: AutoCompleteField,
|
|
11
|
-
argTypes: {
|
|
12
|
-
},
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const Template: ComponentStory<typeof AutoCompleteField> = (args) => (
|
|
16
|
-
<AutoCompleteField {...args}></AutoCompleteField>
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
export const Default = Template.bind({});
|
|
20
|
-
export const AdaptQueryAfterSelection = Template.bind({})
|
|
21
|
-
export const AllowReset = Template.bind({})
|
|
22
|
-
export const AllowCustomValues = Template.bind({})
|
|
23
|
-
export const ReadOnlyState = Template.bind({})
|
|
24
|
-
|
|
25
|
-
// Renders string values as string
|
|
26
|
-
const defaultRenderer = (item: string) => item
|
|
27
|
-
|
|
28
|
-
const defaultArgs: IAutoCompleteFieldProps<string, string> = {
|
|
29
|
-
itemRenderer: (item: string) => `Rendered item: ${item}`,
|
|
30
|
-
itemValueRenderer: (item: string) => `Selected item: ${item}`,
|
|
31
|
-
itemValueString: (item: string) => `Query: ${item}`,
|
|
32
|
-
onSearch: (query: string) => {
|
|
33
|
-
const multiWord = extractSearchWords(query, true)
|
|
34
|
-
return ["search item A", "search element B", "search object C"]
|
|
35
|
-
.filter(word => matchesAllWords(word.toLowerCase(), multiWord))
|
|
36
|
-
},
|
|
37
|
-
onChange: elem => {
|
|
38
|
-
console.log(`Entry '${elem}' selected!`)
|
|
39
|
-
},
|
|
40
|
-
itemValueSelector: defaultRenderer,
|
|
41
|
-
noResultText: "No result",
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Changes the search query for the selected item, e.g. when the rendered item text should be different from the query finding this item.
|
|
45
|
-
const adaptQueryAfterSelection: IAutoCompleteFieldProps<string, string> = {
|
|
46
|
-
...defaultArgs,
|
|
47
|
-
resetQueryToValue: (selectedValue: string) => selectedValue
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// Allows to reset a selection
|
|
51
|
-
const resetSelection: IAutoCompleteFieldProps<string, string> = {
|
|
52
|
-
...defaultArgs,
|
|
53
|
-
reset: {
|
|
54
|
-
resetValue: "",
|
|
55
|
-
resetButtonText: "Clear selected value",
|
|
56
|
-
resettableValue: (value: string) => true
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const allowCustomValues: IAutoCompleteFieldProps<string, string> = {
|
|
61
|
-
...defaultArgs,
|
|
62
|
-
createNewItem: {
|
|
63
|
-
itemRenderer: createNewItemRendererFactory(
|
|
64
|
-
(query: string) => `Create new item: ${query}`,
|
|
65
|
-
"item-add-artefact"
|
|
66
|
-
),
|
|
67
|
-
itemFromQuery: item => item,
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// Changes the search query for the selected item, e.g. when the rendered item text should be different from the query finding this item.
|
|
72
|
-
const readOnlyState: IAutoCompleteFieldProps<string, string> = {
|
|
73
|
-
...defaultArgs,
|
|
74
|
-
initialValue: "search item B",
|
|
75
|
-
inputProps: {
|
|
76
|
-
readOnly: true
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
Default.args = defaultArgs;
|
|
81
|
-
AdaptQueryAfterSelection.args = adaptQueryAfterSelection;
|
|
82
|
-
AllowReset.args = resetSelection;
|
|
83
|
-
AllowCustomValues.args = allowCustomValues;
|
|
84
|
-
ReadOnlyState.args = readOnlyState;
|
|
85
|
-
|
|
86
|
-
export default AutoCompleteFieldStory
|