@eccenca/gui-elements 23.1.0-easynav.3 → 23.1.0-easynav.4
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 +7 -0
- package/dist/cjs/cmem/ActivityControl/ActivityControlWidget.js +6 -4
- package/dist/cjs/cmem/ActivityControl/ActivityControlWidget.js.map +1 -1
- package/dist/cjs/cmem/ActivityControl/SilkActivityControl.js +33 -8
- package/dist/cjs/cmem/ActivityControl/SilkActivityControl.js.map +1 -1
- package/dist/cjs/cmem/ConfidenceValue/ConfidenceValue.js +52 -0
- package/dist/cjs/cmem/ConfidenceValue/ConfidenceValue.js.map +1 -0
- package/dist/cjs/cmem/ConfidenceValue/index.js +14 -0
- package/dist/cjs/cmem/ConfidenceValue/index.js.map +1 -0
- package/dist/cjs/cmem/index.js +11 -0
- package/dist/cjs/cmem/index.js.map +1 -1
- package/dist/cjs/components/AutoSuggestion/SingleLineCodeEditor.js +8 -10
- package/dist/cjs/components/AutoSuggestion/SingleLineCodeEditor.js.map +1 -1
- package/dist/cjs/components/Card/Card.js +7 -6
- package/dist/cjs/components/Card/Card.js.map +1 -1
- package/dist/cjs/components/Card/CardContent.js +4 -2
- package/dist/cjs/components/Card/CardContent.js.map +1 -1
- package/dist/cjs/components/Card/CardHeader.js.map +1 -1
- package/dist/cjs/components/Icon/canonicalIconNames.js +6 -0
- package/dist/cjs/components/Icon/canonicalIconNames.js.map +1 -1
- package/dist/cjs/components/Pagination/Pagination.js +24 -9
- package/dist/cjs/components/Pagination/Pagination.js.map +1 -1
- package/dist/cjs/components/ProgressBar/index.js +14 -0
- package/dist/cjs/components/ProgressBar/index.js.map +1 -0
- package/dist/cjs/components/Switch/Switch.js +2 -2
- package/dist/cjs/components/Switch/Switch.js.map +1 -1
- package/dist/cjs/components/Table/Table.js +45 -0
- package/dist/cjs/components/Table/Table.js.map +1 -0
- package/dist/cjs/components/{SimpleTable → Table}/TableContainer.js +7 -8
- package/dist/cjs/components/Table/TableContainer.js.map +1 -0
- package/dist/cjs/components/Table/TableExpandHeader.js +34 -0
- package/dist/cjs/components/Table/TableExpandHeader.js.map +1 -0
- package/dist/cjs/components/Table/TableExpandRow.js +42 -0
- package/dist/cjs/components/Table/TableExpandRow.js.map +1 -0
- package/dist/cjs/components/Table/index.js +29 -0
- package/dist/cjs/components/Table/index.js.map +1 -0
- package/dist/cjs/components/Tag/TagList.js.map +1 -1
- package/dist/cjs/components/Tag/index.js +11 -0
- package/dist/cjs/components/Tag/index.js.map +1 -0
- package/dist/cjs/components/TextField/TextField.js +25 -9
- package/dist/cjs/components/TextField/TextField.js.map +1 -1
- package/dist/cjs/components/index.js +4 -0
- package/dist/cjs/components/index.js.map +1 -1
- package/dist/cjs/index.js +3 -19
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/cmem/ActivityControl/ActivityControlWidget.js +6 -4
- package/dist/esm/cmem/ActivityControl/ActivityControlWidget.js.map +1 -1
- package/dist/esm/cmem/ActivityControl/SilkActivityControl.js +35 -10
- package/dist/esm/cmem/ActivityControl/SilkActivityControl.js.map +1 -1
- package/dist/esm/cmem/ConfidenceValue/ConfidenceValue.js +56 -0
- package/dist/esm/cmem/ConfidenceValue/ConfidenceValue.js.map +1 -0
- package/dist/esm/cmem/ConfidenceValue/index.js +2 -0
- package/dist/esm/cmem/ConfidenceValue/index.js.map +1 -0
- package/dist/esm/cmem/index.js +1 -0
- package/dist/esm/cmem/index.js.map +1 -1
- package/dist/esm/components/AutoSuggestion/SingleLineCodeEditor.js +8 -10
- package/dist/esm/components/AutoSuggestion/SingleLineCodeEditor.js.map +1 -1
- package/dist/esm/components/Card/Card.js +7 -6
- package/dist/esm/components/Card/Card.js.map +1 -1
- package/dist/esm/components/Card/CardContent.js +4 -2
- package/dist/esm/components/Card/CardContent.js.map +1 -1
- package/dist/esm/components/Card/CardHeader.js.map +1 -1
- package/dist/esm/components/Icon/canonicalIconNames.js +6 -0
- package/dist/esm/components/Icon/canonicalIconNames.js.map +1 -1
- package/dist/esm/components/Pagination/Pagination.js +25 -10
- package/dist/esm/components/Pagination/Pagination.js.map +1 -1
- package/dist/esm/components/ProgressBar/index.js +2 -0
- package/dist/esm/components/ProgressBar/index.js.map +1 -0
- package/dist/esm/components/Switch/Switch.js +2 -2
- package/dist/esm/components/Switch/Switch.js.map +1 -1
- package/dist/esm/components/Table/Table.js +50 -0
- package/dist/esm/components/Table/Table.js.map +1 -0
- package/dist/esm/components/{SimpleTable → Table}/TableContainer.js +7 -8
- package/dist/esm/components/Table/TableContainer.js.map +1 -0
- package/dist/esm/components/Table/TableExpandHeader.js +40 -0
- package/dist/esm/components/Table/TableExpandHeader.js.map +1 -0
- package/dist/esm/components/Table/TableExpandRow.js +48 -0
- package/dist/esm/components/Table/TableExpandRow.js.map +1 -0
- package/dist/esm/components/Table/index.js +15 -0
- package/dist/esm/components/Table/index.js.map +1 -0
- package/dist/esm/components/Tag/TagList.js.map +1 -1
- package/dist/esm/components/Tag/index.js +4 -0
- package/dist/esm/components/Tag/index.js.map +1 -0
- package/dist/esm/components/TextField/TextField.js +26 -10
- package/dist/esm/components/TextField/TextField.js.map +1 -1
- package/dist/esm/components/index.js +4 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/index.js +3 -8
- package/dist/esm/index.js.map +1 -1
- package/dist/types/cmem/ActivityControl/ActivityControlWidget.d.ts +1 -1
- package/dist/types/cmem/ActivityControl/SilkActivityControl.d.ts +6 -2
- package/dist/types/cmem/ConfidenceValue/ConfidenceValue.d.ts +46 -0
- package/dist/types/cmem/ConfidenceValue/index.d.ts +1 -0
- package/dist/types/cmem/index.d.ts +1 -0
- package/dist/types/components/Card/Card.d.ts +5 -1
- package/dist/types/components/Card/CardContent.d.ts +7 -1
- package/dist/types/components/Card/CardHeader.d.ts +9 -1
- package/dist/types/components/Icon/IconButton.d.ts +1 -1
- package/dist/types/components/Icon/canonicalIconNames.d.ts +1 -1
- package/dist/types/components/Pagination/Pagination.d.ts +5 -1
- package/dist/types/components/ProgressBar/index.d.ts +1 -0
- package/dist/types/components/Switch/Switch.d.ts +5 -1
- package/dist/types/components/Table/Table.d.ts +32 -0
- package/dist/types/components/Table/TableContainer.d.ts +13 -0
- package/dist/types/components/Table/TableExpandHeader.d.ts +13 -0
- package/dist/types/components/Table/TableExpandRow.d.ts +13 -0
- package/dist/types/components/Table/index.d.ts +13 -0
- package/dist/types/components/Tag/Tag.d.ts +1 -1
- package/dist/types/components/Tag/TagList.d.ts +5 -2
- package/dist/types/components/Tag/index.d.ts +4 -0
- package/dist/types/components/TextField/TextField.d.ts +9 -0
- package/dist/types/components/index.d.ts +4 -0
- package/dist/types/index.d.ts +1 -6
- package/package.json +1 -1
- package/src/cmem/ActivityControl/ActivityControlWidget.tsx +5 -5
- package/src/cmem/ActivityControl/SilkActivityControl.tsx +44 -17
- package/src/cmem/ConfidenceValue/ConfidenceValue.stories.tsx +22 -0
- package/src/cmem/ConfidenceValue/ConfidenceValue.tsx +116 -0
- package/src/cmem/ConfidenceValue/confidencevalue.scss +49 -0
- package/src/cmem/ConfidenceValue/index.ts +1 -0
- package/src/cmem/_index.scss +1 -0
- package/src/cmem/index.ts +2 -0
- package/src/components/AutoSuggestion/SingleLineCodeEditor.tsx +8 -10
- package/src/components/AutoSuggestion/tests/SingleLineCodeEditor.test.tsx +5 -0
- package/src/components/Badge/badge.scss +2 -5
- package/src/components/Card/Card.tsx +11 -5
- package/src/components/Card/CardContent.tsx +12 -1
- package/src/components/Card/CardHeader.tsx +9 -1
- package/src/components/Card/card.scss +108 -3
- package/src/components/Checkbox/checkbox.scss +6 -2
- package/src/components/Icon/IconButton.tsx +1 -1
- package/src/components/Icon/canonicalIconNames.tsx +13 -0
- package/src/components/Menu/menu.scss +4 -0
- package/src/components/OverviewItem/overviewitem.scss +2 -2
- package/src/components/Pagination/Pagination.tsx +29 -9
- package/src/components/Pagination/pagination.scss +16 -0
- package/src/components/ProgressBar/index.ts +1 -0
- package/src/components/Switch/Switch.tsx +6 -2
- package/src/components/Table/Table.tsx +88 -0
- package/src/components/Table/TableContainer.tsx +49 -0
- package/src/components/Table/TableExpandHeader.tsx +51 -0
- package/src/components/Table/TableExpandRow.tsx +64 -0
- package/src/components/Table/index.tsx +41 -0
- package/src/components/Table/table.scss +318 -0
- package/src/components/Tag/Tag.tsx +1 -1
- package/src/components/Tag/TagList.tsx +5 -3
- package/src/components/Tag/index.ts +5 -0
- package/src/components/Tag/{Tag.stories.tsx → stories/Tag.stories.tsx} +3 -2
- package/src/components/Tag/stories/TagList.stories.tsx +28 -0
- package/src/components/Tag/tag.scss +1 -0
- package/src/components/TextField/TextField.tsx +43 -12
- package/src/components/TextField/stories/TextField.stories.tsx +3 -0
- package/src/components/TextField/textfield.scss +23 -1
- package/src/components/Tree/tree.scss +4 -0
- package/src/components/index.scss +1 -0
- package/src/components/index.ts +5 -0
- package/src/extensions/react-flow/_config.scss +1 -1
- package/src/extensions/react-flow/edges/_edges.scss +25 -24
- package/src/extensions/react-flow/edges/stories/EdgeLabel.stories.tsx +3 -2
- package/src/extensions/react-flow/nodes/_nodes.scss +3 -4
- package/src/index.scss +0 -1
- package/src/index.ts +5 -38
- package/dist/cjs/components/SimpleTable/TableContainer.js.map +0 -1
- package/dist/cjs/components/SimpleTable/index.js +0 -16
- package/dist/cjs/components/SimpleTable/index.js.map +0 -1
- package/dist/esm/components/SimpleTable/TableContainer.js.map +0 -1
- package/dist/esm/components/SimpleTable/index.js +0 -4
- package/dist/esm/components/SimpleTable/index.js.map +0 -1
- package/dist/types/components/SimpleTable/TableContainer.d.ts +0 -3
- package/dist/types/components/SimpleTable/index.d.ts +0 -3
- package/src/components/SimpleTable/TableContainer.tsx +0 -20
- package/src/components/SimpleTable/index.tsx +0 -4
- package/src/components/SimpleTable/simpletable.scss +0 -180
|
@@ -91,7 +91,7 @@ export interface IActivityAction extends TestableComponent {
|
|
|
91
91
|
// The tooltip that should be shown over the action icon
|
|
92
92
|
tooltip?: string;
|
|
93
93
|
// The icon of the action button
|
|
94
|
-
icon: ValidIconName
|
|
94
|
+
icon: ValidIconName | React.ReactElement<TestIconProps>
|
|
95
95
|
// Action is currently disabled (but shown)
|
|
96
96
|
disabled?: boolean;
|
|
97
97
|
// Warning state
|
|
@@ -167,10 +167,10 @@ export function ActivityControlWidget(props: IActivityControlProps) {
|
|
|
167
167
|
</OverviewItemDescription>
|
|
168
168
|
<OverviewItemActions>
|
|
169
169
|
{activityActions &&
|
|
170
|
-
activityActions.map((action) => {
|
|
170
|
+
activityActions.map((action, idx) => {
|
|
171
171
|
return (
|
|
172
172
|
<IconButton
|
|
173
|
-
key={action.icon}
|
|
173
|
+
key={typeof action.icon === "string" ? action.icon : action["data-test-id"] ?? idx}
|
|
174
174
|
data-test-id={action["data-test-id"]}
|
|
175
175
|
name={action.icon}
|
|
176
176
|
text={action.tooltip}
|
|
@@ -189,11 +189,11 @@ export function ActivityControlWidget(props: IActivityControlProps) {
|
|
|
189
189
|
data-test-id={activityContextMenu["data-test-id"]}
|
|
190
190
|
togglerText={activityContextMenu.tooltip}
|
|
191
191
|
>
|
|
192
|
-
{activityContextMenu.menuItems.map((menuAction) => {
|
|
192
|
+
{activityContextMenu.menuItems.map((menuAction, idx) => {
|
|
193
193
|
return (
|
|
194
194
|
<MenuItem
|
|
195
195
|
icon={menuAction.icon}
|
|
196
|
-
key={menuAction.icon}
|
|
196
|
+
key={typeof menuAction.icon === "string" ? menuAction.icon : menuAction["data-test-id"] ?? idx}
|
|
197
197
|
onClick={menuAction.action}
|
|
198
198
|
text={menuAction.tooltip}
|
|
199
199
|
/>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import React, {
|
|
1
|
+
import {TestableComponent} from "../../components/interfaces";
|
|
2
|
+
import {ActivityControlWidget, IActivityAction} from "./ActivityControlWidget";
|
|
3
|
+
import React, {useEffect, useRef, useState} from "react";
|
|
4
4
|
import {ConcreteActivityStatus, IActivityStatus} from "./ActivityControlTypes";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
5
|
+
import {Intent} from "@blueprintjs/core/src/common/intent";
|
|
6
|
+
import {ActivityExecutionErrorReportModal} from "./ActivityExecutionErrorReportModal";
|
|
7
|
+
import {Icon, Spacing} from "../../";
|
|
8
|
+
import {ElapsedDateTimeDisplay, TimeUnits} from "../DateTimeDisplay/ElapsedDateTimeDisplay";
|
|
9
|
+
import {IntentTypes} from "../../common/Intent";
|
|
10
10
|
|
|
11
11
|
const progressBreakpointIndetermination = 10;
|
|
12
12
|
const progressBreakpointAnimation = 99;
|
|
@@ -41,6 +41,10 @@ interface SilkActivityControlProps extends TestableComponent {
|
|
|
41
41
|
};
|
|
42
42
|
// DI activity actions
|
|
43
43
|
executeActivityAction: (action: ActivityAction) => void;
|
|
44
|
+
/** If specified, the activity control will offer a "Start prioritized" button while the activity is in the waiting state.
|
|
45
|
+
* When the button is clicked it should start the activity via the startPrioritized endpoint.
|
|
46
|
+
*/
|
|
47
|
+
executePrioritized?: () => void;
|
|
44
48
|
// Get the translation for a specific key
|
|
45
49
|
translate: (key: ActivityControlTranslationKeys) => string;
|
|
46
50
|
// When defined the elapsed time since the last start is displayed next to the label
|
|
@@ -127,7 +131,7 @@ interface IStacktrace {
|
|
|
127
131
|
cause?: IStacktrace;
|
|
128
132
|
}
|
|
129
133
|
|
|
130
|
-
export type ActivityControlTranslationKeys = "startActivity" | "stopActivity" | "reloadActivity" | "showErrorReport";
|
|
134
|
+
export type ActivityControlTranslationKeys = "startActivity" | "stopActivity" | "reloadActivity" | "showErrorReport" | "startPrioritized";
|
|
131
135
|
|
|
132
136
|
export type ActivityAction = "start" | "cancel" | "restart";
|
|
133
137
|
|
|
@@ -153,14 +157,28 @@ export function useSilkActivityControl({
|
|
|
153
157
|
tags,
|
|
154
158
|
layoutConfig = defaultLayout,
|
|
155
159
|
hideMessageOnStatus = () => false,
|
|
160
|
+
executePrioritized,
|
|
156
161
|
...props
|
|
157
162
|
}: SilkActivityControlProps) {
|
|
158
163
|
const [activityStatus, setActivityStatus] = useState<IActivityStatus | undefined>(initialStatus);
|
|
164
|
+
const currentStatus = useRef<IActivityStatus | undefined>(initialStatus)
|
|
165
|
+
const [showStartPrioritized, setShowStartPrioritized] = useState(false)
|
|
159
166
|
const [errorReport, setErrorReport] = useState<string | IActivityExecutionReport | undefined>(undefined);
|
|
160
167
|
|
|
161
168
|
// Register update function
|
|
162
169
|
useEffect(() => {
|
|
163
|
-
const updateActivityStatus = (status:
|
|
170
|
+
const updateActivityStatus = (status: IActivityStatus | undefined) => {
|
|
171
|
+
if(status?.concreteStatus !== "Waiting") {
|
|
172
|
+
setShowStartPrioritized(false)
|
|
173
|
+
} else if(executePrioritized) {
|
|
174
|
+
// Show start prioritized button only-if the activity is still in Waiting status after 2s
|
|
175
|
+
setTimeout(() => {
|
|
176
|
+
if(currentStatus.current?.concreteStatus === "Waiting") {
|
|
177
|
+
setShowStartPrioritized(true)
|
|
178
|
+
}
|
|
179
|
+
}, 2000)
|
|
180
|
+
}
|
|
181
|
+
currentStatus.current = status
|
|
164
182
|
setActivityStatus(status)
|
|
165
183
|
}
|
|
166
184
|
registerForUpdates(updateActivityStatus)
|
|
@@ -184,13 +202,22 @@ export function useSilkActivityControl({
|
|
|
184
202
|
}
|
|
185
203
|
|
|
186
204
|
if (showStartAction) {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
205
|
+
if(showStartPrioritized && executePrioritized) {
|
|
206
|
+
actions.push({
|
|
207
|
+
"data-test-id": "activity-start-prioritized-activity",
|
|
208
|
+
icon: "item-skip-forward",
|
|
209
|
+
action: executePrioritized,
|
|
210
|
+
tooltip: translate("startPrioritized"),
|
|
211
|
+
})
|
|
212
|
+
} else {
|
|
213
|
+
actions.push({
|
|
214
|
+
"data-test-id": "activity-start-activity",
|
|
215
|
+
icon: "item-start",
|
|
216
|
+
action: () => executeActivityAction("start"),
|
|
217
|
+
tooltip: translate("startActivity"),
|
|
218
|
+
disabled: activityStatus?.isRunning === true,
|
|
219
|
+
});
|
|
220
|
+
}
|
|
194
221
|
}
|
|
195
222
|
|
|
196
223
|
if (showReloadAction) {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
3
|
+
import { ConfidenceValue } from "../../../index";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "cmem/ConfidenceValue",
|
|
7
|
+
component: ConfidenceValue,
|
|
8
|
+
argTypes: {
|
|
9
|
+
barColor: {
|
|
10
|
+
control: "color",
|
|
11
|
+
},
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
} as ComponentMeta<typeof ConfidenceValue>;
|
|
15
|
+
|
|
16
|
+
const TemplateIcons: ComponentStory<typeof ConfidenceValue> = (args) => (
|
|
17
|
+
<ConfidenceValue {...args} />
|
|
18
|
+
);
|
|
19
|
+
export const Default = TemplateIcons.bind({});
|
|
20
|
+
Default.args = {
|
|
21
|
+
value: "0.5"
|
|
22
|
+
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Color from "color";
|
|
3
|
+
import { Tag, TagProps } from "./../../components/Tag";
|
|
4
|
+
import { ProgressBar, ProgressBarProps } from "./../../components/ProgressBar";
|
|
5
|
+
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
6
|
+
|
|
7
|
+
export interface ConfidenceValueProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, "children"> {
|
|
8
|
+
/**
|
|
9
|
+
* Confidence value.
|
|
10
|
+
*/
|
|
11
|
+
value: number;
|
|
12
|
+
/**
|
|
13
|
+
* Minimal border for the confidence range.
|
|
14
|
+
*/
|
|
15
|
+
minValue?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Center (or average) value of the confidence range.
|
|
18
|
+
*/
|
|
19
|
+
centerValue?: number;
|
|
20
|
+
/**
|
|
21
|
+
* Maximum border for the confidence range.
|
|
22
|
+
*/
|
|
23
|
+
maxValue?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Color of the confidence bar.
|
|
26
|
+
* By default it is colorized red for values below the `centerValue`, otherwise green.
|
|
27
|
+
*/
|
|
28
|
+
barColor?: Color | string;
|
|
29
|
+
/**
|
|
30
|
+
* The value is displayed by a bar.
|
|
31
|
+
* This confidence bar can be start from the left or right side, or from the center of the element.
|
|
32
|
+
*/
|
|
33
|
+
barStart?: "side" | "center";
|
|
34
|
+
/**
|
|
35
|
+
* What width is used to display the lement.
|
|
36
|
+
* It could use the `minimal` necessary space, the `maximal` available space, or a `static` width.
|
|
37
|
+
*/
|
|
38
|
+
spaceUsage?: "minimal" | "static" | "maximal";
|
|
39
|
+
/**
|
|
40
|
+
* Additional properties for the `<Tag/>` element that is used to display the confidence value.
|
|
41
|
+
*/
|
|
42
|
+
tagProps?: Omit<TagProps, "className">;
|
|
43
|
+
/**
|
|
44
|
+
* Additional properties for the `<PRogressBar/>` element that is used to display the confidence bar.
|
|
45
|
+
*/
|
|
46
|
+
progressBarProps?: Omit<ProgressBarProps, "className">;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const toPercent = (n: number) => {
|
|
50
|
+
let formatted = (n * 100).toFixed(2)
|
|
51
|
+
const maybeRemovedFraction = formatted.replace(/(\.0+$)|(0+$)/, "")
|
|
52
|
+
return `${maybeRemovedFraction}%`
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function ConfidenceValue ({
|
|
56
|
+
className,
|
|
57
|
+
value,
|
|
58
|
+
minValue = -1,
|
|
59
|
+
maxValue = 1,
|
|
60
|
+
centerValue = 0,
|
|
61
|
+
barColor,
|
|
62
|
+
barStart = "side",
|
|
63
|
+
spaceUsage = "static",
|
|
64
|
+
tagProps,
|
|
65
|
+
progressBarProps,
|
|
66
|
+
...otherProps
|
|
67
|
+
}: ConfidenceValueProps) {
|
|
68
|
+
|
|
69
|
+
const barValue = (
|
|
70
|
+
value === centerValue ? 0 :
|
|
71
|
+
value < centerValue ? value / (minValue - centerValue) :
|
|
72
|
+
value / (maxValue - centerValue)
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
let color = Color("#000000");
|
|
76
|
+
if (!!barColor) {
|
|
77
|
+
try {
|
|
78
|
+
color = Color(barColor);
|
|
79
|
+
} catch(ex) {
|
|
80
|
+
console.warn("Received invalid color for confidence bar: " + barColor)
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<span
|
|
86
|
+
className={
|
|
87
|
+
`${eccgui}-confidencevalue` +
|
|
88
|
+
` ${eccgui}-confidencevalue--${barStart}` +
|
|
89
|
+
` ${eccgui}-confidencevalue--${spaceUsage}space` +
|
|
90
|
+
(value < centerValue ? ` ${eccgui}-confidencevalue--negative` : ` ${eccgui}-confidencevalue--positive`) +
|
|
91
|
+
(className ? ` ${className}` : "")
|
|
92
|
+
}
|
|
93
|
+
{...otherProps}
|
|
94
|
+
>
|
|
95
|
+
<Tag
|
|
96
|
+
className={`${eccgui}-confidencevalue__value`}
|
|
97
|
+
{...tagProps}
|
|
98
|
+
>
|
|
99
|
+
{toPercent(value)}
|
|
100
|
+
</Tag>
|
|
101
|
+
<div
|
|
102
|
+
className={`${eccgui}-confidencevalue__bar-colorwrapper`}
|
|
103
|
+
style={!!barColor ? { color: color.rgb().toString() } : {}}
|
|
104
|
+
>
|
|
105
|
+
<ProgressBar
|
|
106
|
+
className={`${eccgui}-confidencevalue__bar`}
|
|
107
|
+
value={barValue}
|
|
108
|
+
intent={!!barColor ? undefined : value < centerValue ? "danger" : "success"}
|
|
109
|
+
stripes={false}
|
|
110
|
+
animate={false}
|
|
111
|
+
{...progressBarProps}
|
|
112
|
+
/>
|
|
113
|
+
</div>
|
|
114
|
+
</span>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
.#{$eccgui}-confidencevalue {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
position: relative;
|
|
4
|
+
width: 5rem;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.#{$eccgui}-confidencevalue--minimalspace {
|
|
8
|
+
width: auto;
|
|
9
|
+
min-width: 0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.#{$eccgui}-confidencevalue--maximalspace {
|
|
13
|
+
width: auto;
|
|
14
|
+
min-width: 100%;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.#{$eccgui}-confidencevalue__value {
|
|
18
|
+
width: 100%;
|
|
19
|
+
text-align: center;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.#{$eccgui}-confidencevalue__bar {
|
|
23
|
+
position: absolute;
|
|
24
|
+
left: 0;
|
|
25
|
+
bottom: 0;
|
|
26
|
+
width: 100%;
|
|
27
|
+
height: 3px;
|
|
28
|
+
background-color: transparent;
|
|
29
|
+
|
|
30
|
+
.#{$eccgui}-confidencevalue--center & {
|
|
31
|
+
left: 50%;
|
|
32
|
+
width: 50%;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.#{$eccgui}-confidencevalue--negative & {
|
|
36
|
+
transform: rotate(180deg);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.#{$eccgui}-confidencevalue--center.#{$eccgui}-confidencevalue--negative & {
|
|
40
|
+
left: 0;
|
|
41
|
+
right: 50%;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.#{$eccgui}-confidencevalue__bar-colorwrapper {
|
|
46
|
+
& .#{$ns}-progress-meter {
|
|
47
|
+
background-color: currentColor;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ConfidenceValue";
|
package/src/cmem/_index.scss
CHANGED
package/src/cmem/index.ts
CHANGED
|
@@ -49,22 +49,21 @@ const SingleLineCodeEditor = ({
|
|
|
49
49
|
placeholder,
|
|
50
50
|
showScrollBar = true
|
|
51
51
|
}: IEditorProps) => {
|
|
52
|
+
const singleLineInitialContent = React.useRef(initialValue.replace(/[\r\n]/g, " "))
|
|
52
53
|
return (
|
|
53
54
|
<div className={`${eccgui}-singlelinecodeeditor ${BlueprintClassNames.INPUT}`}>
|
|
54
55
|
<UnControlledEditor
|
|
55
56
|
editorDidMount={(editor: any) => {
|
|
56
57
|
editor.on("beforeChange", (_: any, change: any) => {
|
|
57
58
|
// Prevent the user from entering new-line characters, since this is supposed to be a one-line editor.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
if (change.update && typeof change.update === "function") {
|
|
61
|
-
change.update(change.from, change.to, [newText]);
|
|
59
|
+
if (change.update && typeof change.update === "function" && change.text.length > 1) {
|
|
60
|
+
change.update(change.from, change.to, [change.text.join("")]);
|
|
62
61
|
}
|
|
63
62
|
return true;
|
|
64
63
|
});
|
|
65
64
|
setEditorInstance(editor);
|
|
66
65
|
}}
|
|
67
|
-
value={
|
|
66
|
+
value={singleLineInitialContent.current}
|
|
68
67
|
onFocus={() => onFocusChange(true)}
|
|
69
68
|
onBlur={() => onFocusChange(false)}
|
|
70
69
|
options={{
|
|
@@ -89,11 +88,10 @@ const SingleLineCodeEditor = ({
|
|
|
89
88
|
editor.getScrollInfo()
|
|
90
89
|
);
|
|
91
90
|
}}
|
|
92
|
-
onBeforeChange={(_editor,
|
|
93
|
-
//
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
_editor.setValue(trimmedValue)
|
|
91
|
+
onBeforeChange={(_editor, data, _, next) => {
|
|
92
|
+
// Reduce multiple lines to a single line
|
|
93
|
+
if (data.text.length > 1) {
|
|
94
|
+
_editor.setValue(data.text.join(""))
|
|
97
95
|
}
|
|
98
96
|
next()
|
|
99
97
|
}}
|
|
@@ -53,4 +53,9 @@ describe("SingleLineCodeEditor", () => {
|
|
|
53
53
|
.setValue("I'm entering a new line \n character");
|
|
54
54
|
expect(codeMirrorEditorInstance.lineCount()).toBe(1);
|
|
55
55
|
});
|
|
56
|
+
|
|
57
|
+
it("should convert multiple lines to a single line", () => {
|
|
58
|
+
render(<SingleLineEditor {...{...props, initialValue: "1\n2\n3"}} />);
|
|
59
|
+
expect(codeMirrorEditorInstance.lineCount()).toBe(1);
|
|
60
|
+
});
|
|
56
61
|
});
|
|
@@ -24,6 +24,10 @@ export interface CardProps extends BlueprintCardProps {
|
|
|
24
24
|
* Property value defined which part of the card is always scrolled in, this may important when the card is larger than the viewport.
|
|
25
25
|
*/
|
|
26
26
|
scrollinOnFocus?: "start" | "center" | "end";
|
|
27
|
+
/**
|
|
28
|
+
* Controls how much whitespace is displayed within the card subelements.
|
|
29
|
+
*/
|
|
30
|
+
whitespaceAmount?: "none" | "small" | "medium" | "large";
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
/**
|
|
@@ -38,6 +42,7 @@ function Card({
|
|
|
38
42
|
fullHeight=false,
|
|
39
43
|
elevated=false,
|
|
40
44
|
scrollinOnFocus,
|
|
45
|
+
whitespaceAmount="medium",
|
|
41
46
|
interactive,
|
|
42
47
|
...otherProps
|
|
43
48
|
}: CardProps) {
|
|
@@ -55,11 +60,12 @@ function Card({
|
|
|
55
60
|
const cardElement = (
|
|
56
61
|
<BlueprintCard
|
|
57
62
|
className={
|
|
58
|
-
`${eccgui}-card
|
|
59
|
-
(fullHeight ? ` ${eccgui}-card--fullheight
|
|
60
|
-
(elevated ? ` ${eccgui}-card--elevated
|
|
61
|
-
(!!scrollinOnFocus ? ` ${eccgui}-card--scrollonfocus
|
|
62
|
-
|
|
63
|
+
`${eccgui}-card` +
|
|
64
|
+
(fullHeight ? ` ${eccgui}-card--fullheight` : '') +
|
|
65
|
+
(elevated ? ` ${eccgui}-card--elevated` : '') +
|
|
66
|
+
(!!scrollinOnFocus ? ` ${eccgui}-card--scrollonfocus` : '') +
|
|
67
|
+
(whitespaceAmount !== "medium" ? ` ${eccgui}-card--whitespace-${whitespaceAmount}` : '') +
|
|
68
|
+
(!!className ? ` ${className}` : "")
|
|
63
69
|
}
|
|
64
70
|
elevation={elevation}
|
|
65
71
|
interactive={!!otherProps.onClick ? true : interactive}
|
|
@@ -2,6 +2,12 @@ import React from 'react';
|
|
|
2
2
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
3
3
|
|
|
4
4
|
export interface CardContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/**
|
|
6
|
+
* Usually `CardContent` remains the available space inside a card.
|
|
7
|
+
* This option changes that behaviour, so that the content section is not grown or shrinked.
|
|
8
|
+
* You may use this then you have multiple content section in one card but not all those sections should be grown or shrinked regarding the remaining space.
|
|
9
|
+
*/
|
|
10
|
+
noFlexHeight?: boolean;
|
|
5
11
|
}
|
|
6
12
|
|
|
7
13
|
/**
|
|
@@ -11,12 +17,17 @@ export interface CardContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
11
17
|
function CardContent({
|
|
12
18
|
children,
|
|
13
19
|
className='',
|
|
20
|
+
noFlexHeight,
|
|
14
21
|
...otherProps
|
|
15
22
|
}: CardContentProps) {
|
|
16
23
|
return (
|
|
17
24
|
<div
|
|
18
25
|
{...otherProps}
|
|
19
|
-
className={
|
|
26
|
+
className={
|
|
27
|
+
`${eccgui}-card__content` +
|
|
28
|
+
(noFlexHeight ? ` ${eccgui}-card__content--noflexheight` : "") +
|
|
29
|
+
(!!className ? ` ${className}` : "")
|
|
30
|
+
}
|
|
20
31
|
>
|
|
21
32
|
{children}
|
|
22
33
|
</div>
|
|
@@ -5,8 +5,16 @@ import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
|
5
5
|
import CardTitle from "./CardTitle";
|
|
6
6
|
import CardOptions from "./CardOptions";
|
|
7
7
|
|
|
8
|
-
interface CardHeaderProps extends OverviewItemProps {
|
|
8
|
+
interface CardHeaderProps extends Omit<OverviewItemProps, "densityHigh" | "hasSpacing"> {
|
|
9
9
|
children: JSX.Element | (JSX.Element | undefined | null)[] | null | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated
|
|
12
|
+
*/
|
|
13
|
+
densityHigh?: OverviewItemProps["densityHigh"];
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated
|
|
16
|
+
*/
|
|
17
|
+
hasSpacing?: OverviewItemProps["hasSpacing"];
|
|
10
18
|
}
|
|
11
19
|
|
|
12
20
|
function CardHeader({
|
|
@@ -53,6 +53,18 @@ $eccgui-size-card-spacing: $eccgui-size-typo-base !default;
|
|
|
53
53
|
box-sizing: content-box;
|
|
54
54
|
flex-grow: 0;
|
|
55
55
|
flex-shrink: 0;
|
|
56
|
+
|
|
57
|
+
.#{$eccgui}-card--whitespace-none > header > & {
|
|
58
|
+
padding: 0
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.#{$eccgui}-card--whitespace-small > header > & {
|
|
62
|
+
padding: $eccgui-size-card-spacing * 0.25 $eccgui-size-card-spacing * 0.25 $eccgui-size-card-spacing * 0.25 $eccgui-size-card-spacing * 0.5;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.#{$eccgui}-card--whitespace-large > header > & {
|
|
66
|
+
padding: $eccgui-size-card-spacing $eccgui-size-card-spacing $eccgui-size-card-spacing $eccgui-size-card-spacing * 2;
|
|
67
|
+
}
|
|
56
68
|
}
|
|
57
69
|
|
|
58
70
|
.#{$eccgui}-card__title {
|
|
@@ -82,28 +94,102 @@ $eccgui-size-card-spacing: $eccgui-size-typo-base !default;
|
|
|
82
94
|
}
|
|
83
95
|
}
|
|
84
96
|
|
|
97
|
+
.#{$eccgui}-card__options {
|
|
98
|
+
flex-shrink: 1;
|
|
99
|
+
max-width: calc(100% - #{$eccgui-size-card-spacing * 1.5});
|
|
100
|
+
|
|
101
|
+
& > .#{$eccgui}-button:not(.#{$eccgui}-button--icon) {
|
|
102
|
+
flex-shrink: 1;
|
|
103
|
+
|
|
104
|
+
.#{$ns}-button-text {
|
|
105
|
+
white-space: nowrap;
|
|
106
|
+
overflow: hidden;
|
|
107
|
+
text-overflow: ellipsis;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
85
112
|
.#{$eccgui}-card__content {
|
|
86
113
|
padding: $eccgui-size-card-spacing * 0.5 $eccgui-size-card-spacing $eccgui-size-card-spacing $eccgui-size-card-spacing;
|
|
87
114
|
flex-grow: 1;
|
|
88
115
|
flex-shrink: 1;
|
|
89
116
|
overflow: auto;
|
|
90
117
|
|
|
118
|
+
.#{$eccgui}-card--whitespace-none > & {
|
|
119
|
+
padding: 0;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.#{$eccgui}-card--whitespace-small > & {
|
|
123
|
+
padding: $eccgui-size-card-spacing * 0.25 $eccgui-size-card-spacing * 0.5 $eccgui-size-card-spacing * 0.5 $eccgui-size-card-spacing * 0.5;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.#{$eccgui}-card--whitespace-large > & {
|
|
127
|
+
padding: $eccgui-size-card-spacing $eccgui-size-card-spacing * 2 $eccgui-size-card-spacing * 2 $eccgui-size-card-spacing * 2;
|
|
128
|
+
}
|
|
129
|
+
|
|
91
130
|
.#{$eccgui}-separation__divider-horizontal + &,
|
|
92
131
|
&:first-child {
|
|
93
132
|
padding-top: $eccgui-size-card-spacing;
|
|
133
|
+
|
|
134
|
+
.#{$eccgui}-card--whitespace-none > & {
|
|
135
|
+
padding-top: 0;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.#{$eccgui}-card--whitespace-small > & {
|
|
139
|
+
padding-top: $eccgui-size-card-spacing * 0.5;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.#{$eccgui}-card--whitespace-large > & {
|
|
143
|
+
padding-top: $eccgui-size-card-spacing * 2;
|
|
144
|
+
}
|
|
94
145
|
}
|
|
95
146
|
}
|
|
96
147
|
|
|
148
|
+
.#{$eccgui}-card__content--noflexheight {
|
|
149
|
+
flex-grow: 0;
|
|
150
|
+
flex-shrink: 0;
|
|
151
|
+
}
|
|
152
|
+
|
|
97
153
|
.#{$eccgui}-card__actions {
|
|
98
|
-
padding: $eccgui-size-card-spacing * 0.25;
|
|
154
|
+
padding: $eccgui-size-card-spacing * 0.25 $eccgui-size-card-spacing;
|
|
99
155
|
flex-grow: 0;
|
|
100
156
|
flex-shrink: 0;
|
|
101
157
|
display: flex;
|
|
102
158
|
flex-flow: row wrap;
|
|
103
159
|
align-items: center;
|
|
104
160
|
|
|
161
|
+
.#{$eccgui}-card--whitespace-none > & {
|
|
162
|
+
padding: 0;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.#{$eccgui}-card--whitespace-small > & {
|
|
166
|
+
padding: $eccgui-size-card-spacing * 0.125 $eccgui-size-card-spacing * 0.5;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.#{$eccgui}-card--whitespace-large > & {
|
|
170
|
+
padding: $eccgui-size-card-spacing * 0.75 $eccgui-size-card-spacing * 2;
|
|
171
|
+
}
|
|
172
|
+
|
|
105
173
|
& > * {
|
|
106
|
-
margin: $eccgui-size-card-spacing * 0.25;
|
|
174
|
+
margin: $eccgui-size-card-spacing * 0.25 0;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
&:not(.#{$eccgui}-card__actions--inversedirection) > * {
|
|
178
|
+
&:not(:first-child) {
|
|
179
|
+
margin-left: $eccgui-size-card-spacing * 0.25;
|
|
180
|
+
}
|
|
181
|
+
&:not(:last-child) {
|
|
182
|
+
margin-right: $eccgui-size-card-spacing * 0.25;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
&.#{$eccgui}-card__actions--inversedirection > * {
|
|
187
|
+
&:not(:first-child) {
|
|
188
|
+
margin-right: $eccgui-size-card-spacing * 0.25;
|
|
189
|
+
}
|
|
190
|
+
&:not(:last-child) {
|
|
191
|
+
margin-left: $eccgui-size-card-spacing * 0.25;
|
|
192
|
+
}
|
|
107
193
|
}
|
|
108
194
|
|
|
109
195
|
&.#{$eccgui}-intent--success > .#{$eccgui}-button:first-child {
|
|
@@ -131,9 +217,28 @@ $eccgui-size-card-spacing: $eccgui-size-typo-base !default;
|
|
|
131
217
|
flex-flow: row wrap;
|
|
132
218
|
justify-content: flex-end;
|
|
133
219
|
align-items: center;
|
|
220
|
+
margin: 0;
|
|
134
221
|
|
|
135
222
|
& > * {
|
|
136
|
-
margin: $eccgui-size-card-spacing * 0.25;
|
|
223
|
+
margin: $eccgui-size-card-spacing * 0.25 0;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
&:not(.#{$eccgui}-card__actions--inversedirection) > * {
|
|
227
|
+
&:not(:first-child) {
|
|
228
|
+
margin-left: $eccgui-size-card-spacing * 0.25;
|
|
229
|
+
}
|
|
230
|
+
&:not(:last-child) {
|
|
231
|
+
margin-right: $eccgui-size-card-spacing * 0.25;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
&.#{$eccgui}-card__actions--inversedirection > * {
|
|
236
|
+
&:not(:first-child) {
|
|
237
|
+
margin-right: $eccgui-size-card-spacing * 0.25;
|
|
238
|
+
}
|
|
239
|
+
&:not(:last-child) {
|
|
240
|
+
margin-left: $eccgui-size-card-spacing * 0.25;
|
|
241
|
+
}
|
|
137
242
|
}
|
|
138
243
|
|
|
139
244
|
.#{$eccgui}-card__actions--inversedirection > & {
|
|
@@ -28,6 +28,8 @@ $switch-checked-background-color-disabled: rgba($switch-checked-background-color
|
|
|
28
28
|
@import "~@blueprintjs/core/src/components/forms/controls"; // Checkbox, Radio, Switch
|
|
29
29
|
|
|
30
30
|
.#{$ns}-control {
|
|
31
|
+
max-width: 100%;
|
|
32
|
+
|
|
31
33
|
&.#{$ns}-checkbox {
|
|
32
34
|
input ~ .#{$ns}-control-indicator,
|
|
33
35
|
input:checked ~ .#{$ns}-control-indicator,
|
|
@@ -64,6 +66,8 @@ $switch-checked-background-color-disabled: rgba($switch-checked-background-color
|
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
68
|
|
|
67
|
-
.#{$ns}-control-indicator +
|
|
68
|
-
|
|
69
|
+
.#{$ns}-control-indicator + *,
|
|
70
|
+
.#{$ns}-control-indicator + .#{$eccgui}-typography__overflowtext {
|
|
71
|
+
display: inline-block;
|
|
72
|
+
vertical-align: text-top;
|
|
69
73
|
}
|