orc-shared 5.10.2-dev.1 → 5.99.0-dev.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/dist/components/AppFrame/MenuItem.js +3 -12
- package/dist/components/ApplicationModuleLoader.js +3 -2
- package/dist/components/Authenticate.js +29 -22
- package/dist/components/ErrorPlaceholder.js +8 -24
- package/dist/components/{IconButton.js → Form/Inputs/MultiSelector.js} +33 -31
- package/dist/components/Form/Inputs/index.js +1 -1
- package/dist/components/LoadingIcon.js +38 -17
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +3 -3
- package/dist/components/MaterialUI/DataDisplay/Table.js +2 -1
- package/dist/components/MaterialUI/DataDisplay/TableProps.js +3 -1
- package/dist/components/MaterialUI/Inputs/Select.js +10 -0
- package/dist/components/MaterialUI/Inputs/SelectProps.js +3 -1
- package/dist/components/MaterialUI/Navigation/DropDownMenu.js +2 -4
- package/dist/components/MaterialUI/Surfaces/SectionExpansionPanel.js +3 -2
- package/dist/components/MaterialUI/muiThemes.js +2 -0
- package/dist/components/Provision.js +30 -13
- package/dist/components/Routing/SegmentPage.js +115 -56
- package/dist/components/Scope/ScopeNode.js +64 -57
- package/dist/components/Sidepanel.js +57 -23
- package/dist/components/Spritesheet.js +33 -17
- package/dist/components/Text.js +1 -60
- package/dist/components/ToastList.js +95 -64
- package/dist/components/Treeview/Branch.js +82 -20
- package/dist/components/Treeview/Label.js +108 -31
- package/dist/components/Treeview/Leaf.js +56 -12
- package/dist/components/Treeview/Node.js +22 -9
- package/dist/components/Treeview/index.js +7 -1
- package/dist/components/Treeview/settings.js +7 -5
- package/dist/utils/index.js +0 -4
- package/dist/utils/testUtils.js +1 -12
- package/dist/{components/Modal/Background.js → utils/toastHelper.js} +11 -14
- package/package.json +2 -2
- package/src/components/AppFrame/MenuItem.js +1 -9
- package/src/components/ApplicationModuleLoader.js +2 -2
- package/src/components/ApplicationModuleLoader.test.js +15 -28
- package/src/components/Authenticate.js +21 -23
- package/src/components/Authenticate.test.js +19 -27
- package/src/components/ErrorPlaceholder.js +4 -21
- package/src/components/ErrorPlaceholder.test.js +7 -14
- package/src/components/Form/InputField.test.js +2 -1
- package/src/components/Form/Inputs/MultiSelector.js +23 -0
- package/src/components/Form/Inputs/MultiSelector.test.js +112 -0
- package/src/components/Form/Inputs/index.js +1 -1
- package/src/components/Loader.test.js +50 -59
- package/src/components/LoadingIcon.js +27 -14
- package/src/components/LoadingIcon.test.js +11 -15
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +2 -2
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.test.js +0 -74
- package/src/components/MaterialUI/DataDisplay/Table.js +6 -1
- package/src/components/MaterialUI/DataDisplay/Table.test.js +21 -1
- package/src/components/MaterialUI/DataDisplay/TableProps.js +2 -0
- package/src/components/MaterialUI/DataDisplay/TableProps.test.js +20 -2
- package/src/components/MaterialUI/Inputs/Select.js +7 -0
- package/src/components/MaterialUI/Inputs/Select.test.js +45 -0
- package/src/components/MaterialUI/Inputs/SelectProps.js +2 -0
- package/src/components/MaterialUI/Inputs/SelectProps.test.js +2 -0
- package/src/components/MaterialUI/Navigation/DropDownMenu.js +2 -2
- package/src/components/MaterialUI/Navigation/DropDownMenu.test.js +5 -6
- package/src/components/MaterialUI/Surfaces/SectionExpansionPanel.js +2 -1
- package/src/components/MaterialUI/muiThemes.js +3 -0
- package/src/components/Navigation/Navigation.test.js +0 -5
- package/src/components/Navigation/useNavigationState.test.js +79 -222
- package/src/components/Provision.js +36 -42
- package/src/components/Provision.test.js +10 -26
- package/src/components/Routing/SegmentPage.js +68 -52
- package/src/components/Routing/SegmentPage.test.js +4 -12
- package/src/components/Scope/ScopeNode.js +45 -55
- package/src/components/Scope/ScopeNode.test.js +84 -163
- package/src/components/ScopeExtendedConfigurationLoader.test.js +1 -4
- package/src/components/Sidepanel.js +38 -32
- package/src/components/Sidepanel.test.js +49 -27
- package/src/components/Spritesheet.js +23 -21
- package/src/components/Spritesheet.test.js +10 -10
- package/src/components/Text.js +0 -49
- package/src/components/ToastList.js +79 -90
- package/src/components/ToastList.test.js +29 -103
- package/src/components/Treeview/Branch.js +63 -45
- package/src/components/Treeview/Branch.test.js +21 -24
- package/src/components/Treeview/Label.js +66 -52
- package/src/components/Treeview/Label.test.js +42 -60
- package/src/components/Treeview/Leaf.js +41 -22
- package/src/components/Treeview/Leaf.test.js +15 -10
- package/src/components/Treeview/Node.js +16 -9
- package/src/components/Treeview/Node.test.js +269 -200
- package/src/components/Treeview/Treeview.test.js +248 -248
- package/src/components/Treeview/index.js +6 -0
- package/src/components/Treeview/settings.js +7 -6
- package/src/utils/index.js +0 -4
- package/src/utils/testUtils.js +0 -10
- package/src/utils/testUtils.test.js +0 -68
- package/src/utils/toastHelper.js +8 -0
- package/src/utils/toastHelper.test.js +41 -0
- package/dist/components/Button.js +0 -70
- package/dist/components/CategoryList.js +0 -197
- package/dist/components/Checkbox.js +0 -103
- package/dist/components/Icon.js +0 -69
- package/dist/components/Input.js +0 -101
- package/dist/components/List/DataCell.js +0 -129
- package/dist/components/List/HeadCell.js +0 -125
- package/dist/components/List/HeadRow.js +0 -73
- package/dist/components/List/List.js +0 -274
- package/dist/components/List/Row.js +0 -109
- package/dist/components/List/enhanceColumnDefs.js +0 -111
- package/dist/components/List/index.js +0 -59
- package/dist/components/Modal/Dialog.js +0 -75
- package/dist/components/Modal/Wrapper.js +0 -69
- package/dist/components/Modal/index.js +0 -86
- package/dist/components/MultiSelector.js +0 -187
- package/dist/components/Navigation/Bar.js +0 -293
- package/dist/components/Navigation/Tab.js +0 -182
- package/dist/components/Placeholder.js +0 -114
- package/dist/components/Scope/Selector.js +0 -123
- package/dist/components/Selector.js +0 -185
- package/dist/components/Switch.js +0 -128
- package/dist/components/Toolbar.js +0 -227
- package/dist/components/Tooltip.js +0 -66
- package/dist/getTheme.js +0 -158
- package/dist/getThemeOverrides.js +0 -93
- package/dist/hocs/withAuthentication.js +0 -72
- package/dist/utils/styledPropFuncs.js +0 -88
- package/src/components/Button.js +0 -90
- package/src/components/Button.test.js +0 -49
- package/src/components/CategoryList.js +0 -140
- package/src/components/CategoryList.test.js +0 -667
- package/src/components/Checkbox.js +0 -63
- package/src/components/Checkbox.test.js +0 -122
- package/src/components/Icon.js +0 -18
- package/src/components/IconButton.js +0 -30
- package/src/components/IconButton.test.js +0 -61
- package/src/components/Input.js +0 -35
- package/src/components/Input.test.js +0 -34
- package/src/components/List/DataCell.js +0 -77
- package/src/components/List/DataCell.test.js +0 -357
- package/src/components/List/HeadCell.js +0 -105
- package/src/components/List/HeadCell.test.js +0 -331
- package/src/components/List/HeadRow.js +0 -21
- package/src/components/List/HeadRow.test.js +0 -27
- package/src/components/List/List.js +0 -162
- package/src/components/List/List.test.js +0 -705
- package/src/components/List/Row.js +0 -72
- package/src/components/List/Row.test.js +0 -194
- package/src/components/List/enhanceColumnDefs.js +0 -54
- package/src/components/List/enhanceColumnDefs.test.js +0 -179
- package/src/components/List/index.js +0 -6
- package/src/components/Modal/Background.js +0 -10
- package/src/components/Modal/Dialog.js +0 -27
- package/src/components/Modal/Dialog.test.js +0 -20
- package/src/components/Modal/Modal.test.js +0 -52
- package/src/components/Modal/Wrapper.js +0 -32
- package/src/components/Modal/Wrapper.test.js +0 -55
- package/src/components/Modal/index.js +0 -22
- package/src/components/MultiSelector.js +0 -104
- package/src/components/MultiSelector.test.js +0 -348
- package/src/components/Navigation/Bar.js +0 -212
- package/src/components/Navigation/Bar.test.js +0 -552
- package/src/components/Navigation/Tab.js +0 -156
- package/src/components/Navigation/Tab.test.js +0 -404
- package/src/components/Placeholder.js +0 -61
- package/src/components/Placeholder.test.js +0 -106
- package/src/components/Scope/Selector.js +0 -70
- package/src/components/Scope/Selector.test.js +0 -138
- package/src/components/Selector.js +0 -191
- package/src/components/Selector.test.js +0 -157
- package/src/components/Switch.js +0 -112
- package/src/components/Switch.test.js +0 -130
- package/src/components/Text.test.js +0 -132
- package/src/components/Toolbar.js +0 -178
- package/src/components/Toolbar.test.js +0 -478
- package/src/components/Tooltip.js +0 -51
- package/src/components/Tooltip.test.js +0 -21
- package/src/getTheme.js +0 -103
- package/src/getTheme.test.js +0 -92
- package/src/getThemeOverrides.js +0 -27
- package/src/hocs/withAuthentication.js +0 -18
- package/src/hocs/withAuthentication.test.js +0 -120
- package/src/utils/styledPropFuncs.js +0 -20
- package/src/utils/styledPropFuncs.test.js +0 -166
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Provider } from "react-redux";
|
|
3
|
-
import { ThemeProvider } from "styled-components";
|
|
4
3
|
import { mount, act } from "unexpected-reaction";
|
|
5
4
|
import sinon from "sinon";
|
|
6
|
-
import { spyOnConsole } from "../utils/testUtils";
|
|
5
|
+
import { createMuiTheme, spyOnConsole, TestWrapper } from "../utils/testUtils";
|
|
7
6
|
import ErrorPlaceholder from "./ErrorPlaceholder";
|
|
8
7
|
import Loader, { Loading } from "./Loader";
|
|
8
|
+
import ColumnWrapper from "./ColumnWrapper";
|
|
9
|
+
import LoadingIcon from "./LoadingIcon";
|
|
10
|
+
|
|
11
|
+
const theme = createMuiTheme();
|
|
9
12
|
|
|
10
13
|
describe("Loader placeholder", () => {
|
|
11
14
|
let clock;
|
|
@@ -18,11 +21,11 @@ describe("Loader placeholder", () => {
|
|
|
18
21
|
|
|
19
22
|
it("renders null, then load spinner if no props set", () => {
|
|
20
23
|
const loader = mount(
|
|
21
|
-
<
|
|
24
|
+
<TestWrapper stylesProvider muiThemeProvider={{ theme }}>
|
|
22
25
|
<div>
|
|
23
26
|
<Loading />
|
|
24
27
|
</div>
|
|
25
|
-
</
|
|
28
|
+
</TestWrapper>,
|
|
26
29
|
);
|
|
27
30
|
expect(loader, "to satisfy", <div />);
|
|
28
31
|
act(() => {
|
|
@@ -30,12 +33,12 @@ describe("Loader placeholder", () => {
|
|
|
30
33
|
});
|
|
31
34
|
expect(
|
|
32
35
|
loader,
|
|
33
|
-
"queried for first",
|
|
34
|
-
"svg",
|
|
35
36
|
"to satisfy",
|
|
36
|
-
<
|
|
37
|
-
<
|
|
38
|
-
|
|
37
|
+
<TestWrapper stylesProvider muiThemeProvider={{ theme }}>
|
|
38
|
+
<div>
|
|
39
|
+
<LoadingIcon />
|
|
40
|
+
</div>
|
|
41
|
+
</TestWrapper>,
|
|
39
42
|
);
|
|
40
43
|
});
|
|
41
44
|
|
|
@@ -50,9 +53,7 @@ describe("Loader placeholder", () => {
|
|
|
50
53
|
getState: () => ({}),
|
|
51
54
|
}}
|
|
52
55
|
>
|
|
53
|
-
<
|
|
54
|
-
<Loading {...{ error }} />
|
|
55
|
-
</ThemeProvider>
|
|
56
|
+
<Loading {...{ error }} />
|
|
56
57
|
</Provider>,
|
|
57
58
|
"when mounted",
|
|
58
59
|
"to satisfy",
|
|
@@ -63,9 +64,7 @@ describe("Loader placeholder", () => {
|
|
|
63
64
|
getState: () => ({}),
|
|
64
65
|
}}
|
|
65
66
|
>
|
|
66
|
-
<
|
|
67
|
-
<ErrorPlaceholder message="This is a test" />
|
|
68
|
-
</ThemeProvider>
|
|
67
|
+
<ErrorPlaceholder message="This is a test" />
|
|
69
68
|
</Provider>,
|
|
70
69
|
);
|
|
71
70
|
});
|
|
@@ -73,9 +72,9 @@ describe("Loader placeholder", () => {
|
|
|
73
72
|
});
|
|
74
73
|
|
|
75
74
|
describe("Loader", () => {
|
|
76
|
-
let clock,
|
|
75
|
+
let clock, componentLoader, errorLoader;
|
|
77
76
|
beforeEach(() => {
|
|
78
|
-
|
|
77
|
+
componentLoader = () => import("./ColumnWrapper");
|
|
79
78
|
errorLoader = () => Promise.reject(new Error("This is not right"));
|
|
80
79
|
clock = sinon.useFakeTimers();
|
|
81
80
|
});
|
|
@@ -85,13 +84,13 @@ describe("Loader", () => {
|
|
|
85
84
|
spyOnConsole(["error"]);
|
|
86
85
|
|
|
87
86
|
it("loads the component", () => {
|
|
88
|
-
const Comp = Loader(
|
|
87
|
+
const Comp = Loader(componentLoader);
|
|
89
88
|
const loader = mount(
|
|
90
|
-
<
|
|
89
|
+
<TestWrapper stylesProvider muiThemeProvider={{ theme }}>
|
|
91
90
|
<div>
|
|
92
91
|
<Comp />
|
|
93
92
|
</div>
|
|
94
|
-
</
|
|
93
|
+
</TestWrapper>,
|
|
95
94
|
);
|
|
96
95
|
expect(loader, "to satisfy", <div />);
|
|
97
96
|
act(() => {
|
|
@@ -99,12 +98,12 @@ describe("Loader", () => {
|
|
|
99
98
|
});
|
|
100
99
|
expect(
|
|
101
100
|
loader,
|
|
102
|
-
"queried for first",
|
|
103
|
-
"svg",
|
|
104
101
|
"to satisfy",
|
|
105
|
-
<
|
|
106
|
-
<
|
|
107
|
-
|
|
102
|
+
<TestWrapper stylesProvider muiThemeProvider={{ theme }}>
|
|
103
|
+
<div>
|
|
104
|
+
<LoadingIcon />
|
|
105
|
+
</div>
|
|
106
|
+
</TestWrapper>,
|
|
108
107
|
);
|
|
109
108
|
let load;
|
|
110
109
|
act(() => {
|
|
@@ -114,29 +113,29 @@ describe("Loader", () => {
|
|
|
114
113
|
expect(
|
|
115
114
|
loader,
|
|
116
115
|
"to satisfy",
|
|
117
|
-
<
|
|
118
|
-
<
|
|
119
|
-
|
|
116
|
+
<TestWrapper stylesProvider muiThemeProvider={{ theme }}>
|
|
117
|
+
<div>
|
|
118
|
+
<ColumnWrapper />
|
|
119
|
+
</div>
|
|
120
|
+
</TestWrapper>,
|
|
120
121
|
).then(() => expect(console.error, "was not called")),
|
|
121
122
|
);
|
|
122
123
|
});
|
|
123
124
|
|
|
124
125
|
it("errors out", () => {
|
|
125
126
|
const Comp = Loader(errorLoader);
|
|
127
|
+
const store = {
|
|
128
|
+
subscribe: () => {},
|
|
129
|
+
dispatch: () => {},
|
|
130
|
+
getState: () => ({}),
|
|
131
|
+
};
|
|
132
|
+
|
|
126
133
|
const loader = mount(
|
|
127
|
-
<
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}}
|
|
133
|
-
>
|
|
134
|
-
<ThemeProvider theme={{}}>
|
|
135
|
-
<div>
|
|
136
|
-
<Comp />
|
|
137
|
-
</div>
|
|
138
|
-
</ThemeProvider>
|
|
139
|
-
</Provider>,
|
|
134
|
+
<TestWrapper provider={{ store }} stylesProvider muiThemeProvider={{ theme }}>
|
|
135
|
+
<div>
|
|
136
|
+
<Comp />
|
|
137
|
+
</div>
|
|
138
|
+
</TestWrapper>,
|
|
140
139
|
);
|
|
141
140
|
expect(loader, "to satisfy", <div />);
|
|
142
141
|
act(() => {
|
|
@@ -144,12 +143,12 @@ describe("Loader", () => {
|
|
|
144
143
|
});
|
|
145
144
|
expect(
|
|
146
145
|
loader,
|
|
147
|
-
"queried for first",
|
|
148
|
-
"svg",
|
|
149
146
|
"to satisfy",
|
|
150
|
-
<
|
|
151
|
-
<
|
|
152
|
-
|
|
147
|
+
<TestWrapper stylesProvider muiThemeProvider={{ theme }}>
|
|
148
|
+
<div>
|
|
149
|
+
<LoadingIcon />
|
|
150
|
+
</div>
|
|
151
|
+
</TestWrapper>,
|
|
153
152
|
);
|
|
154
153
|
let load;
|
|
155
154
|
act(() => {
|
|
@@ -159,19 +158,11 @@ describe("Loader", () => {
|
|
|
159
158
|
expect(
|
|
160
159
|
loader,
|
|
161
160
|
"to satisfy",
|
|
162
|
-
<
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}}
|
|
168
|
-
>
|
|
169
|
-
<ThemeProvider theme={{}}>
|
|
170
|
-
<div>
|
|
171
|
-
<ErrorPlaceholder message="This is not right" />
|
|
172
|
-
</div>
|
|
173
|
-
</ThemeProvider>
|
|
174
|
-
</Provider>,
|
|
161
|
+
<TestWrapper provider={{ store }} stylesProvider muiThemeProvider={{ theme }}>
|
|
162
|
+
<div>
|
|
163
|
+
<ErrorPlaceholder message="This is not right" />
|
|
164
|
+
</div>
|
|
165
|
+
</TestWrapper>,
|
|
175
166
|
).then(() => expect(console.error, "was called")),
|
|
176
167
|
);
|
|
177
168
|
});
|
|
@@ -1,19 +1,32 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import Placeholder from "./Placeholder";
|
|
2
|
+
import CircularProgress from "@material-ui/core/CircularProgress";
|
|
3
|
+
import { makeStyles } from "@material-ui/core";
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
const useStyles = makeStyles(theme => ({
|
|
6
|
+
progressContainer: {
|
|
7
|
+
top: 0,
|
|
8
|
+
left: 0,
|
|
9
|
+
right: 0,
|
|
10
|
+
bottom: 0,
|
|
11
|
+
display: "flex",
|
|
12
|
+
position: "fixed",
|
|
13
|
+
alignItems: "center",
|
|
14
|
+
justifyContent: "center",
|
|
15
|
+
zIndex: 999,
|
|
16
|
+
},
|
|
17
|
+
progress: {
|
|
18
|
+
color: theme.palette.primary.main,
|
|
19
|
+
},
|
|
20
|
+
}));
|
|
14
21
|
|
|
15
|
-
const LoadingIcon =
|
|
16
|
-
|
|
17
|
-
|
|
22
|
+
const LoadingIcon = () => {
|
|
23
|
+
const classes = useStyles();
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div className={classes.progressContainer}>
|
|
27
|
+
<CircularProgress className={classes.progress} size={100} color="inherit" />
|
|
28
|
+
</div>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
18
31
|
|
|
19
32
|
export default LoadingIcon;
|
|
@@ -1,26 +1,22 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
import Placeholder from "./Placeholder";
|
|
2
|
+
import CircularProgress from "@material-ui/core/CircularProgress";
|
|
4
3
|
import LoadingIcon from "./LoadingIcon";
|
|
4
|
+
import { createMuiTheme, TestWrapper } from "../utils/testUtils";
|
|
5
|
+
|
|
6
|
+
const theme = createMuiTheme();
|
|
5
7
|
|
|
6
8
|
describe("LoadingIcon", () => {
|
|
7
9
|
it("shows a spinning load icon", () =>
|
|
8
10
|
expect(
|
|
9
|
-
<
|
|
10
|
-
<LoadingIcon />
|
|
11
|
-
</ThemeProvider>,
|
|
12
|
-
"when mounted",
|
|
13
|
-
"to satisfy",
|
|
14
|
-
<Placeholder icon="loading" animate />,
|
|
15
|
-
));
|
|
16
|
-
|
|
17
|
-
it("gets icon from theme", () =>
|
|
18
|
-
expect(
|
|
19
|
-
<ThemeProvider theme={{ icons: { loading: "spinner" } }}>
|
|
11
|
+
<TestWrapper stylesProvider muiThemeProvider={{ theme }}>
|
|
20
12
|
<LoadingIcon />
|
|
21
|
-
</
|
|
13
|
+
</TestWrapper>,
|
|
22
14
|
"when mounted",
|
|
23
15
|
"to satisfy",
|
|
24
|
-
<
|
|
16
|
+
<TestWrapper stylesProvider muiThemeProvider={{ theme }}>
|
|
17
|
+
<div>
|
|
18
|
+
<CircularProgress size={100} color="inherit" />
|
|
19
|
+
</div>
|
|
20
|
+
</TestWrapper>,
|
|
25
21
|
));
|
|
26
22
|
});
|
|
@@ -165,7 +165,7 @@ const StepperModal = ({
|
|
|
165
165
|
<FormattedMessage {...sharedMessages.cancel} />
|
|
166
166
|
</Button>
|
|
167
167
|
|
|
168
|
-
{
|
|
168
|
+
{currentStep < steps.length - 1 &&
|
|
169
169
|
(steps[currentStep]?.actions?.length > 0 ? (
|
|
170
170
|
steps[currentStep].actions.map(action => (
|
|
171
171
|
<Button
|
|
@@ -191,7 +191,7 @@ const StepperModal = ({
|
|
|
191
191
|
</Button>
|
|
192
192
|
))}
|
|
193
193
|
|
|
194
|
-
{currentStep === steps.length - 1 &&
|
|
194
|
+
{currentStep === steps.length - 1 && (
|
|
195
195
|
<Button
|
|
196
196
|
variant="contained"
|
|
197
197
|
color="primary"
|
|
@@ -335,80 +335,6 @@ describe("StepperModal", () => {
|
|
|
335
335
|
expect(okCallback, "was called");
|
|
336
336
|
});
|
|
337
337
|
|
|
338
|
-
it("Renders StepperModal correctly without confirm button for an intermediate step", () => {
|
|
339
|
-
const open = true;
|
|
340
|
-
const title = "title";
|
|
341
|
-
const backdropClickCallback = jest.fn();
|
|
342
|
-
const okCallback = jest.fn();
|
|
343
|
-
const cancelCallback = jest.fn();
|
|
344
|
-
const modalProps = new ModalProps();
|
|
345
|
-
const actions = [
|
|
346
|
-
{
|
|
347
|
-
value: "first value",
|
|
348
|
-
label: "first action",
|
|
349
|
-
Handler: () => {},
|
|
350
|
-
},
|
|
351
|
-
{
|
|
352
|
-
value: "second value",
|
|
353
|
-
label: "second action",
|
|
354
|
-
Handler: () => {},
|
|
355
|
-
},
|
|
356
|
-
];
|
|
357
|
-
const steps = [{ title: "step1", content: <div>content</div>, actions, isIntermediate: true }];
|
|
358
|
-
|
|
359
|
-
const titleComponent = (
|
|
360
|
-
<div>
|
|
361
|
-
<div>{title}</div>
|
|
362
|
-
<div>step1</div>
|
|
363
|
-
</div>
|
|
364
|
-
);
|
|
365
|
-
const messageComponent = <div>{steps[0].content}</div>;
|
|
366
|
-
|
|
367
|
-
modalProps.set(ModalProps.propNames.title, titleComponent);
|
|
368
|
-
modalProps.set(ModalProps.propNames.open, open);
|
|
369
|
-
modalProps.set(ModalProps.propNames.backdropClickCallback, backdropClickCallback);
|
|
370
|
-
modalProps.set(ModalProps.propNames.type, "wide");
|
|
371
|
-
|
|
372
|
-
const actionPanel = (
|
|
373
|
-
<div>
|
|
374
|
-
<div></div>
|
|
375
|
-
<div>
|
|
376
|
-
<Button variant="outlined" disabled={false} onClick={() => cancelCallback()}>
|
|
377
|
-
{sharedMessages.cancel.defaultMessage}
|
|
378
|
-
</Button>
|
|
379
|
-
<Button variant="contained" color="primary" disabled={false} onClick={() => {}} disableElevation>
|
|
380
|
-
first action
|
|
381
|
-
</Button>
|
|
382
|
-
<Button variant="contained" color="primary" disabled={false} onClick={() => {}} disableElevation>
|
|
383
|
-
second action
|
|
384
|
-
</Button>
|
|
385
|
-
</div>
|
|
386
|
-
</div>
|
|
387
|
-
);
|
|
388
|
-
|
|
389
|
-
modalProps.set(ModalProps.propNames.actionPanel, actionPanel);
|
|
390
|
-
|
|
391
|
-
const component = (
|
|
392
|
-
<IntlProvider locale="en-US" messages={messages}>
|
|
393
|
-
<StepperModal
|
|
394
|
-
steps={steps}
|
|
395
|
-
title={title}
|
|
396
|
-
open={open}
|
|
397
|
-
confirmCallback={okCallback}
|
|
398
|
-
closeCallback={cancelCallback}
|
|
399
|
-
/>
|
|
400
|
-
</IntlProvider>
|
|
401
|
-
);
|
|
402
|
-
|
|
403
|
-
const expected = (
|
|
404
|
-
<IntlProvider locale="en-US" messages={messages}>
|
|
405
|
-
<Modal message={messageComponent} modalProps={modalProps} />
|
|
406
|
-
</IntlProvider>
|
|
407
|
-
);
|
|
408
|
-
|
|
409
|
-
expect(component, "when mounted", "to satisfy", expected);
|
|
410
|
-
});
|
|
411
|
-
|
|
412
338
|
it("Render closed modal", () => {
|
|
413
339
|
const open = false;
|
|
414
340
|
|
|
@@ -352,7 +352,11 @@ const DefaultFullTable = React.forwardRef((props, ref) => {
|
|
|
352
352
|
context={props.context}
|
|
353
353
|
/>
|
|
354
354
|
</TableMui>
|
|
355
|
-
{props.tableRows.length > 0 ? null :
|
|
355
|
+
{props.tableRows.length > 0 ? null : (
|
|
356
|
+
<div className={classNames(props.classes.placeholder, props.customClasses.placeholderContainer)}>
|
|
357
|
+
{props.placeholder}
|
|
358
|
+
</div>
|
|
359
|
+
)}
|
|
356
360
|
</div>
|
|
357
361
|
);
|
|
358
362
|
});
|
|
@@ -441,6 +445,7 @@ const Table = React.forwardRef(
|
|
|
441
445
|
customClasses["tableCell"] = tableProps?.getStyle(TableProps.ruleNames.tableCell) || null;
|
|
442
446
|
customClasses["headerCell"] = tableProps?.getStyle(TableProps.ruleNames.headerCell) || null;
|
|
443
447
|
customClasses["tableContainer"] = tableProps?.getStyle(TableProps.ruleNames.tableContainer) || null;
|
|
448
|
+
customClasses["placeholderContainer"] = tableProps?.getStyle(TableProps.ruleNames.placeholderContainer) || null;
|
|
444
449
|
customClasses["container"] = tableProps?.getStyle(TableProps.ruleNames.container) || null;
|
|
445
450
|
customClasses["table"] = tableProps?.getStyle(TableProps.ruleNames.table) || null;
|
|
446
451
|
|
|
@@ -8,7 +8,7 @@ import TableMui from "@material-ui/core/Table";
|
|
|
8
8
|
import TableHead from "@material-ui/core/TableHead";
|
|
9
9
|
import TableRow from "@material-ui/core/TableRow";
|
|
10
10
|
import { buildHeaderAndRowFromConfig } from "./tableHelpers";
|
|
11
|
-
import Placeholder from "
|
|
11
|
+
import Placeholder from "./PredefinedElements/Placeholder";
|
|
12
12
|
import TableInfoBar from "./PredefinedElements/TableInfoBar";
|
|
13
13
|
import { ignoreConsoleError } from "../../../utils/testUtils";
|
|
14
14
|
import TableProps from "./TableProps";
|
|
@@ -1102,6 +1102,26 @@ describe("Table", () => {
|
|
|
1102
1102
|
expect(placeHolder.length, "to equal", 1);
|
|
1103
1103
|
});
|
|
1104
1104
|
|
|
1105
|
+
it("Renders Table with placeholder and custom class if rows are empty", () => {
|
|
1106
|
+
const { headers, rows } = buildHeaderAndRowFromConfig(config, []);
|
|
1107
|
+
|
|
1108
|
+
const placeholder = <Placeholder />;
|
|
1109
|
+
|
|
1110
|
+
const tableProps = new TableProps();
|
|
1111
|
+
tableProps.setStyle(TableProps.ruleNames.placeholderContainer, "placeholder-container-custom-class");
|
|
1112
|
+
|
|
1113
|
+
const component = <Table rows={rows} headers={headers} placeholder={placeholder} tableProps={tableProps} />;
|
|
1114
|
+
|
|
1115
|
+
const mountedComponent = mount(component);
|
|
1116
|
+
|
|
1117
|
+
const placeHolder = mountedComponent.find(Placeholder);
|
|
1118
|
+
expect(placeHolder.exists(), "to be true");
|
|
1119
|
+
|
|
1120
|
+
const placeholderContainer = placeHolder.parent();
|
|
1121
|
+
expect(placeholderContainer.exists(), "to be true");
|
|
1122
|
+
expect(placeholderContainer.hasClass("placeholder-container-custom-class"), "to be true");
|
|
1123
|
+
});
|
|
1124
|
+
|
|
1105
1125
|
it("Renders Table with tableInfo if provided", () => {
|
|
1106
1126
|
const { headers, rows } = buildHeaderAndRowFromConfig(config, []);
|
|
1107
1127
|
|
|
@@ -24,6 +24,7 @@ class TableProps extends ComponentProps {
|
|
|
24
24
|
tableContainer: "tableContainer",
|
|
25
25
|
container: "container",
|
|
26
26
|
table: "table",
|
|
27
|
+
placeholderContainer: "placeholderContainer",
|
|
27
28
|
};
|
|
28
29
|
|
|
29
30
|
constructor() {
|
|
@@ -47,6 +48,7 @@ class TableProps extends ComponentProps {
|
|
|
47
48
|
this.componentClasses.set(this.constructor.ruleNames.tableCell, null);
|
|
48
49
|
this.componentClasses.set(this.constructor.ruleNames.headerCell, null);
|
|
49
50
|
this.componentClasses.set(this.constructor.ruleNames.tableContainer, null);
|
|
51
|
+
this.componentClasses.set(this.constructor.ruleNames.placeholderContainer, null);
|
|
50
52
|
this.componentClasses.set(this.constructor.ruleNames.container, null);
|
|
51
53
|
this.componentClasses.set(this.constructor.ruleNames.table, null);
|
|
52
54
|
|
|
@@ -12,7 +12,16 @@ describe("TableProps Props", () => {
|
|
|
12
12
|
"constrained",
|
|
13
13
|
];
|
|
14
14
|
|
|
15
|
-
const ruleNames = [
|
|
15
|
+
const ruleNames = [
|
|
16
|
+
"tableHeader",
|
|
17
|
+
"tableRow",
|
|
18
|
+
"tableCell",
|
|
19
|
+
"headerCell",
|
|
20
|
+
"tableContainer",
|
|
21
|
+
"placeholderContainer",
|
|
22
|
+
"container",
|
|
23
|
+
"table",
|
|
24
|
+
];
|
|
16
25
|
|
|
17
26
|
expect(TableProps.propNames, "to have keys", propNames);
|
|
18
27
|
expect(TableProps.ruleNames, "to have keys", ruleNames);
|
|
@@ -34,7 +43,16 @@ describe("TableProps Props", () => {
|
|
|
34
43
|
"saveScrollbarPosition",
|
|
35
44
|
];
|
|
36
45
|
|
|
37
|
-
const ruleNames = [
|
|
46
|
+
const ruleNames = [
|
|
47
|
+
"tableHeader",
|
|
48
|
+
"tableRow",
|
|
49
|
+
"tableCell",
|
|
50
|
+
"headerCell",
|
|
51
|
+
"tableContainer",
|
|
52
|
+
"placeholderContainer",
|
|
53
|
+
"container",
|
|
54
|
+
"table",
|
|
55
|
+
];
|
|
38
56
|
|
|
39
57
|
const tableProps = new TableProps();
|
|
40
58
|
|
|
@@ -145,6 +145,8 @@ export const SelectIconButton = props => {
|
|
|
145
145
|
);
|
|
146
146
|
};
|
|
147
147
|
|
|
148
|
+
const renderMultipleValues = selected => selected?.join(", ");
|
|
149
|
+
|
|
148
150
|
const selectEmptyValue = "~~#~~";
|
|
149
151
|
|
|
150
152
|
const Select = ({ options, selectProps, children }) => {
|
|
@@ -169,6 +171,7 @@ const Select = ({ options, selectProps, children }) => {
|
|
|
169
171
|
const native = selectProps?.get(SelectProps.propNames.native);
|
|
170
172
|
const onClose = selectProps?.get(SelectProps.propNames.onClose);
|
|
171
173
|
const inputProps = selectProps?.get(SelectProps.propNames.inputProps);
|
|
174
|
+
const multiple = selectProps?.get(SelectProps.propNames.multiple);
|
|
172
175
|
const hasError = !!error;
|
|
173
176
|
|
|
174
177
|
if (sortType === sortTypeEnum.numeric) {
|
|
@@ -252,6 +255,8 @@ const Select = ({ options, selectProps, children }) => {
|
|
|
252
255
|
error={hasError}
|
|
253
256
|
native={native}
|
|
254
257
|
inputProps={inputProps}
|
|
258
|
+
multiple={multiple}
|
|
259
|
+
renderValue={multiple ? renderMultipleValues : undefined}
|
|
255
260
|
classes={{
|
|
256
261
|
icon: classes.icon,
|
|
257
262
|
root: selectProps?.getStyle(SelectProps.ruleNames.root),
|
|
@@ -275,6 +280,8 @@ const Select = ({ options, selectProps, children }) => {
|
|
|
275
280
|
error={hasError}
|
|
276
281
|
native={native}
|
|
277
282
|
inputProps={inputProps}
|
|
283
|
+
multiple={multiple}
|
|
284
|
+
renderValue={multiple ? renderMultipleValues : undefined}
|
|
278
285
|
classes={{
|
|
279
286
|
icon: classes.icon,
|
|
280
287
|
root: selectProps?.getStyle(SelectProps.ruleNames.root),
|
|
@@ -669,4 +669,49 @@ describe("Select Component", () => {
|
|
|
669
669
|
|
|
670
670
|
expect(muiSelect.prop("open"), "to be true");
|
|
671
671
|
});
|
|
672
|
+
|
|
673
|
+
it("Renders Select component with multiple values", () => {
|
|
674
|
+
const options = [
|
|
675
|
+
{ value: "aValue", label: "aLabel" },
|
|
676
|
+
{ value: "anotherValue", label: "anotherLabel" },
|
|
677
|
+
];
|
|
678
|
+
|
|
679
|
+
const selectProps = new SelectProps();
|
|
680
|
+
|
|
681
|
+
selectProps.set(SelectProps.propNames.update, update);
|
|
682
|
+
selectProps.set(SelectProps.propNames.multiple, true);
|
|
683
|
+
selectProps.set(SelectProps.propNames.value, ["aValue"]);
|
|
684
|
+
|
|
685
|
+
const component = (
|
|
686
|
+
<TestWrapper stylesProvider muiThemeProvider={{ theme }}>
|
|
687
|
+
<Select options={options} selectProps={selectProps} />
|
|
688
|
+
</TestWrapper>
|
|
689
|
+
);
|
|
690
|
+
|
|
691
|
+
const ChevronDown = props => {
|
|
692
|
+
return <Icon id="dropdown-chevron-down" {...props} />;
|
|
693
|
+
};
|
|
694
|
+
|
|
695
|
+
const expected = (
|
|
696
|
+
<TestWrapper stylesProvider muiThemeProvider={{ theme }}>
|
|
697
|
+
<SelectMUI
|
|
698
|
+
value={["aValue"]}
|
|
699
|
+
disableUnderline={true}
|
|
700
|
+
IconComponent={ChevronDown}
|
|
701
|
+
error={false}
|
|
702
|
+
multiple={true}
|
|
703
|
+
renderValue={selected => selected.join(", ")}
|
|
704
|
+
>
|
|
705
|
+
<MenuItem key="aValue" value="aValue">
|
|
706
|
+
<TooltippedTypography children="aLabel" titleValue="aLabel" />
|
|
707
|
+
</MenuItem>
|
|
708
|
+
<MenuItem key="anotherValue" value="anotherValue">
|
|
709
|
+
<TooltippedTypography noWrap children="anotherLabel" titleValue="anotherLabel" />
|
|
710
|
+
</MenuItem>
|
|
711
|
+
</SelectMUI>
|
|
712
|
+
</TestWrapper>
|
|
713
|
+
);
|
|
714
|
+
|
|
715
|
+
expect(component, "when mounted", "to satisfy", expected);
|
|
716
|
+
});
|
|
672
717
|
});
|
|
@@ -21,6 +21,7 @@ class SelectProps extends ComponentProps {
|
|
|
21
21
|
onClose: "onClose",
|
|
22
22
|
native: "native",
|
|
23
23
|
inputProps: "inputProps",
|
|
24
|
+
multiple: "multiple",
|
|
24
25
|
};
|
|
25
26
|
|
|
26
27
|
static ruleNames = {
|
|
@@ -42,6 +43,7 @@ class SelectProps extends ComponentProps {
|
|
|
42
43
|
this.componentProps.set(this.constructor.propNames.onClose, null);
|
|
43
44
|
this.componentProps.set(this.constructor.propNames.native, null);
|
|
44
45
|
this.componentProps.set(this.constructor.propNames.inputProps, null);
|
|
46
|
+
this.componentProps.set(this.constructor.propNames.multiple, null);
|
|
45
47
|
|
|
46
48
|
this.componentClasses.set(this.constructor.ruleNames.root, null);
|
|
47
49
|
this.componentClasses.set(this.constructor.ruleNames.paper, null);
|
|
@@ -15,6 +15,7 @@ describe("Select Props", () => {
|
|
|
15
15
|
"onClose",
|
|
16
16
|
"native",
|
|
17
17
|
"inputProps",
|
|
18
|
+
"multiple",
|
|
18
19
|
];
|
|
19
20
|
|
|
20
21
|
expect(SelectProps.propNames, "to have keys", propNames);
|
|
@@ -34,6 +35,7 @@ describe("Select Props", () => {
|
|
|
34
35
|
"onClose",
|
|
35
36
|
"native",
|
|
36
37
|
"inputProps",
|
|
38
|
+
"multiple",
|
|
37
39
|
];
|
|
38
40
|
|
|
39
41
|
const selectProps = new SelectProps();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { useState, isValidElement, cloneElement } from "react";
|
|
2
|
+
import { FormattedMessage } from "react-intl";
|
|
2
3
|
import { makeStyles } from "@material-ui/core/styles";
|
|
3
4
|
import Button from "@material-ui/core/Button";
|
|
4
5
|
import Menu from "@material-ui/core/Menu";
|
|
5
6
|
import MenuItem from "@material-ui/core/MenuItem";
|
|
6
|
-
import Text from "../../Text";
|
|
7
7
|
import DropDownMenuProps, { isDropDownMenuProps } from "./DropDownMenuProps";
|
|
8
8
|
|
|
9
9
|
const useStyles = makeStyles(theme => ({
|
|
@@ -95,7 +95,7 @@ const DropDownMenu = ({ payload, menuItems, children, dropDownMenuProps = new Dr
|
|
|
95
95
|
onClick={onMenuItemClick(action, itemContext)}
|
|
96
96
|
disabled={disabled}
|
|
97
97
|
>
|
|
98
|
-
<
|
|
98
|
+
{typeof title === "string" ? title : <FormattedMessage {...title} />}
|
|
99
99
|
</MenuItem>
|
|
100
100
|
))}
|
|
101
101
|
</Menu>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Provider } from "react-redux";
|
|
3
2
|
import ReactDOM from "react-dom";
|
|
4
3
|
import sinon from "sinon";
|
|
5
4
|
import { mount } from "enzyme";
|
|
@@ -14,7 +13,7 @@ describe("DropDownMenu", () => {
|
|
|
14
13
|
let store, menuItems, container;
|
|
15
14
|
beforeEach(() => {
|
|
16
15
|
menuItems = [
|
|
17
|
-
{ title: "asd", action: sinon.spy().named("action"), itemContext: "aContext" },
|
|
16
|
+
{ title: { id: "asd", defaultMessage: "asd" }, action: sinon.spy().named("action"), itemContext: "aContext" },
|
|
18
17
|
{ title: "asd2", action: sinon.spy().named("action"), itemContext: "myContext" },
|
|
19
18
|
];
|
|
20
19
|
store = {
|
|
@@ -73,9 +72,9 @@ describe("DropDownMenu", () => {
|
|
|
73
72
|
const payload = "payload";
|
|
74
73
|
|
|
75
74
|
ReactDOM.render(
|
|
76
|
-
<
|
|
75
|
+
<TestWrapper provider={{ store }} intlProvider>
|
|
77
76
|
<DropDownMenu payload={payload} menuItems={menuItems} />
|
|
78
|
-
</
|
|
77
|
+
</TestWrapper>,
|
|
79
78
|
container,
|
|
80
79
|
);
|
|
81
80
|
|
|
@@ -98,9 +97,9 @@ describe("DropDownMenu", () => {
|
|
|
98
97
|
const payload = "payload";
|
|
99
98
|
|
|
100
99
|
const component = (
|
|
101
|
-
<
|
|
100
|
+
<TestWrapper provider={{ store }} intlProvider>
|
|
102
101
|
<DropDownMenu payload={payload} menuItems={menuItems} />
|
|
103
|
-
</
|
|
102
|
+
</TestWrapper>
|
|
104
103
|
);
|
|
105
104
|
|
|
106
105
|
const mountedComponent = mount(component);
|