@eccenca/gui-elements 23.3.1 → 23.4.0
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 +23 -1
- package/dist/cjs/cmem/ActivityControl/ActivityControlWidget.js +3 -2
- package/dist/cjs/cmem/ActivityControl/ActivityControlWidget.js.map +1 -1
- package/dist/cjs/cmem/ActivityControl/SilkActivityControl.js +11 -6
- package/dist/cjs/cmem/ActivityControl/SilkActivityControl.js.map +1 -1
- package/dist/cjs/cmem/DateTimeDisplay/ElapsedDateTimeDisplay.js +7 -4
- package/dist/cjs/cmem/DateTimeDisplay/ElapsedDateTimeDisplay.js.map +1 -1
- package/dist/cjs/components/AutoSuggestion/AutoSuggestion.js +61 -19
- package/dist/cjs/components/AutoSuggestion/AutoSuggestion.js.map +1 -1
- package/dist/cjs/components/AutoSuggestion/AutoSuggestionList.js +4 -18
- package/dist/cjs/components/AutoSuggestion/AutoSuggestionList.js.map +1 -1
- package/dist/cjs/components/AutoSuggestion/ExtendedCodeEditor.js +65 -0
- package/dist/cjs/components/AutoSuggestion/ExtendedCodeEditor.js.map +1 -0
- package/dist/cjs/components/AutoSuggestion/index.js +3 -3
- package/dist/cjs/components/AutoSuggestion/index.js.map +1 -1
- package/dist/cjs/components/Card/CardHeader.js +19 -18
- package/dist/cjs/components/Card/CardHeader.js.map +1 -1
- package/dist/cjs/components/Grid/GridColumn.js +3 -3
- package/dist/cjs/components/Grid/GridColumn.js.map +1 -1
- package/dist/cjs/components/Icon/TestIcon.js +4 -4
- package/dist/cjs/components/Icon/TestIcon.js.map +1 -1
- package/dist/cjs/components/Icon/canonicalIconNames.js +5 -0
- package/dist/cjs/components/Icon/canonicalIconNames.js.map +1 -1
- package/dist/cjs/components/PropertyValuePair/PropertyName.js +4 -2
- package/dist/cjs/components/PropertyValuePair/PropertyName.js.map +1 -1
- package/dist/cjs/components/PropertyValuePair/PropertyValue.js +6 -4
- package/dist/cjs/components/PropertyValuePair/PropertyValue.js.map +1 -1
- package/dist/cjs/components/PropertyValuePair/PropertyValuePair.js +13 -3
- package/dist/cjs/components/PropertyValuePair/PropertyValuePair.js.map +1 -1
- package/dist/cjs/components/Skeleton/Skeleton.js +30 -0
- package/dist/cjs/components/Skeleton/Skeleton.js.map +1 -0
- package/dist/cjs/components/Skeleton/classnames.js +6 -0
- package/dist/cjs/components/Skeleton/classnames.js.map +1 -0
- package/dist/cjs/components/Table/TableCell.js +3 -2
- package/dist/cjs/components/Table/TableCell.js.map +1 -1
- package/dist/cjs/components/TextField/useTextValidation.js.map +1 -1
- package/dist/cjs/components/index.js +1 -0
- package/dist/cjs/components/index.js.map +1 -1
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/cmem/ActivityControl/ActivityControlWidget.js +3 -2
- package/dist/esm/cmem/ActivityControl/ActivityControlWidget.js.map +1 -1
- package/dist/esm/cmem/ActivityControl/SilkActivityControl.js +14 -9
- package/dist/esm/cmem/ActivityControl/SilkActivityControl.js.map +1 -1
- package/dist/esm/cmem/DateTimeDisplay/ElapsedDateTimeDisplay.js +8 -4
- package/dist/esm/cmem/DateTimeDisplay/ElapsedDateTimeDisplay.js.map +1 -1
- package/dist/esm/components/AutoSuggestion/AutoSuggestion.js +82 -40
- package/dist/esm/components/AutoSuggestion/AutoSuggestion.js.map +1 -1
- package/dist/esm/components/AutoSuggestion/AutoSuggestionList.js +6 -20
- package/dist/esm/components/AutoSuggestion/AutoSuggestionList.js.map +1 -1
- package/dist/esm/components/AutoSuggestion/ExtendedCodeEditor.js +70 -0
- package/dist/esm/components/AutoSuggestion/ExtendedCodeEditor.js.map +1 -0
- package/dist/esm/components/AutoSuggestion/index.js +2 -2
- package/dist/esm/components/AutoSuggestion/index.js.map +1 -1
- package/dist/esm/components/Card/CardHeader.js +15 -14
- package/dist/esm/components/Card/CardHeader.js.map +1 -1
- package/dist/esm/components/Grid/GridColumn.js +3 -3
- package/dist/esm/components/Grid/GridColumn.js.map +1 -1
- package/dist/esm/components/Icon/TestIcon.js +4 -4
- package/dist/esm/components/Icon/TestIcon.js.map +1 -1
- package/dist/esm/components/Icon/canonicalIconNames.js +5 -0
- package/dist/esm/components/Icon/canonicalIconNames.js.map +1 -1
- package/dist/esm/components/PropertyValuePair/PropertyName.js +4 -2
- package/dist/esm/components/PropertyValuePair/PropertyName.js.map +1 -1
- package/dist/esm/components/PropertyValuePair/PropertyValue.js +6 -4
- package/dist/esm/components/PropertyValuePair/PropertyValue.js.map +1 -1
- package/dist/esm/components/PropertyValuePair/PropertyValuePair.js +13 -3
- package/dist/esm/components/PropertyValuePair/PropertyValuePair.js.map +1 -1
- package/dist/esm/components/Skeleton/Skeleton.js +24 -0
- package/dist/esm/components/Skeleton/Skeleton.js.map +1 -0
- package/dist/esm/components/Skeleton/classnames.js +3 -0
- package/dist/esm/components/Skeleton/classnames.js.map +1 -0
- package/dist/esm/components/Table/TableCell.js +4 -3
- package/dist/esm/components/Table/TableCell.js.map +1 -1
- package/dist/esm/components/TextField/useTextValidation.js.map +1 -1
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/types/cmem/ActivityControl/ActivityControlTypes.d.ts +1 -0
- package/dist/types/cmem/ActivityControl/ActivityControlWidget.d.ts +4 -0
- package/dist/types/cmem/ActivityControl/SilkActivityControl.d.ts +8 -4
- package/dist/types/cmem/DateTimeDisplay/ElapsedDateTimeDisplay.d.ts +5 -4
- package/dist/types/components/AutoSuggestion/AutoSuggestion.d.ts +8 -2
- package/dist/types/components/AutoSuggestion/AutoSuggestionList.d.ts +6 -4
- package/dist/types/components/AutoSuggestion/{SingleLineCodeEditor.d.ts → ExtendedCodeEditor.d.ts} +7 -4
- package/dist/types/components/AutoSuggestion/index.d.ts +3 -3
- package/dist/types/components/Card/CardHeader.d.ts +2 -2
- package/dist/types/components/Grid/GridColumn.d.ts +1 -0
- package/dist/types/components/Icon/TestIcon.d.ts +2 -1
- package/dist/types/components/Icon/canonicalIconNames.d.ts +1 -1
- package/dist/types/components/PropertyValuePair/PropertyName.d.ts +7 -1
- package/dist/types/components/PropertyValuePair/PropertyValue.d.ts +7 -1
- package/dist/types/components/PropertyValuePair/PropertyValuePair.d.ts +5 -1
- package/dist/types/components/Skeleton/Skeleton.d.ts +13 -0
- package/dist/types/components/Skeleton/classnames.d.ts +1 -0
- package/dist/types/components/Table/TableCell.d.ts +7 -2
- package/dist/types/components/TextField/useTextValidation.d.ts +1 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/index.d.ts +3 -0
- package/package.json +6 -3
- package/src/cmem/ActivityControl/ActivityControlTypes.ts +2 -0
- package/src/cmem/ActivityControl/ActivityControlWidget.tsx +6 -0
- package/src/cmem/ActivityControl/SilkActivityControl.tsx +78 -46
- package/src/cmem/DateTimeDisplay/ElapsedDateTimeDisplay.tsx +12 -4
- package/src/components/AutoSuggestion/AutoSuggestion.tsx +84 -31
- package/src/components/AutoSuggestion/AutoSuggestionList.tsx +11 -42
- package/src/components/AutoSuggestion/ExtendedCodeEditor.tsx +129 -0
- package/src/components/AutoSuggestion/index.ts +3 -11
- package/src/components/AutoSuggestion/tests/AutoSuggestionList.test.tsx +83 -84
- package/src/components/AutoSuggestion/tests/{SingleLineCodeEditor.test.tsx → ExtendedCodeEditor.test.tsx} +7 -7
- package/src/components/Card/CardHeader.tsx +23 -25
- package/src/components/Grid/GridColumn.tsx +15 -13
- package/src/components/Icon/TestIcon.tsx +9 -13
- package/src/components/Icon/canonicalIconNames.tsx +10 -0
- package/src/components/Icon/stories/Icon.stories.tsx +17 -30
- package/src/components/Icon/stories/TestIcon.stories.tsx +8 -9
- package/src/components/OverviewItem/overviewitem.scss +27 -33
- package/src/components/Pagination/pagination.scss +6 -1
- package/src/components/PropertyValuePair/PropertyName.tsx +21 -2
- package/src/components/PropertyValuePair/PropertyValue.tsx +21 -5
- package/src/components/PropertyValuePair/PropertyValuePair.tsx +23 -4
- package/src/components/PropertyValuePair/propertyvalue.scss +6 -1
- package/src/components/PropertyValuePair/stories/PropertyName.stories.tsx +18 -0
- package/src/components/PropertyValuePair/stories/PropertyValue.stories.tsx +18 -0
- package/src/components/PropertyValuePair/stories/PropertyValueList.stories.tsx +33 -0
- package/src/components/PropertyValuePair/stories/PropertyValuePair.stories.tsx +29 -0
- package/src/components/Skeleton/Skeleton.stories.tsx +29 -0
- package/src/components/Skeleton/Skeleton.tsx +32 -0
- package/src/components/Skeleton/classnames.ts +3 -0
- package/src/components/Skeleton/skeleton.scss +1 -0
- package/src/components/Table/TableCell.tsx +12 -8
- package/src/components/Table/stories/TableCell.stories.tsx +30 -0
- package/src/components/Table/table.scss +96 -50
- package/src/components/TextField/stories/TextField.stories.tsx +21 -18
- package/src/components/TextField/useTextValidation.ts +82 -68
- package/src/components/index.scss +1 -0
- package/src/components/index.ts +1 -0
- package/src/extensions/codemirror/_codemirror.scss +1 -0
- package/src/index.ts +2 -0
- package/dist/cjs/components/AutoSuggestion/SingleLineCodeEditor.js +0 -53
- package/dist/cjs/components/AutoSuggestion/SingleLineCodeEditor.js.map +0 -1
- package/dist/esm/components/AutoSuggestion/SingleLineCodeEditor.js +0 -47
- package/dist/esm/components/AutoSuggestion/SingleLineCodeEditor.js.map +0 -1
- package/src/components/AutoSuggestion/SingleLineCodeEditor.tsx +0 -110
|
@@ -5,12 +5,14 @@ export interface AutoSuggestionListProps extends Omit<React.HTMLAttributes<HTMLD
|
|
|
5
5
|
onItemSelectionChange: (item: ISuggestionWithReplacementInfo) => any;
|
|
6
6
|
isOpen: boolean;
|
|
7
7
|
loading?: boolean;
|
|
8
|
-
registerForHorizontalShift?: (callback: HorizontalShiftCallbackFunction) => any;
|
|
9
8
|
currentlyFocusedIndex: number;
|
|
10
9
|
itemToHighlight: (item: ISuggestionWithReplacementInfo | undefined) => any;
|
|
10
|
+
/** horizontal and vertical offset values in relation to the cursor */
|
|
11
|
+
offsetValues?: {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
};
|
|
11
15
|
}
|
|
12
16
|
export declare type IDropdownProps = AutoSuggestionListProps;
|
|
13
|
-
declare type HorizontalShiftCallbackFunction = (shift: number) => any;
|
|
14
17
|
/** A drop-down-like list that can be used in combination with other components to show and select items. */
|
|
15
|
-
export declare const AutoSuggestionList: ({ isOpen, options, loading, onItemSelectionChange,
|
|
16
|
-
export {};
|
|
18
|
+
export declare const AutoSuggestionList: ({ isOpen, options, loading, onItemSelectionChange, currentlyFocusedIndex, itemToHighlight, style, offsetValues, ...otherDivProps }: AutoSuggestionListProps) => React.JSX.Element | null;
|
package/dist/types/components/AutoSuggestion/{SingleLineCodeEditor.d.ts → ExtendedCodeEditor.d.ts}
RENAMED
|
@@ -6,7 +6,7 @@ export interface IRange {
|
|
|
6
6
|
from: number;
|
|
7
7
|
to: number;
|
|
8
8
|
}
|
|
9
|
-
export interface
|
|
9
|
+
export interface ExtendedCodeEditorProps {
|
|
10
10
|
setEditorInstance: (editor: CodeMirrorEditor) => any;
|
|
11
11
|
onChange: (value: string) => any;
|
|
12
12
|
onCursorChange: (pos: any, coords: any, scrollinfo: any) => any;
|
|
@@ -14,13 +14,16 @@ export interface SingleLineCodeEditorProps {
|
|
|
14
14
|
initialValue: string;
|
|
15
15
|
onFocusChange: (focused: boolean) => any;
|
|
16
16
|
onKeyDown: (event: KeyboardEvent) => any;
|
|
17
|
+
onMouseDown?: (editor: CodeMirrorEditor) => any;
|
|
17
18
|
onSelection: (ranges: IRange[]) => any;
|
|
18
19
|
enableTab?: boolean;
|
|
19
20
|
/** Placeholder tobe shown when no text has been entered, yet. */
|
|
20
21
|
placeholder?: string;
|
|
21
22
|
showScrollBar?: boolean;
|
|
23
|
+
/** allow multiline entries when new line characters are entered */
|
|
24
|
+
multiline?: boolean;
|
|
22
25
|
}
|
|
23
|
-
export declare type IEditorProps =
|
|
26
|
+
export declare type IEditorProps = ExtendedCodeEditorProps;
|
|
24
27
|
/** A single-line code editor. */
|
|
25
|
-
export declare const
|
|
26
|
-
export default
|
|
28
|
+
export declare const ExtendedCodeEditor: ({ setEditorInstance, onChange, onCursorChange, mode, initialValue, onFocusChange, onKeyDown, onSelection, enableTab, placeholder, showScrollBar, multiline, onMouseDown, }: ExtendedCodeEditorProps) => React.JSX.Element;
|
|
29
|
+
export default ExtendedCodeEditor;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AutoSuggestion, AutoSuggestionProps } from "./AutoSuggestion";
|
|
2
2
|
import { AutoSuggestionList, AutoSuggestionListProps } from "./AutoSuggestionList";
|
|
3
|
-
import {
|
|
4
|
-
export { AutoSuggestion, AutoSuggestionList,
|
|
5
|
-
export type { AutoSuggestionProps, AutoSuggestionListProps,
|
|
3
|
+
import { ExtendedCodeEditor, ExtendedCodeEditorProps } from "./ExtendedCodeEditor";
|
|
4
|
+
export { AutoSuggestion, AutoSuggestionList, ExtendedCodeEditor };
|
|
5
|
+
export type { AutoSuggestionProps, AutoSuggestionListProps, ExtendedCodeEditorProps };
|
|
@@ -3,11 +3,11 @@ import { OverviewItemProps } from "./../OverviewItem/OverviewItem";
|
|
|
3
3
|
export interface CardHeaderProps extends Omit<OverviewItemProps, "densityHigh" | "hasSpacing"> {
|
|
4
4
|
children: JSX.Element | (JSX.Element | undefined | null)[] | null | undefined;
|
|
5
5
|
/**
|
|
6
|
-
* @deprecated
|
|
6
|
+
* @deprecated use `whitespaceAmount` option of `<Card />`
|
|
7
7
|
*/
|
|
8
8
|
densityHigh?: OverviewItemProps["densityHigh"];
|
|
9
9
|
/**
|
|
10
|
-
* @deprecated
|
|
10
|
+
* @deprecated use `whitespaceAmount` option of `<Card />`
|
|
11
11
|
*/
|
|
12
12
|
hasSpacing?: OverviewItemProps["hasSpacing"];
|
|
13
13
|
}
|
|
@@ -21,6 +21,7 @@ export interface GridColumnProps extends Omit<ColumnDefaultProps, "max" | "xlg"
|
|
|
21
21
|
carbonSizeConfig?: Pick<ColumnDefaultProps, "max" | "xlg" | "lg" | "md" | "sm">;
|
|
22
22
|
/**
|
|
23
23
|
* @deprecated
|
|
24
|
+
* Grid column always uses full width if it is the only column and does not have any othe size config.
|
|
24
25
|
*/
|
|
25
26
|
full?: boolean;
|
|
26
27
|
}
|
|
@@ -13,7 +13,8 @@ export interface TestIconProps extends Omit<BaseIconProps, "iconComponent"> {
|
|
|
13
13
|
* Example usage:
|
|
14
14
|
* ```
|
|
15
15
|
* import { LogoReact } from "@carbon/icons-react";
|
|
16
|
-
*
|
|
16
|
+
* import { TestIcon } from "@eccenca/gui-elements";
|
|
17
|
+
* const testIcon = <TestIcon tryout={LogoReact} />;
|
|
17
18
|
* ```
|
|
18
19
|
*/
|
|
19
20
|
export declare const TestIcon: ({ className, tryout, ...otherBaseIconProps }: TestIconProps) => React.JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { IconProps as CarbonIconProps } from "carbon-components-react";
|
|
3
3
|
/** Valid icon names. */
|
|
4
|
-
export declare type ValidIconName = "application-activities" | "application-dataintegration" | "application-explore" | "application-homepage" | "application-legacygui" | "application-mapping" | "application-queries" | "application-useraccount" | "application-vocabularies" | "application-warning" | "application-hotkeys" | "artefact-chatlog" | "artefact-commit" | "artefact-customtask" | "artefact-dataset" | "artefact-dataset-csv" | "artefact-dataset-eccencadataplatform" | "artefact-dataset-excel" | "artefact-dataset-file" | "artefact-dataset-jdbc" | "artefact-dataset-json" | "artefact-dataset-multicsv" | "artefact-dataset-neo4j" | "artefact-dataset-sparkview" | "artefact-dataset-sparqlendpoint" | "artefact-dataset-sqlendpoint" | "artefact-dataset-xml" | "artefact-deprecated" | "artefact-embedded" | "artefact-errorlog" | "artefact-file" | "artefact-linking" | "artefact-project" | "artefact-rawdata" | "artefact-remote" | "artefact-report" | "artefact-task" | "artefact-transform" | "artefact-uncategorized" | "artefact-workflow" | "data-sourcepath" | "data-targetpath" | "entity-human" | "entity-robot" | "item-add-artefact" | "item-clone" | "item-comment" | "item-copy" | "item-download" | "item-draggable" | "item-edit" | "item-evaluation" | "item-execution" | "item-info" | "item-launch" | "item-moremenu" | "item-question" | "item-reload" | "item-remove" | "item-reset" | "item-save" | "item-settings" | "item-shuffle" | "item-skip-forward" | "item-start" | "item-stop" | "item-upload" | "item-vertmenu" | "item-viewdetails" | "item-hidedetails" | "list-sort" | "list-sortasc" | "list-sortdesc" | "module-accesscontrol" | "module-annotation" | "module-dashboard" | "module-gdprsearch" | "module-integrations" | "module-linkedrules" | "module-reports" | "module-search" | "module-thesauri" | "module-timetracker" | "module-visualization" | "navigation-back" | "navigation-close" | "navigation-down" | "navigation-first" | "navigation-forth" | "navigation-jump" | "navigation-last" | "navigation-left" | "navigation-next" | "navigation-previous" | "navigation-right" | "navigation-up" | "operation-aggregation" | "operation-autolayout" | "operation-clear" | "operation-commit" | "operation-comparison" | "operation-erase" | "operation-filter" | "operation-filteredit" | "operation-filterremove" | "operation-fix" | "operation-link" | "operation-logout" | "operation-magic" | "operation-merge" | "operation-redo" | "operation-search" | "operation-sharelink" | "operation-transform" | "operation-translate" | "operation-undo" | "operation-unlink" | "state-checked" | "state-checkedsimple" | "state-confirmed" | "state-danger" | "state-declined" | "state-info" | "state-partlychecked" | "state-protected" | "state-success" | "state-unchecked" | "state-warning" | "toggler-caret" | "toggler-caretright" | "toggler-caretdown" | "toggler-maximize" | "toggler-minimize" | "toggler-moveleft" | "toggler-moveright" | "toggler-rowexpand" | "toggler-rowcollapse" | "toggler-showless" | "toggler-showmore" | "toggler-star-empty" | "toggler-star-filled" | "toggler-tree" | "form-template" | "undefined";
|
|
4
|
+
export declare type ValidIconName = "application-activities" | "application-dataintegration" | "application-explore" | "application-homepage" | "application-legacygui" | "application-mapping" | "application-queries" | "application-useraccount" | "application-vocabularies" | "application-warning" | "application-hotkeys" | "artefact-chatlog" | "artefact-commit" | "artefact-customtask" | "artefact-dataset" | "artefact-dataset-csv" | "artefact-dataset-eccencadataplatform" | "artefact-dataset-excel" | "artefact-dataset-file" | "artefact-dataset-jdbc" | "artefact-dataset-json" | "artefact-dataset-multicsv" | "artefact-dataset-neo4j" | "artefact-dataset-sparkview" | "artefact-dataset-sparqlendpoint" | "artefact-dataset-sqlendpoint" | "artefact-dataset-xml" | "artefact-deprecated" | "artefact-embedded" | "artefact-errorlog" | "artefact-file" | "artefact-linking" | "artefact-project" | "artefact-rawdata" | "artefact-remote" | "artefact-report" | "artefact-task" | "artefact-transform" | "artefact-uncategorized" | "artefact-workflow" | "data-sourcepath" | "data-targetpath" | "data-string" | "data-date" | "data-time" | "data-datetime" | "data-number" | "entity-human" | "entity-robot" | "item-add-artefact" | "item-clone" | "item-comment" | "item-copy" | "item-download" | "item-draggable" | "item-edit" | "item-evaluation" | "item-execution" | "item-info" | "item-launch" | "item-moremenu" | "item-question" | "item-reload" | "item-remove" | "item-reset" | "item-save" | "item-settings" | "item-shuffle" | "item-skip-forward" | "item-start" | "item-stop" | "item-upload" | "item-vertmenu" | "item-viewdetails" | "item-hidedetails" | "list-sort" | "list-sortasc" | "list-sortdesc" | "module-accesscontrol" | "module-annotation" | "module-dashboard" | "module-gdprsearch" | "module-integrations" | "module-linkedrules" | "module-reports" | "module-search" | "module-thesauri" | "module-timetracker" | "module-visualization" | "navigation-back" | "navigation-close" | "navigation-down" | "navigation-first" | "navigation-forth" | "navigation-jump" | "navigation-last" | "navigation-left" | "navigation-next" | "navigation-previous" | "navigation-right" | "navigation-up" | "operation-aggregation" | "operation-autolayout" | "operation-clear" | "operation-commit" | "operation-comparison" | "operation-erase" | "operation-filter" | "operation-filteredit" | "operation-filterremove" | "operation-fix" | "operation-link" | "operation-logout" | "operation-magic" | "operation-merge" | "operation-redo" | "operation-search" | "operation-sharelink" | "operation-transform" | "operation-translate" | "operation-undo" | "operation-unlink" | "state-checked" | "state-checkedsimple" | "state-confirmed" | "state-danger" | "state-declined" | "state-info" | "state-partlychecked" | "state-protected" | "state-success" | "state-unchecked" | "state-warning" | "toggler-caret" | "toggler-caretright" | "toggler-caretdown" | "toggler-maximize" | "toggler-minimize" | "toggler-moveleft" | "toggler-moveright" | "toggler-rowexpand" | "toggler-rowcollapse" | "toggler-showless" | "toggler-showmore" | "toggler-star-empty" | "toggler-star-filled" | "toggler-tree" | "form-template" | "undefined";
|
|
5
5
|
export declare type CarbonIconType = React.ComponentType<CarbonIconProps>;
|
|
6
6
|
/**
|
|
7
7
|
* @deprecated
|
|
@@ -5,11 +5,17 @@ export interface PropertyNameProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
5
5
|
* Increase or decrease the width used for the property name.
|
|
6
6
|
*/
|
|
7
7
|
size?: "small" | "medium" | "large";
|
|
8
|
+
/**
|
|
9
|
+
* Force label to get displayed without line breaks.
|
|
10
|
+
* This works best if you use a simple string as content.
|
|
11
|
+
* Otherwise you may need to take care yourself about it.
|
|
12
|
+
*/
|
|
13
|
+
nowrap?: boolean;
|
|
8
14
|
/**
|
|
9
15
|
* Additional label properties, e.g. `tooltip`.
|
|
10
16
|
* It is only used if the `PropertyName` has simple text input.
|
|
11
17
|
*/
|
|
12
18
|
labelProps?: LabelProps;
|
|
13
19
|
}
|
|
14
|
-
export declare const PropertyName: ({ className, size,
|
|
20
|
+
export declare const PropertyName: ({ children, className, size, nowrap, labelProps, ...otherDtProps }: PropertyNameProps) => React.JSX.Element;
|
|
15
21
|
export default PropertyName;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
export interface PropertyValueProps extends React.HTMLAttributes<HTMLElement> {
|
|
3
|
+
/**
|
|
4
|
+
* Force value to get displayed without line breaks.
|
|
5
|
+
* This works best if you use a string or inline element as content.
|
|
6
|
+
* Otherwise you may need to take care yourself about it.
|
|
7
|
+
*/
|
|
8
|
+
nowrap?: boolean;
|
|
3
9
|
}
|
|
4
|
-
export declare const PropertyValue: ({ className,
|
|
10
|
+
export declare const PropertyValue: ({ children, className, nowrap, ...otherDdProps }: PropertyValueProps) => React.JSX.Element;
|
|
5
11
|
export default PropertyValue;
|
|
@@ -8,6 +8,10 @@ export interface PropertyValuePairProps extends React.HTMLAttributes<HTMLDivElem
|
|
|
8
8
|
* Add a horizontal rule to the bottom of the element.
|
|
9
9
|
*/
|
|
10
10
|
hasDivider?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Forward the `nowrap` option to it `PropertyName` and `PropertyValue` children.
|
|
13
|
+
*/
|
|
14
|
+
nowrap?: boolean;
|
|
11
15
|
}
|
|
12
|
-
export declare const PropertyValuePair: ({ className,
|
|
16
|
+
export declare const PropertyValuePair: ({ children, className, nowrap, hasSpacing, hasDivider, ...otherProps }: PropertyValuePairProps) => React.JSX.Element;
|
|
13
17
|
export default PropertyValuePair;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface SkeletonProps {
|
|
3
|
+
/**
|
|
4
|
+
* Element that need to displayed using the skeleton styles.
|
|
5
|
+
*/
|
|
6
|
+
children: JSX.Element | JSX.Element[];
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* `<Skeleton />` provides a loading state display of its children elements.
|
|
10
|
+
* It does not provide its own content.
|
|
11
|
+
*/
|
|
12
|
+
export declare function Skeleton({ children }: SkeletonProps): React.JSX.Element;
|
|
13
|
+
export default Skeleton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SKELETON: string;
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { TableCellProps as CarbonTableCellProps } from "carbon-components-react";
|
|
3
3
|
export interface TableCellProps extends CarbonTableCellProps, React.TdHTMLAttributes<HTMLTableCellElement> {
|
|
4
|
+
/**
|
|
5
|
+
* By default all table cell content is aligned to the left of the cell.
|
|
6
|
+
* Use this property to change the horizontal alignment.
|
|
7
|
+
*/
|
|
8
|
+
alignHorizontal?: "left" | "center";
|
|
4
9
|
/**
|
|
5
10
|
* By default all table cell content is aligned to the top of the cell.
|
|
6
11
|
* Use this property to change the vertical alignment.
|
|
7
12
|
*/
|
|
8
|
-
alignVertical?: "middle";
|
|
13
|
+
alignVertical?: "top" | "middle";
|
|
9
14
|
}
|
|
10
|
-
export declare function TableCell({ className, children, alignVertical, ...otherTableCellProps }: TableCellProps): React.JSX.Element;
|
|
15
|
+
export declare function TableCell({ className, children, alignHorizontal, alignVertical, ...otherTableCellProps }: TableCellProps): React.JSX.Element;
|
|
11
16
|
export default TableCell;
|
|
@@ -2,6 +2,7 @@ import React, { ChangeEventHandler } from "react";
|
|
|
2
2
|
export interface InvisibleCharacterWarningProps {
|
|
3
3
|
/**
|
|
4
4
|
* If set, the function is called after every value change what invisible characters have been detected.
|
|
5
|
+
* The input component must be controlled for this callback to be triggered.
|
|
5
6
|
*/
|
|
6
7
|
callback: (detectedCodePoints: Set<number>) => any;
|
|
7
8
|
/**
|
|
@@ -34,6 +34,7 @@ export * from "./RadioButton/RadioButton";
|
|
|
34
34
|
export * from "./Select/Select";
|
|
35
35
|
export * from "./Separation/Divider";
|
|
36
36
|
export * from "./Separation/Spacing";
|
|
37
|
+
export * from "./Skeleton/Skeleton";
|
|
37
38
|
export * from "./Spinner/Spinner";
|
|
38
39
|
export * from "./Structure";
|
|
39
40
|
export * from "./Switch/Switch";
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
import * as Skeleton from "./components/Skeleton/classnames";
|
|
1
2
|
import * as TypographyClassNames from "./components/Typography/classnames";
|
|
2
3
|
import * as LegacyReplacements from "./legacy-replacements";
|
|
3
4
|
declare const ClassNames: {
|
|
5
|
+
Skeleton: typeof Skeleton;
|
|
4
6
|
Typography: typeof TypographyClassNames;
|
|
5
7
|
Intent: {
|
|
6
8
|
[key: string]: string;
|
|
7
9
|
};
|
|
8
10
|
};
|
|
9
11
|
declare const HelperClasses: {
|
|
12
|
+
Skeleton: typeof Skeleton;
|
|
10
13
|
Typography: typeof TypographyClassNames;
|
|
11
14
|
Intent: {
|
|
12
15
|
[key: string]: string;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eccenca/gui-elements",
|
|
3
3
|
"description": "GUI elements based on other libraries, usable in React application, written in Typescript.",
|
|
4
|
-
"version": "23.
|
|
4
|
+
"version": "23.4.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/eccenca/gui-elements",
|
|
7
7
|
"bugs": "https://github.com/eccenca/gui-elements/issues",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"@blueprintjs/popover2": "^1.14.1",
|
|
67
67
|
"@blueprintjs/select": "^4.9.14",
|
|
68
68
|
"@carbon/icons": "^11.19.0",
|
|
69
|
-
"@carbon/icons-react": "^11.
|
|
69
|
+
"@carbon/icons-react": "^11.34.1",
|
|
70
70
|
"@carbon/styles": "1.32.0",
|
|
71
71
|
"@mavrin/remark-typograf": "^2.2.0",
|
|
72
72
|
"carbon-components-react": "^8.28.0",
|
|
@@ -120,6 +120,7 @@
|
|
|
120
120
|
"chromatic": "^6.17.4",
|
|
121
121
|
"eslint": "^8.49.0",
|
|
122
122
|
"eslint-plugin-react": "^7.33.2",
|
|
123
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
123
124
|
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
124
125
|
"husky": "4",
|
|
125
126
|
"identity-obj-proxy": "^3.0.0",
|
|
@@ -146,6 +147,7 @@
|
|
|
146
147
|
"yargs": "^17.7.2"
|
|
147
148
|
},
|
|
148
149
|
"peerDependencies": {
|
|
150
|
+
"@carbon/icons-react": ">=11.34.1",
|
|
149
151
|
"@carbon/styles": "<1.33.0",
|
|
150
152
|
"@types/carbon-components-react": ">=7",
|
|
151
153
|
"react": ">=16",
|
|
@@ -155,7 +157,8 @@
|
|
|
155
157
|
"**/@babel/traverse": "^7.23.2",
|
|
156
158
|
"**/@types/react": "^17.0.59",
|
|
157
159
|
"**/postcss": "^8.4.31",
|
|
158
|
-
"**/parse5": "^6.0.1"
|
|
160
|
+
"**/parse5": "^6.0.1",
|
|
161
|
+
"**/@carbon/icons-react": "^11.34.1"
|
|
159
162
|
},
|
|
160
163
|
"husky": {
|
|
161
164
|
"hooks": {
|
|
@@ -28,6 +28,8 @@ export interface IActivityStatus {
|
|
|
28
28
|
runtime?: number;
|
|
29
29
|
// The start time as date time, e.g. "2021-09-07T09:34:53.153Z"
|
|
30
30
|
startTime?: string;
|
|
31
|
+
// The queue time spent waiting before workflow is executed as date time, e.g. "2021-09-07T09:34:53.153Z"
|
|
32
|
+
queueTime?: string;
|
|
31
33
|
}
|
|
32
34
|
export type SilkActivityStatusProps = IActivityStatus;
|
|
33
35
|
|
|
@@ -76,6 +76,10 @@ export interface ActivityControlWidgetProps extends TestableComponent {
|
|
|
76
76
|
* if this is set the spinner is replaced when the progress has finished from 0 - 1
|
|
77
77
|
*/
|
|
78
78
|
progressSpinnerFinishedIcon?: React.ReactElement<IconProps> | React.ReactElement<TestIconProps>;
|
|
79
|
+
/**
|
|
80
|
+
* execution timer messages for waiting and running times.
|
|
81
|
+
*/
|
|
82
|
+
timerExecutionMsg?: JSX.Element | null
|
|
79
83
|
}
|
|
80
84
|
|
|
81
85
|
// @deprecated use `ActivityControlWidgetProps`
|
|
@@ -122,6 +126,7 @@ export function ActivityControlWidget(props: ActivityControlWidgetProps) {
|
|
|
122
126
|
canShrink,
|
|
123
127
|
tags,
|
|
124
128
|
progressSpinnerFinishedIcon,
|
|
129
|
+
timerExecutionMsg = "",
|
|
125
130
|
labelWrapper = <OverflowText inline={true} />,
|
|
126
131
|
} = props;
|
|
127
132
|
const spinnerClassNames = (progressSpinner?.className ?? "") + ` ${eccgui}-spinner--permanent`;
|
|
@@ -170,6 +175,7 @@ export function ActivityControlWidget(props: ActivityControlWidgetProps) {
|
|
|
170
175
|
)}
|
|
171
176
|
</OverviewItemLine>
|
|
172
177
|
)}
|
|
178
|
+
{timerExecutionMsg && <OverviewItemLine small>{timerExecutionMsg}</OverviewItemLine>}
|
|
173
179
|
</OverviewItemDescription>
|
|
174
180
|
<OverviewItemActions>
|
|
175
181
|
{activityActions &&
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
import {
|
|
1
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { Intent } from "@blueprintjs/core/src/common/intent";
|
|
3
|
+
|
|
4
|
+
import { Icon, Spacing } from "../../";
|
|
5
|
+
import { IntentTypes } from "../../common/Intent";
|
|
6
|
+
import { TestableComponent } from "../../components/interfaces";
|
|
7
|
+
import { ElapsedDateTimeDisplay, TimeUnits } from "../DateTimeDisplay/ElapsedDateTimeDisplay";
|
|
8
|
+
|
|
9
|
+
import { SilkActivityStatusConcrete, SilkActivityStatusProps } from "./ActivityControlTypes";
|
|
10
|
+
import { ActivityControlWidget, ActivityControlWidgetProps } from "./ActivityControlWidget";
|
|
11
|
+
import { ActivityExecutionErrorReportModal } from "./ActivityExecutionErrorReportModal";
|
|
10
12
|
|
|
11
13
|
const progressBreakpointIndetermination = 10;
|
|
12
14
|
const progressBreakpointAnimation = 99;
|
|
@@ -59,7 +61,11 @@ export interface SilkActivityControlProps extends TestableComponent {
|
|
|
59
61
|
// configure how the widget is displayed
|
|
60
62
|
layoutConfig?: SilkActivityControlLayoutProps;
|
|
61
63
|
/** Configures when the status message should be hidden, e.g. because it is uninteresting. */
|
|
62
|
-
hideMessageOnStatus?: (concreteStatus: SilkActivityStatusConcrete | undefined) => boolean
|
|
64
|
+
hideMessageOnStatus?: (concreteStatus: SilkActivityStatusConcrete | undefined) => boolean;
|
|
65
|
+
/**
|
|
66
|
+
* The translation of the time units
|
|
67
|
+
*/
|
|
68
|
+
translateUnits?: (unit: TimeUnits) => string;
|
|
63
69
|
}
|
|
64
70
|
|
|
65
71
|
export interface SilkActivityControlLayoutProps {
|
|
@@ -130,7 +136,7 @@ export type IActivityExecutionReport = SilkActivityExecutionReportProps;
|
|
|
130
136
|
|
|
131
137
|
interface IStacktrace {
|
|
132
138
|
// The final error message of the stacktrace
|
|
133
|
-
errorMessage?:
|
|
139
|
+
errorMessage?: string;
|
|
134
140
|
// The individual elements of the stack trace
|
|
135
141
|
lines: string[];
|
|
136
142
|
// In case of nested stacktraces this may contain the cause of the failure
|
|
@@ -138,7 +144,12 @@ interface IStacktrace {
|
|
|
138
144
|
}
|
|
139
145
|
|
|
140
146
|
// @deprecated use `SilkActivityControlTranslationKeys`
|
|
141
|
-
export type ActivityControlTranslationKeys =
|
|
147
|
+
export type ActivityControlTranslationKeys =
|
|
148
|
+
| "startActivity"
|
|
149
|
+
| "stopActivity"
|
|
150
|
+
| "reloadActivity"
|
|
151
|
+
| "showErrorReport"
|
|
152
|
+
| "startPrioritized";
|
|
142
153
|
export type SilkActivityControlTranslationKeys = ActivityControlTranslationKeys;
|
|
143
154
|
// @deprecated use `SilkActivityControlAction`
|
|
144
155
|
export type ActivityAction = "start" | "cancel" | "restart";
|
|
@@ -167,38 +178,40 @@ export function useSilkActivityControl({
|
|
|
167
178
|
layoutConfig = defaultLayout,
|
|
168
179
|
hideMessageOnStatus = () => false,
|
|
169
180
|
executePrioritized,
|
|
181
|
+
translateUnits = (unit: TimeUnits) => unit.toString(),
|
|
170
182
|
...props
|
|
171
183
|
}: SilkActivityControlProps) {
|
|
172
184
|
const [activityStatus, setActivityStatus] = useState<SilkActivityStatusProps | undefined>(initialStatus);
|
|
173
|
-
const currentStatus = useRef<SilkActivityStatusProps | undefined>(initialStatus)
|
|
174
|
-
const [showStartPrioritized, setShowStartPrioritized] = useState(false)
|
|
185
|
+
const currentStatus = useRef<SilkActivityStatusProps | undefined>(initialStatus);
|
|
186
|
+
const [showStartPrioritized, setShowStartPrioritized] = useState(false);
|
|
175
187
|
const [errorReport, setErrorReport] = useState<string | SilkActivityExecutionReportProps | undefined>(undefined);
|
|
176
188
|
|
|
177
189
|
// Register update function
|
|
178
|
-
useEffect(
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
190
|
+
useEffect(
|
|
191
|
+
() => {
|
|
192
|
+
const updateActivityStatus = (status: SilkActivityStatusProps | undefined) => {
|
|
193
|
+
if (status?.concreteStatus !== "Waiting") {
|
|
194
|
+
setShowStartPrioritized(false);
|
|
195
|
+
} else if (executePrioritized) {
|
|
196
|
+
// Show start prioritized button only-if the activity is still in Waiting status after 2s
|
|
197
|
+
setTimeout(() => {
|
|
198
|
+
if (currentStatus.current?.concreteStatus === "Waiting") {
|
|
199
|
+
setShowStartPrioritized(true);
|
|
200
|
+
}
|
|
201
|
+
}, 2000);
|
|
202
|
+
}
|
|
203
|
+
currentStatus.current = status;
|
|
204
|
+
setActivityStatus(status);
|
|
205
|
+
};
|
|
206
|
+
registerForUpdates(updateActivityStatus);
|
|
207
|
+
return unregisterFromUpdates;
|
|
208
|
+
},
|
|
196
209
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
197
210
|
[]
|
|
198
211
|
);
|
|
199
212
|
|
|
200
213
|
// Create activity actions
|
|
201
|
-
const actions: ActivityControlWidgetProps[
|
|
214
|
+
const actions: ActivityControlWidgetProps["activityActions"] = [];
|
|
202
215
|
|
|
203
216
|
if (failureReportAction && activityStatus?.failed && activityStatus.concreteStatus !== "Cancelled") {
|
|
204
217
|
actions.push({
|
|
@@ -211,13 +224,13 @@ export function useSilkActivityControl({
|
|
|
211
224
|
}
|
|
212
225
|
|
|
213
226
|
if (showStartAction) {
|
|
214
|
-
if(showStartPrioritized && executePrioritized) {
|
|
227
|
+
if (showStartPrioritized && executePrioritized) {
|
|
215
228
|
actions.push({
|
|
216
229
|
"data-test-id": "activity-start-prioritized-activity",
|
|
217
230
|
icon: "item-skip-forward",
|
|
218
231
|
action: executePrioritized,
|
|
219
232
|
tooltip: translate("startPrioritized"),
|
|
220
|
-
})
|
|
233
|
+
});
|
|
221
234
|
} else {
|
|
222
235
|
actions.push({
|
|
223
236
|
"data-test-id": "activity-start-activity",
|
|
@@ -286,9 +299,24 @@ export function useSilkActivityControl({
|
|
|
286
299
|
/>
|
|
287
300
|
</>
|
|
288
301
|
) : (
|
|
289
|
-
|
|
302
|
+
label
|
|
290
303
|
);
|
|
291
304
|
|
|
305
|
+
const timerExecutionMessage =
|
|
306
|
+
(activityStatus?.startTime || activityStatus?.queueTime) && activityStatus.statusName !== "Finished" ? (
|
|
307
|
+
<ElapsedDateTimeDisplay
|
|
308
|
+
includeSeconds
|
|
309
|
+
dateTime={
|
|
310
|
+
(activityStatus.statusName === "Running"
|
|
311
|
+
? activityStatus?.startTime
|
|
312
|
+
: activityStatus.statusName === "Waiting"
|
|
313
|
+
? activityStatus.queueTime
|
|
314
|
+
: activityStatus?.startTime)!
|
|
315
|
+
}
|
|
316
|
+
translateUnits={translateUnits}
|
|
317
|
+
/>
|
|
318
|
+
) : null;
|
|
319
|
+
|
|
292
320
|
const { visualization, ...otherLayoutConfig } = layoutConfig;
|
|
293
321
|
let visualizationProps = {}; // visualization==="none" or undefined
|
|
294
322
|
const runningProgress = activityStatus && activityStatus.isRunning;
|
|
@@ -342,7 +370,10 @@ export function useSilkActivityControl({
|
|
|
342
370
|
data-test-id={props["data-test-id"]}
|
|
343
371
|
label={activityControlLabel}
|
|
344
372
|
activityActions={actions}
|
|
345
|
-
|
|
373
|
+
timerExecutionMsg={timerExecutionMessage}
|
|
374
|
+
statusMessage={
|
|
375
|
+
hideMessageOnStatus(activityStatus?.concreteStatus) ? undefined : activityStatus?.message
|
|
376
|
+
}
|
|
346
377
|
{...visualizationProps}
|
|
347
378
|
{...otherLayoutConfig}
|
|
348
379
|
/>
|
|
@@ -363,16 +394,17 @@ export function useSilkActivityControl({
|
|
|
363
394
|
);
|
|
364
395
|
|
|
365
396
|
return {
|
|
366
|
-
elapsedDateTime:
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
397
|
+
elapsedDateTime:
|
|
398
|
+
activityStatus?.startTime && elapsedTimeOfLastStart ? (
|
|
399
|
+
<ElapsedDateTimeDisplay
|
|
400
|
+
dateTime={activityStatus.startTime}
|
|
401
|
+
translateUnits={elapsedTimeOfLastStart.translate}
|
|
402
|
+
/>
|
|
403
|
+
) : (
|
|
404
|
+
<></>
|
|
405
|
+
),
|
|
374
406
|
intent,
|
|
375
|
-
widget
|
|
407
|
+
widget,
|
|
376
408
|
} as const;
|
|
377
409
|
}
|
|
378
410
|
|
|
@@ -2,7 +2,7 @@ import React, {useEffect, useState} from "react";
|
|
|
2
2
|
import {TestableComponent} from "../../components/interfaces";
|
|
3
3
|
|
|
4
4
|
// @deprecated use `ElapsedDateTimeDisplayUnits`
|
|
5
|
-
export type TimeUnits = "minute" | "minutes" | "hour" | "hours" | "day" | "days"
|
|
5
|
+
export type TimeUnits = "second"| "seconds" | "minute" | "minutes" | "hour" | "hours" | "day" | "days"
|
|
6
6
|
export type ElapsedDateTimeDisplayUnits = TimeUnits;
|
|
7
7
|
|
|
8
8
|
export interface ElapsedDateTimeDisplayProps extends TestableComponent {
|
|
@@ -16,6 +16,7 @@ export interface ElapsedDateTimeDisplayProps extends TestableComponent {
|
|
|
16
16
|
showDateTimeTooltip?: boolean
|
|
17
17
|
// Translate time related vocabulary
|
|
18
18
|
translateUnits: (unit: ElapsedDateTimeDisplayUnits) => string
|
|
19
|
+
includeSeconds?:boolean
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
const dateTimeToElapsedTimeInMs = (dateTime: string | number) => {
|
|
@@ -46,14 +47,20 @@ export const elapsedTimeSegmented = (elapsedTimeInMs: number): number[] => {
|
|
|
46
47
|
* Returns the simplified elapsed time
|
|
47
48
|
* @deprecated moved to `elapsedDateTimeDisplayUtils.simplifiedElapsedTime`
|
|
48
49
|
*/
|
|
49
|
-
export const simplifiedElapsedTime = (timeSegments: number[], translateUnits: (unit: ElapsedDateTimeDisplayUnits) => string) => {
|
|
50
|
+
export const simplifiedElapsedTime = (timeSegments: number[], translateUnits: (unit: ElapsedDateTimeDisplayUnits) => string, includeSeconds = false) => {
|
|
50
51
|
const units: ElapsedDateTimeDisplayUnits[] = ["day", "hour", "minute"]
|
|
52
|
+
|
|
53
|
+
if(includeSeconds){
|
|
54
|
+
units.push("second")
|
|
55
|
+
}
|
|
56
|
+
|
|
51
57
|
// Find first non-null value
|
|
52
58
|
let idx = 0
|
|
53
59
|
while(idx < 3 && timeSegments[idx] === 0) {
|
|
54
60
|
idx++
|
|
55
61
|
}
|
|
56
|
-
|
|
62
|
+
|
|
63
|
+
if(idx === 3 && !includeSeconds) {
|
|
57
64
|
// Do not show exact seconds
|
|
58
65
|
return `< 1 ${translateUnits("minute")}`
|
|
59
66
|
} else {
|
|
@@ -70,6 +77,7 @@ export const ElapsedDateTimeDisplay = ({
|
|
|
70
77
|
suffix = "",
|
|
71
78
|
showDateTimeTooltip = true,
|
|
72
79
|
translateUnits,
|
|
80
|
+
includeSeconds,
|
|
73
81
|
...otherProps
|
|
74
82
|
}: ElapsedDateTimeDisplayProps) => {
|
|
75
83
|
const [elapsedTime, setElapsedTime] = useState<number>(dateTimeToElapsedTimeInMs(dateTime))
|
|
@@ -82,7 +90,7 @@ export const ElapsedDateTimeDisplay = ({
|
|
|
82
90
|
}, [dateTime])
|
|
83
91
|
|
|
84
92
|
return <span data-test-id={otherProps["data-test-id"]} title={showDateTimeTooltip ? new Date(dateTime).toString() : ""}>
|
|
85
|
-
{prefix + simplifiedElapsedTime(elapsedTimeSegmented(elapsedTime), translateUnits) + suffix}
|
|
93
|
+
{prefix + simplifiedElapsedTime(elapsedTimeSegmented(elapsedTime), translateUnits, includeSeconds) + suffix}
|
|
86
94
|
</span>
|
|
87
95
|
}
|
|
88
96
|
|