orc-shared 5.7.0-dev.9 → 5.7.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/dist/actions/makeApiAction.js +2 -2
- package/dist/actions/makeOrcApiAction.js +2 -2
- package/dist/actions/metadata.js +2 -2
- package/dist/actions/navigation.js +2 -2
- package/dist/actions/requestsApi.js +743 -140
- package/dist/actions/scopes.js +25 -1
- package/dist/buildStore.js +4 -2
- package/dist/components/AppFrame/About.js +2 -2
- package/dist/components/AppFrame/Preferences.js +2 -3
- package/dist/components/Form/FieldList.js +5 -6
- package/dist/components/Form/Inputs/Text.js +0 -1
- package/dist/components/Form/Inputs/Translation.js +2 -2
- package/dist/components/List/enhanceColumnDefs.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/Modal.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/Notification.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/NotificationProps.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.js +18 -11
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Translations.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/TableProps.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/TransferList.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/chipProps.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/collapsableListProps.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/dividerProps.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/modalProps.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/useTableSelection.js +2 -2
- package/dist/components/MaterialUI/Inputs/Autocomplete.js +2 -2
- package/dist/components/MaterialUI/Inputs/AutocompleteProps.js +2 -2
- package/dist/components/MaterialUI/Inputs/Checkbox.js +2 -2
- package/dist/components/MaterialUI/Inputs/CheckboxGroup.js +12 -6
- package/dist/components/MaterialUI/Inputs/CheckboxGroupProps.js +5 -3
- package/dist/components/MaterialUI/Inputs/CheckboxProps.js +2 -2
- package/dist/components/MaterialUI/Inputs/DatePicker.js +2 -2
- package/dist/components/MaterialUI/Inputs/InputBase.js +8 -3
- package/dist/components/MaterialUI/Inputs/InputBaseProps.js +2 -2
- package/dist/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +15 -8
- package/dist/components/MaterialUI/Inputs/RadioProps.js +2 -2
- package/dist/components/MaterialUI/Inputs/Select.js +2 -2
- package/dist/components/MaterialUI/Inputs/SelectProps.js +2 -2
- package/dist/components/MaterialUI/Inputs/StandaloneRadio.js +2 -2
- package/dist/components/MaterialUI/Inputs/Switch.js +2 -2
- package/dist/components/MaterialUI/Inputs/SwitchProps.js +2 -2
- package/dist/components/MaterialUI/Inputs/createInput.js +2 -2
- package/dist/components/MaterialUI/Inputs/standaloneRadioProps.js +2 -2
- package/dist/components/MaterialUI/Navigation/DropDownMenuProps.js +2 -2
- package/dist/components/MaterialUI/ScopeSelector/TreeItem.js +2 -3
- package/dist/components/MaterialUI/Surfaces/expansionPanelProps.js +2 -2
- package/dist/components/MaterialUI/Surfaces/paperProps.js +2 -2
- package/dist/components/MaterialUI/componentProps.js +2 -2
- package/dist/components/MaterialUI/hocs/withDeferredTooltip.js +1 -0
- package/dist/components/MaterialUI/muiThemes.js +2 -2
- package/dist/components/MaterialUI/textProps.js +2 -2
- package/dist/components/Navigation/Bar.js +2 -2
- package/dist/components/Navigation/index.js +1 -0
- package/dist/components/Navigation/useNavigationState.js +2 -2
- package/dist/components/Provision.js +2 -1
- package/dist/components/Routing/SegmentPage.js +1 -1
- package/dist/components/Routing/withWaypointing.js +2 -2
- package/dist/components/Scope/index.js +2 -2
- package/dist/components/ScopeExtendedConfigurationLoader.js +83 -0
- package/dist/components/Treeview/Node.js +2 -2
- package/dist/components/Treeview/index.js +2 -2
- package/dist/constants.js +11 -2
- package/dist/content/icons/orckestra-icon.svg +11 -5
- package/dist/getThemeOverrides.js +2 -2
- package/dist/hocs/withToggle.js +2 -2
- package/dist/hocs/withUpdateHandler.js +2 -2
- package/dist/hooks/useEditState.js +2 -2
- package/dist/hooks/useEntityLoader.js +2 -2
- package/dist/hooks/useFullEntityEditState.js +2 -2
- package/dist/hooks/useLabelMessage.js +2 -2
- package/dist/hooks/useMultipleFieldEditState.js +2 -2
- package/dist/hooks/useNotificationRequestState.js +2 -2
- package/dist/reducers/scopesExtendedConfiguration.js +68 -0
- package/dist/selectors/metadata.js +2 -2
- package/dist/selectors/modules.js +2 -2
- package/dist/selectors/scopeExtendedConfiguration.js +56 -0
- package/dist/utils/flatten.js +2 -2
- package/dist/utils/modelValidationHelper.js +2 -2
- package/dist/utils/propertyBagHelper.js +3 -0
- package/dist/utils/stripKey.js +2 -2
- package/package.json +2 -5
- package/src/actions/requestsApi.js +511 -89
- package/src/actions/scopes.js +25 -1
- package/src/actions/scopes.test.js +34 -0
- package/src/buildStore.js +2 -0
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.js +31 -9
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.test.js +47 -6
- package/src/components/MaterialUI/Inputs/CheckboxGroup.js +5 -4
- package/src/components/MaterialUI/Inputs/CheckboxGroup.test.js +22 -0
- package/src/components/MaterialUI/Inputs/CheckboxGroupProps.js +2 -0
- package/src/components/MaterialUI/Inputs/CheckboxGroupProps.test.js +2 -2
- package/src/components/MaterialUI/Inputs/InputBase.js +8 -5
- package/src/components/MaterialUI/Inputs/InputBase.test.js +160 -110
- package/src/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +13 -6
- package/src/components/MaterialUI/Inputs/PredefinedElements/SearchControl.test.js +57 -0
- package/src/components/Provision.js +2 -0
- package/src/components/Provision.test.js +7 -0
- package/src/components/Routing/SegmentPage.js +1 -0
- package/src/components/ScopeExtendedConfigurationLoader.js +22 -0
- package/src/components/ScopeExtendedConfigurationLoader.test.js +71 -0
- package/src/constants.js +8 -0
- package/src/content/icons/orckestra-icon.svg +11 -5
- package/src/reducers/scopesExtendedConfiguration.js +16 -0
- package/src/reducers/scopesExtendedConfiguration.test.js +31 -0
- package/src/selectors/scopeExtendedConfiguration.js +9 -0
- package/src/selectors/scopeExtendedConfiguration.test.js +45 -0
- package/src/utils/propertyBagHelper.js +3 -0
- package/src/utils/propertyBagHelper.test.js +7 -0
package/src/actions/scopes.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { makeActionTypes } from "./makeApiAction";
|
|
2
2
|
import makeOrcApiAction from "./makeOrcApiAction";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
getApplicationModules,
|
|
5
|
+
getUserScopeRequest,
|
|
6
|
+
getUserScopeTreeRequest,
|
|
7
|
+
getScopeExtendedConfigurationRequest,
|
|
8
|
+
} from "./requestsApi";
|
|
4
9
|
import { overtureModule } from "../constants";
|
|
5
10
|
|
|
6
11
|
export const validateOvertureApplication = () => {
|
|
@@ -60,3 +65,22 @@ export const applicationScopeHasChanged = (previousScope, newScope, moduleName)
|
|
|
60
65
|
},
|
|
61
66
|
};
|
|
62
67
|
};
|
|
68
|
+
|
|
69
|
+
export const GET_SCOPE_EXTENDED_CONFIGURATION = "GET_SCOPE_EXTENDED_CONFIGURATION";
|
|
70
|
+
|
|
71
|
+
export const [
|
|
72
|
+
GET_SCOPE_EXTENDED_CONFIGURATION_REQUEST,
|
|
73
|
+
GET_SCOPE_EXTENDED_CONFIGURATION_SUCCESS,
|
|
74
|
+
GET_SCOPE_EXTENDED_CONFIGURATION_FAILURE,
|
|
75
|
+
] = makeActionTypes(GET_SCOPE_EXTENDED_CONFIGURATION);
|
|
76
|
+
|
|
77
|
+
export const getScopeExtendedConfiguration = scope =>
|
|
78
|
+
makeOrcApiAction(
|
|
79
|
+
GET_SCOPE_EXTENDED_CONFIGURATION,
|
|
80
|
+
getScopeExtendedConfigurationRequest.buildUrl(scope),
|
|
81
|
+
getScopeExtendedConfigurationRequest.verb,
|
|
82
|
+
{
|
|
83
|
+
bailout: false,
|
|
84
|
+
meta: { scope },
|
|
85
|
+
},
|
|
86
|
+
);
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
GET_APPLICATION_MODULES_REQUEST,
|
|
13
13
|
GET_APPLICATION_MODULES_SUCCESS,
|
|
14
14
|
GET_APPLICATION_MODULES_FAILURE,
|
|
15
|
+
getScopeExtendedConfiguration,
|
|
15
16
|
} from "./scopes";
|
|
16
17
|
|
|
17
18
|
jest.mock("../utils/buildUrl", () => {
|
|
@@ -150,3 +151,36 @@ describe("applicationScopeHasChanged", () => {
|
|
|
150
151
|
});
|
|
151
152
|
});
|
|
152
153
|
});
|
|
154
|
+
|
|
155
|
+
describe("getScopeExtendedConfiguration", () => {
|
|
156
|
+
it("creates a RSAA to fetch a scope extended configuration", () => {
|
|
157
|
+
expect(getScopeExtendedConfiguration, "when called with", ["zeScope"], "to exhaustively satisfy", {
|
|
158
|
+
[RSAA]: {
|
|
159
|
+
types: [
|
|
160
|
+
{
|
|
161
|
+
type: "GET_SCOPE_EXTENDED_CONFIGURATION_REQUEST",
|
|
162
|
+
meta: { scope: "zeScope" },
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
type: "GET_SCOPE_EXTENDED_CONFIGURATION_SUCCESS",
|
|
166
|
+
meta: { scope: "zeScope" },
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
type: "GET_SCOPE_EXTENDED_CONFIGURATION_FAILURE",
|
|
170
|
+
meta: { scope: "zeScope" },
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
endpoint: 'URL: scopes/zeScope/extendedConfiguration ""',
|
|
174
|
+
method: "GET",
|
|
175
|
+
body: undefined,
|
|
176
|
+
credentials: "include",
|
|
177
|
+
bailout: false,
|
|
178
|
+
headers: {
|
|
179
|
+
Accept: "application/json; charset=utf-8",
|
|
180
|
+
"Content-Type": "application/json",
|
|
181
|
+
},
|
|
182
|
+
options: { redirect: "follow" },
|
|
183
|
+
},
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
});
|
package/src/buildStore.js
CHANGED
|
@@ -11,6 +11,7 @@ import localeFactory, { cultureByDefault } from "./reducers/localeFactory";
|
|
|
11
11
|
import navigationReducer from "./reducers/navigation";
|
|
12
12
|
import requestReducer from "./reducers/request";
|
|
13
13
|
import scopesReducer from "./reducers/scopes";
|
|
14
|
+
import scopesExtendedConfigurationReducer from "./reducers/scopesExtendedConfiguration";
|
|
14
15
|
import settingsReducer from "./reducers/settings";
|
|
15
16
|
import toastReducer from "./reducers/toasts";
|
|
16
17
|
import viewReducer from "./reducers/view";
|
|
@@ -59,6 +60,7 @@ const buildStore = (reducers, devOptions = {}) => {
|
|
|
59
60
|
router: connectRouter(history),
|
|
60
61
|
requests: requestReducer,
|
|
61
62
|
scopes: scopesReducer,
|
|
63
|
+
scopesExtendedConfiguration: scopesExtendedConfigurationReducer,
|
|
62
64
|
settings: settingsReducer,
|
|
63
65
|
toasts: toastReducer,
|
|
64
66
|
versionInfo: versionInfoReducer,
|
|
@@ -15,11 +15,10 @@ const useStyles = makeStyles(theme => ({
|
|
|
15
15
|
color: props => (!props.error ? theme.palette.text.hint : theme.palette.error.main),
|
|
16
16
|
fontFamily: theme.typography.fontFamily,
|
|
17
17
|
marginBottom: theme.spacing(1),
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
},
|
|
18
|
+
},
|
|
19
|
+
titleRequired: {
|
|
20
|
+
paddingLeft: theme.spacing(0.5),
|
|
21
|
+
color: theme.palette.error.main,
|
|
23
22
|
},
|
|
24
23
|
value: {
|
|
25
24
|
fontSize: theme.typography.fontSize,
|
|
@@ -77,15 +76,31 @@ const InformationItemChildren = ({
|
|
|
77
76
|
return <MultipleLinesText textProps={multipleLinesTextProps} children={value} tooltipClasses={tooltipClasses} />;
|
|
78
77
|
};
|
|
79
78
|
|
|
80
|
-
const InformationItemHeader = ({ classes, label, headerIcon }) => {
|
|
79
|
+
const InformationItemHeader = ({ classes, label, headerIcon, headerIconClassName, required }) => {
|
|
81
80
|
const formattedLabel = typeof label === "object" ? <FormattedMessage {...label} /> : label;
|
|
82
|
-
const headerText =
|
|
81
|
+
const headerText =
|
|
82
|
+
(formattedLabel && (
|
|
83
|
+
<Typography
|
|
84
|
+
className={classes.title}
|
|
85
|
+
children={
|
|
86
|
+
<>
|
|
87
|
+
{formattedLabel}
|
|
88
|
+
{required && (
|
|
89
|
+
<span data-qa="required" className={classes.titleRequired}>
|
|
90
|
+
*
|
|
91
|
+
</span>
|
|
92
|
+
)}
|
|
93
|
+
</>
|
|
94
|
+
}
|
|
95
|
+
/>
|
|
96
|
+
)) ??
|
|
97
|
+
null;
|
|
83
98
|
|
|
84
99
|
if (headerIcon) {
|
|
85
100
|
return (
|
|
86
101
|
<div className={classes.headerRoot}>
|
|
87
102
|
<div className={classes.headerTextContainer}>{headerText}</div>
|
|
88
|
-
<div className={classes.headerIconContainer}>{headerIcon}</div>
|
|
103
|
+
<div className={classNames(classes.headerIconContainer, headerIconClassName)}>{headerIcon}</div>
|
|
89
104
|
</div>
|
|
90
105
|
);
|
|
91
106
|
}
|
|
@@ -99,6 +114,7 @@ const InformationItem = ({
|
|
|
99
114
|
required,
|
|
100
115
|
error,
|
|
101
116
|
headerIcon = undefined,
|
|
117
|
+
headerIconClassName = undefined,
|
|
102
118
|
showNotAvailable = false,
|
|
103
119
|
marginTop = 0,
|
|
104
120
|
isMaxLineCountEnabled,
|
|
@@ -109,7 +125,13 @@ const InformationItem = ({
|
|
|
109
125
|
|
|
110
126
|
return (
|
|
111
127
|
<div className={classes.container}>
|
|
112
|
-
<InformationItemHeader
|
|
128
|
+
<InformationItemHeader
|
|
129
|
+
classes={classes}
|
|
130
|
+
label={label}
|
|
131
|
+
required={required}
|
|
132
|
+
headerIcon={headerIcon}
|
|
133
|
+
headerIconClassName={headerIconClassName}
|
|
134
|
+
/>
|
|
113
135
|
<InformationItemChildren
|
|
114
136
|
classes={classes}
|
|
115
137
|
children={children}
|
|
@@ -237,7 +237,7 @@ describe("Information Item", () => {
|
|
|
237
237
|
|
|
238
238
|
const component = (
|
|
239
239
|
<IntlProvider locale="en" messages={{ label }}>
|
|
240
|
-
<InformationItem label={label} required={
|
|
240
|
+
<InformationItem label={label} required={false}>
|
|
241
241
|
{value}
|
|
242
242
|
</InformationItem>
|
|
243
243
|
</IntlProvider>
|
|
@@ -272,19 +272,31 @@ describe("Information Item", () => {
|
|
|
272
272
|
|
|
273
273
|
it("Renders Information Item with required", () => {
|
|
274
274
|
const label = "label";
|
|
275
|
-
const value =
|
|
275
|
+
const value = <p>Value</p>;
|
|
276
276
|
|
|
277
|
-
const component =
|
|
277
|
+
const component = (
|
|
278
278
|
<IntlProvider locale="en-US">
|
|
279
279
|
<InformationItem label={label} required={true}>
|
|
280
280
|
{value}
|
|
281
281
|
</InformationItem>
|
|
282
|
-
</IntlProvider
|
|
282
|
+
</IntlProvider>
|
|
283
283
|
);
|
|
284
284
|
|
|
285
|
-
const
|
|
285
|
+
const expected = (
|
|
286
|
+
<div>
|
|
287
|
+
<Typography
|
|
288
|
+
children={
|
|
289
|
+
<>
|
|
290
|
+
{label}
|
|
291
|
+
<span data-qa="required">*</span>
|
|
292
|
+
</>
|
|
293
|
+
}
|
|
294
|
+
/>
|
|
295
|
+
{value}
|
|
296
|
+
</div>
|
|
297
|
+
);
|
|
286
298
|
|
|
287
|
-
expect(
|
|
299
|
+
expect(component, "when mounted", "to satisfy", expected);
|
|
288
300
|
});
|
|
289
301
|
|
|
290
302
|
it("Renders Information Item properly with a header icon", () => {
|
|
@@ -315,4 +327,33 @@ describe("Information Item", () => {
|
|
|
315
327
|
|
|
316
328
|
expect(component, "when mounted", "to satisfy", expected);
|
|
317
329
|
});
|
|
330
|
+
|
|
331
|
+
it("Renders Information Item properly with a header icon and custom header icon class", () => {
|
|
332
|
+
const label = "label";
|
|
333
|
+
const value = "value";
|
|
334
|
+
|
|
335
|
+
const component = (
|
|
336
|
+
<IntlProvider locale="en-US">
|
|
337
|
+
<InformationItem label={label} headerIcon={<span>the header icon</span>} headerIconClassName="CustomClass">
|
|
338
|
+
{value}
|
|
339
|
+
</InformationItem>
|
|
340
|
+
</IntlProvider>
|
|
341
|
+
);
|
|
342
|
+
|
|
343
|
+
const expected = (
|
|
344
|
+
<div>
|
|
345
|
+
<div>
|
|
346
|
+
<div>
|
|
347
|
+
<Typography children={label} />
|
|
348
|
+
</div>
|
|
349
|
+
<div className={"CustomClass"}>
|
|
350
|
+
<span>the header icon</span>
|
|
351
|
+
</div>
|
|
352
|
+
</div>
|
|
353
|
+
<MultipleLinesText>{value}</MultipleLinesText>
|
|
354
|
+
</div>
|
|
355
|
+
);
|
|
356
|
+
|
|
357
|
+
expect(component, "when mounted", "to satisfy", expected);
|
|
358
|
+
});
|
|
318
359
|
});
|
|
@@ -12,7 +12,7 @@ const useStyles = makeStyles(theme => ({
|
|
|
12
12
|
},
|
|
13
13
|
checkBoxContainer: {
|
|
14
14
|
display: "flex",
|
|
15
|
-
flexDirection: "row",
|
|
15
|
+
flexDirection: props => (props.row ? "row" : "column"),
|
|
16
16
|
flexWrap: "wrap",
|
|
17
17
|
"& .MuiFormControlLabel-root": {
|
|
18
18
|
[theme.breakpoints.up("xs")]: {},
|
|
@@ -35,8 +35,6 @@ const useStyles = makeStyles(theme => ({
|
|
|
35
35
|
}));
|
|
36
36
|
|
|
37
37
|
const CheckboxGroup = ({ checkboxGroupProps }) => {
|
|
38
|
-
const classes = useStyles();
|
|
39
|
-
|
|
40
38
|
if (isCheckboxGroupProps(checkboxGroupProps) === false) {
|
|
41
39
|
throw new TypeError("checkboxGroupProps property is not of type CheckboxGroupProps");
|
|
42
40
|
}
|
|
@@ -48,6 +46,9 @@ const CheckboxGroup = ({ checkboxGroupProps }) => {
|
|
|
48
46
|
const readOnly = checkboxGroupProps?.get(CheckboxGroupProps.propNames.readOnly) || false;
|
|
49
47
|
const disabled = checkboxGroupProps?.get(CheckboxGroupProps.propNames.disabled) || false;
|
|
50
48
|
const options = checkboxGroupProps?.get(CheckboxGroupProps.propNames.options) ?? [];
|
|
49
|
+
const row = checkboxGroupProps.get(CheckboxGroupProps.propNames.row) ?? true;
|
|
50
|
+
|
|
51
|
+
const classes = useStyles({ row });
|
|
51
52
|
|
|
52
53
|
const handleGroupUpdate = (checked, value, newValue) => {
|
|
53
54
|
const values = value ? value.split("|") : [];
|
|
@@ -64,7 +65,7 @@ const CheckboxGroup = ({ checkboxGroupProps }) => {
|
|
|
64
65
|
|
|
65
66
|
const checkBoxGroup = (
|
|
66
67
|
<div className={classes.container}>
|
|
67
|
-
<div className={classes.checkBoxContainer}>
|
|
68
|
+
<div className={classes.checkBoxContainer} data-qa="checkboxgroup-container">
|
|
68
69
|
{options.map((option, index) => {
|
|
69
70
|
const checkboxProps = new CheckboxProps();
|
|
70
71
|
checkboxProps.set(CheckboxProps.propNames.update, checked => handleGroupUpdate(checked, value, option.value));
|
|
@@ -85,6 +85,28 @@ describe("CheckboxGroup Component", () => {
|
|
|
85
85
|
expect(component, "when mounted", "to satisfy", expected);
|
|
86
86
|
});
|
|
87
87
|
|
|
88
|
+
it("Renders CheckboxGroup component without errors and vertical orientation", () => {
|
|
89
|
+
const props = new CheckboxGroupProps();
|
|
90
|
+
const options = [
|
|
91
|
+
{ value: "option1", sortOrder: 1 },
|
|
92
|
+
{ value: "option2", sortOrder: 2 },
|
|
93
|
+
{ value: "option3", sortOrder: 3 },
|
|
94
|
+
{ value: "option3_special", sortOrder: 4 },
|
|
95
|
+
];
|
|
96
|
+
|
|
97
|
+
props.set(CheckboxGroupProps.propNames.update, update);
|
|
98
|
+
props.set(CheckboxGroupProps.propNames.value, "option1|option3_special");
|
|
99
|
+
props.set(CheckboxGroupProps.propNames.options, options);
|
|
100
|
+
props.set(CheckboxGroupProps.propNames.row, false);
|
|
101
|
+
const component = <CheckboxGroup checkboxGroupProps={props} />;
|
|
102
|
+
|
|
103
|
+
const mountedComponent = mount(component);
|
|
104
|
+
const container = mountedComponent.find("[data-qa='checkboxgroup-container']");
|
|
105
|
+
|
|
106
|
+
const styles = getComputedStyle(container.getDOMNode());
|
|
107
|
+
expect(styles.flexDirection, "to be", "column");
|
|
108
|
+
});
|
|
109
|
+
|
|
88
110
|
it("Renders CheckboxGroup component without errors when options are not specified", () => {
|
|
89
111
|
const props = new CheckboxGroupProps();
|
|
90
112
|
|
|
@@ -9,6 +9,7 @@ class CheckboxGroupProps extends ComponentProps {
|
|
|
9
9
|
readOnly: "readOnly",
|
|
10
10
|
disabled: "disabled",
|
|
11
11
|
error: "error",
|
|
12
|
+
row: "row",
|
|
12
13
|
};
|
|
13
14
|
|
|
14
15
|
constructor() {
|
|
@@ -20,6 +21,7 @@ class CheckboxGroupProps extends ComponentProps {
|
|
|
20
21
|
this.componentProps.set(this.constructor.propNames.disabled, null);
|
|
21
22
|
this.componentProps.set(this.constructor.propNames.options, null);
|
|
22
23
|
this.componentProps.set(this.constructor.propNames.error, null);
|
|
24
|
+
this.componentProps.set(this.constructor.propNames.row, null);
|
|
23
25
|
|
|
24
26
|
this._isCheckboxGroupProps = true;
|
|
25
27
|
}
|
|
@@ -2,13 +2,13 @@ import CheckboxGroupProps, { isCheckboxGroupProps } from "./CheckboxGroupProps";
|
|
|
2
2
|
|
|
3
3
|
describe("CheckboxGroup Props", () => {
|
|
4
4
|
it("Contains necessary props keys", () => {
|
|
5
|
-
const propNames = ["update", "value", "label", "readOnly", "disabled", "options", "error"];
|
|
5
|
+
const propNames = ["update", "value", "label", "readOnly", "disabled", "options", "error", "row"];
|
|
6
6
|
|
|
7
7
|
expect(CheckboxGroupProps.propNames, "to have keys", propNames);
|
|
8
8
|
});
|
|
9
9
|
|
|
10
10
|
it("Puts keys in component props map", () => {
|
|
11
|
-
const propNames = ["update", "value", "label", "readOnly", "disabled", "options", "error"];
|
|
11
|
+
const propNames = ["update", "value", "label", "readOnly", "disabled", "options", "error", "row"];
|
|
12
12
|
|
|
13
13
|
const checkboxProps = new CheckboxGroupProps();
|
|
14
14
|
|
|
@@ -146,12 +146,15 @@ const InputBase = ({ inputProps }) => {
|
|
|
146
146
|
inputAttributes.min = -2147483648;
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
+
const decimalScale = numericInputProps?.decimalScale ?? 0;
|
|
150
|
+
|
|
151
|
+
const lengthForMin = Math.trunc(inputAttributes.min).toString().length;
|
|
152
|
+
const lengthForMax = Math.trunc(inputAttributes.max).toString().length;
|
|
153
|
+
|
|
154
|
+
inputAttributes.maxLength = Math.max(lengthForMin, lengthForMax) + (decimalScale > 0 ? decimalScale + 1 : 0);
|
|
155
|
+
|
|
149
156
|
inputAttributes.isAllowed = val => {
|
|
150
|
-
return
|
|
151
|
-
val.value === "" ||
|
|
152
|
-
val.value === "-" ||
|
|
153
|
-
(val.floatValue >= inputAttributes.min && val.floatValue <= inputAttributes.max)
|
|
154
|
-
);
|
|
157
|
+
return val.value === "" || val.value === "-" || val.value !== null;
|
|
155
158
|
};
|
|
156
159
|
}
|
|
157
160
|
|
|
@@ -436,6 +436,166 @@ describe("AdvancedNumericInput", () => {
|
|
|
436
436
|
expect(advInput.props().decimalScale, "to be", 2);
|
|
437
437
|
});
|
|
438
438
|
|
|
439
|
+
it("Renders InputBase component as advanced numeric input without min max", () => {
|
|
440
|
+
const inputProps = new InputBaseProps();
|
|
441
|
+
const aLabel = "aLabel";
|
|
442
|
+
const aValue = "value";
|
|
443
|
+
|
|
444
|
+
inputProps.set(InputBaseProps.propNames.update, update);
|
|
445
|
+
inputProps.set(InputBaseProps.propNames.value, aValue);
|
|
446
|
+
inputProps.set(InputBaseProps.propNames.label, aLabel);
|
|
447
|
+
inputProps.set(InputBaseProps.propNames.type, "AdvancedNumericInput");
|
|
448
|
+
inputProps.set(InputBaseProps.propNames.numericInputProps, { decimalScale: 2 });
|
|
449
|
+
|
|
450
|
+
const component = <InputBase inputProps={inputProps} />;
|
|
451
|
+
|
|
452
|
+
const mountedComponent = mount(component);
|
|
453
|
+
|
|
454
|
+
const advInput = mountedComponent.find("AdvancedNumericInput");
|
|
455
|
+
expect(advInput.props().decimalScale, "to be", 2);
|
|
456
|
+
expect(advInput.props().min, "to be", -2147483648);
|
|
457
|
+
expect(advInput.props().max, "to be", 2147483647);
|
|
458
|
+
expect(advInput.props().maxLength, "to be", 14);
|
|
459
|
+
});
|
|
460
|
+
|
|
461
|
+
it("Renders InputBase component as advanced numeric input without min", () => {
|
|
462
|
+
const inputProps = new InputBaseProps();
|
|
463
|
+
const aLabel = "aLabel";
|
|
464
|
+
const aValue = "value";
|
|
465
|
+
|
|
466
|
+
inputProps.set(InputBaseProps.propNames.update, update);
|
|
467
|
+
inputProps.set(InputBaseProps.propNames.value, aValue);
|
|
468
|
+
inputProps.set(InputBaseProps.propNames.label, aLabel);
|
|
469
|
+
inputProps.set(InputBaseProps.propNames.type, "AdvancedNumericInput");
|
|
470
|
+
inputProps.set(InputBaseProps.propNames.numericInputProps, { decimalScale: 0 });
|
|
471
|
+
inputProps.set(InputBaseProps.propNames.inputAttributes, { max: 122 });
|
|
472
|
+
|
|
473
|
+
const component = <InputBase inputProps={inputProps} />;
|
|
474
|
+
|
|
475
|
+
const mountedComponent = mount(component);
|
|
476
|
+
|
|
477
|
+
const advInput = mountedComponent.find("AdvancedNumericInput");
|
|
478
|
+
expect(advInput.props().decimalScale, "to be", 0);
|
|
479
|
+
expect(advInput.props().min, "to be", -2147483648);
|
|
480
|
+
expect(advInput.props().max, "to be", 122);
|
|
481
|
+
expect(advInput.props().maxLength, "to be", 11);
|
|
482
|
+
});
|
|
483
|
+
|
|
484
|
+
it("Renders InputBase component as advanced numeric input without max", () => {
|
|
485
|
+
const inputProps = new InputBaseProps();
|
|
486
|
+
const aLabel = "aLabel";
|
|
487
|
+
const aValue = "value";
|
|
488
|
+
|
|
489
|
+
inputProps.set(InputBaseProps.propNames.update, update);
|
|
490
|
+
inputProps.set(InputBaseProps.propNames.value, aValue);
|
|
491
|
+
inputProps.set(InputBaseProps.propNames.label, aLabel);
|
|
492
|
+
inputProps.set(InputBaseProps.propNames.type, "AdvancedNumericInput");
|
|
493
|
+
inputProps.set(InputBaseProps.propNames.numericInputProps, { decimalScale: 2 });
|
|
494
|
+
inputProps.set(InputBaseProps.propNames.inputAttributes, { min: -9.9 });
|
|
495
|
+
|
|
496
|
+
const component = <InputBase inputProps={inputProps} />;
|
|
497
|
+
|
|
498
|
+
const mountedComponent = mount(component);
|
|
499
|
+
|
|
500
|
+
const advInput = mountedComponent.find("AdvancedNumericInput");
|
|
501
|
+
expect(advInput.props().decimalScale, "to be", 2);
|
|
502
|
+
expect(advInput.props().min, "to be", -9.9);
|
|
503
|
+
expect(advInput.props().max, "to be", 2147483647);
|
|
504
|
+
expect(advInput.props().maxLength, "to be", 13);
|
|
505
|
+
});
|
|
506
|
+
|
|
507
|
+
it("Renders InputBase component as advanced numeric input with negative min positive max", () => {
|
|
508
|
+
const inputProps = new InputBaseProps();
|
|
509
|
+
const aLabel = "aLabel";
|
|
510
|
+
const aValue = "value";
|
|
511
|
+
|
|
512
|
+
inputProps.set(InputBaseProps.propNames.update, update);
|
|
513
|
+
inputProps.set(InputBaseProps.propNames.value, aValue);
|
|
514
|
+
inputProps.set(InputBaseProps.propNames.label, aLabel);
|
|
515
|
+
inputProps.set(InputBaseProps.propNames.type, "AdvancedNumericInput");
|
|
516
|
+
inputProps.set(InputBaseProps.propNames.numericInputProps, { decimalScale: 1 });
|
|
517
|
+
inputProps.set(InputBaseProps.propNames.inputAttributes, { min: -999.9, max: 9.8 });
|
|
518
|
+
|
|
519
|
+
const component = <InputBase inputProps={inputProps} />;
|
|
520
|
+
|
|
521
|
+
const mountedComponent = mount(component);
|
|
522
|
+
|
|
523
|
+
const advInput = mountedComponent.find("AdvancedNumericInput");
|
|
524
|
+
expect(advInput.props().decimalScale, "to be", 1);
|
|
525
|
+
expect(advInput.props().min, "to be", -999.9);
|
|
526
|
+
expect(advInput.props().max, "to be", 9.8);
|
|
527
|
+
expect(advInput.props().maxLength, "to be", 6);
|
|
528
|
+
});
|
|
529
|
+
|
|
530
|
+
it("Renders InputBase component as advanced numeric input with negative min large positive max", () => {
|
|
531
|
+
const inputProps = new InputBaseProps();
|
|
532
|
+
const aLabel = "aLabel";
|
|
533
|
+
const aValue = "value";
|
|
534
|
+
|
|
535
|
+
inputProps.set(InputBaseProps.propNames.update, update);
|
|
536
|
+
inputProps.set(InputBaseProps.propNames.value, aValue);
|
|
537
|
+
inputProps.set(InputBaseProps.propNames.label, aLabel);
|
|
538
|
+
inputProps.set(InputBaseProps.propNames.type, "AdvancedNumericInput");
|
|
539
|
+
inputProps.set(InputBaseProps.propNames.numericInputProps, { decimalScale: 1 });
|
|
540
|
+
inputProps.set(InputBaseProps.propNames.inputAttributes, { min: -9.9, max: 99999.8 });
|
|
541
|
+
|
|
542
|
+
const component = <InputBase inputProps={inputProps} />;
|
|
543
|
+
|
|
544
|
+
const mountedComponent = mount(component);
|
|
545
|
+
|
|
546
|
+
const advInput = mountedComponent.find("AdvancedNumericInput");
|
|
547
|
+
expect(advInput.props().decimalScale, "to be", 1);
|
|
548
|
+
expect(advInput.props().min, "to be", -9.9);
|
|
549
|
+
expect(advInput.props().max, "to be", 99999.8);
|
|
550
|
+
expect(advInput.props().maxLength, "to be", 7);
|
|
551
|
+
});
|
|
552
|
+
|
|
553
|
+
it("Renders InputBase component as advanced numeric input with negative min negative max", () => {
|
|
554
|
+
const inputProps = new InputBaseProps();
|
|
555
|
+
const aLabel = "aLabel";
|
|
556
|
+
const aValue = "value";
|
|
557
|
+
|
|
558
|
+
inputProps.set(InputBaseProps.propNames.update, update);
|
|
559
|
+
inputProps.set(InputBaseProps.propNames.value, aValue);
|
|
560
|
+
inputProps.set(InputBaseProps.propNames.label, aLabel);
|
|
561
|
+
inputProps.set(InputBaseProps.propNames.type, "AdvancedNumericInput");
|
|
562
|
+
inputProps.set(InputBaseProps.propNames.numericInputProps, { decimalScale: 3 });
|
|
563
|
+
inputProps.set(InputBaseProps.propNames.inputAttributes, { min: -99.9, max: -9.8 });
|
|
564
|
+
|
|
565
|
+
const component = <InputBase inputProps={inputProps} />;
|
|
566
|
+
|
|
567
|
+
const mountedComponent = mount(component);
|
|
568
|
+
|
|
569
|
+
const advInput = mountedComponent.find("AdvancedNumericInput");
|
|
570
|
+
expect(advInput.props().decimalScale, "to be", 3);
|
|
571
|
+
expect(advInput.props().min, "to be", -99.9);
|
|
572
|
+
expect(advInput.props().max, "to be", -9.8);
|
|
573
|
+
expect(advInput.props().maxLength, "to be", 7);
|
|
574
|
+
});
|
|
575
|
+
|
|
576
|
+
it("Renders InputBase component as advanced numeric input with positive min positive max", () => {
|
|
577
|
+
const inputProps = new InputBaseProps();
|
|
578
|
+
const aLabel = "aLabel";
|
|
579
|
+
const aValue = "value";
|
|
580
|
+
|
|
581
|
+
inputProps.set(InputBaseProps.propNames.update, update);
|
|
582
|
+
inputProps.set(InputBaseProps.propNames.value, aValue);
|
|
583
|
+
inputProps.set(InputBaseProps.propNames.label, aLabel);
|
|
584
|
+
inputProps.set(InputBaseProps.propNames.type, "AdvancedNumericInput");
|
|
585
|
+
inputProps.set(InputBaseProps.propNames.numericInputProps, { decimalScale: 5 });
|
|
586
|
+
inputProps.set(InputBaseProps.propNames.inputAttributes, { min: 9.9, max: 99.8 });
|
|
587
|
+
|
|
588
|
+
const component = <InputBase inputProps={inputProps} />;
|
|
589
|
+
|
|
590
|
+
const mountedComponent = mount(component);
|
|
591
|
+
|
|
592
|
+
const advInput = mountedComponent.find("AdvancedNumericInput");
|
|
593
|
+
expect(advInput.props().decimalScale, "to be", 5);
|
|
594
|
+
expect(advInput.props().min, "to be", 9.9);
|
|
595
|
+
expect(advInput.props().max, "to be", 99.8);
|
|
596
|
+
expect(advInput.props().maxLength, "to be", 8);
|
|
597
|
+
});
|
|
598
|
+
|
|
439
599
|
it("Change advanced numeric input value", () => {
|
|
440
600
|
const inputProps = new InputBaseProps();
|
|
441
601
|
const aLabel = "aLabel";
|
|
@@ -686,116 +846,6 @@ describe("AdvancedNumericInput", () => {
|
|
|
686
846
|
// no idea what to assert here, this test is mostly for code coverage
|
|
687
847
|
});
|
|
688
848
|
|
|
689
|
-
it("Change advanced numeric input value with min value out of default bounds", () => {
|
|
690
|
-
const inputProps = new InputBaseProps();
|
|
691
|
-
const aLabel = "aLabel";
|
|
692
|
-
const aValue = "12.2";
|
|
693
|
-
const metadata = {
|
|
694
|
-
test: "value",
|
|
695
|
-
};
|
|
696
|
-
|
|
697
|
-
inputProps.set(InputBaseProps.propNames.update, update);
|
|
698
|
-
inputProps.set(InputBaseProps.propNames.value, aValue);
|
|
699
|
-
inputProps.set(InputBaseProps.propNames.label, aLabel);
|
|
700
|
-
inputProps.set(InputBaseProps.propNames.type, "AdvancedNumericInput");
|
|
701
|
-
inputProps.set(InputBaseProps.propNames.numericInputProps, { decimalScale: 2 });
|
|
702
|
-
inputProps.set(InputBaseProps.propNames.metadata, metadata);
|
|
703
|
-
|
|
704
|
-
const component = <InputBase inputProps={inputProps} />;
|
|
705
|
-
const mountedComponent = mount(component);
|
|
706
|
-
const input = mountedComponent.find("input");
|
|
707
|
-
input.simulate("change", { target: { value: "-3147483648", focus: noop } });
|
|
708
|
-
|
|
709
|
-
expect(update, "not to have calls satisfying", [{ args: ["-3147483648", metadata] }]);
|
|
710
|
-
|
|
711
|
-
input.simulate("change", { target: { value: "-111", focus: noop } });
|
|
712
|
-
expect(update, "to have calls satisfying", [{ args: ["-111", metadata] }]);
|
|
713
|
-
});
|
|
714
|
-
|
|
715
|
-
it("Change advanced numeric input value with min value out of specified bounds", () => {
|
|
716
|
-
const inputProps = new InputBaseProps();
|
|
717
|
-
const aLabel = "aLabel";
|
|
718
|
-
const aValue = "12.2";
|
|
719
|
-
const metadata = {
|
|
720
|
-
test: "value",
|
|
721
|
-
};
|
|
722
|
-
|
|
723
|
-
inputProps.set(InputBaseProps.propNames.update, update);
|
|
724
|
-
inputProps.set(InputBaseProps.propNames.value, aValue);
|
|
725
|
-
inputProps.set(InputBaseProps.propNames.label, aLabel);
|
|
726
|
-
inputProps.set(InputBaseProps.propNames.type, "AdvancedNumericInput");
|
|
727
|
-
inputProps.set(InputBaseProps.propNames.numericInputProps, { decimalScale: 2 });
|
|
728
|
-
inputProps.set(InputBaseProps.propNames.metadata, metadata);
|
|
729
|
-
inputProps.set(InputBaseProps.propNames.inputAttributes, {
|
|
730
|
-
min: -100,
|
|
731
|
-
});
|
|
732
|
-
|
|
733
|
-
const component = <InputBase inputProps={inputProps} />;
|
|
734
|
-
const mountedComponent = mount(component);
|
|
735
|
-
const input = mountedComponent.find("input");
|
|
736
|
-
input.simulate("change", { target: { value: "-2000", focus: noop } });
|
|
737
|
-
|
|
738
|
-
expect(update, "not to have calls satisfying", [{ args: ["-2000", metadata] }]);
|
|
739
|
-
|
|
740
|
-
input.simulate("change", { target: { value: "-11", focus: noop } });
|
|
741
|
-
expect(update, "to have calls satisfying", [{ args: ["-11", metadata] }]);
|
|
742
|
-
});
|
|
743
|
-
|
|
744
|
-
it("Change advanced numeric input value with max value out of default bounds", () => {
|
|
745
|
-
const inputProps = new InputBaseProps();
|
|
746
|
-
const aLabel = "aLabel";
|
|
747
|
-
const aValue = "12.2";
|
|
748
|
-
const metadata = {
|
|
749
|
-
test: "value",
|
|
750
|
-
};
|
|
751
|
-
|
|
752
|
-
inputProps.set(InputBaseProps.propNames.update, update);
|
|
753
|
-
inputProps.set(InputBaseProps.propNames.value, aValue);
|
|
754
|
-
inputProps.set(InputBaseProps.propNames.label, aLabel);
|
|
755
|
-
inputProps.set(InputBaseProps.propNames.type, "AdvancedNumericInput");
|
|
756
|
-
inputProps.set(InputBaseProps.propNames.numericInputProps, { decimalScale: 2 });
|
|
757
|
-
inputProps.set(InputBaseProps.propNames.metadata, metadata);
|
|
758
|
-
|
|
759
|
-
const component = <InputBase inputProps={inputProps} />;
|
|
760
|
-
const mountedComponent = mount(component);
|
|
761
|
-
const input = mountedComponent.find("input");
|
|
762
|
-
input.simulate("change", { target: { value: "3147483648", focus: noop } });
|
|
763
|
-
|
|
764
|
-
expect(update, "not to have calls satisfying", [{ args: ["3147483648", metadata] }]);
|
|
765
|
-
|
|
766
|
-
input.simulate("change", { target: { value: "111", focus: noop } });
|
|
767
|
-
expect(update, "to have calls satisfying", [{ args: ["111", metadata] }]);
|
|
768
|
-
});
|
|
769
|
-
|
|
770
|
-
it("Change advanced numeric input value with max value out of specified bounds", () => {
|
|
771
|
-
const inputProps = new InputBaseProps();
|
|
772
|
-
const aLabel = "aLabel";
|
|
773
|
-
const aValue = "12.2";
|
|
774
|
-
const metadata = {
|
|
775
|
-
test: "value",
|
|
776
|
-
};
|
|
777
|
-
|
|
778
|
-
inputProps.set(InputBaseProps.propNames.update, update);
|
|
779
|
-
inputProps.set(InputBaseProps.propNames.value, aValue);
|
|
780
|
-
inputProps.set(InputBaseProps.propNames.label, aLabel);
|
|
781
|
-
inputProps.set(InputBaseProps.propNames.type, "AdvancedNumericInput");
|
|
782
|
-
inputProps.set(InputBaseProps.propNames.numericInputProps, { decimalScale: 2 });
|
|
783
|
-
inputProps.set(InputBaseProps.propNames.metadata, metadata);
|
|
784
|
-
inputProps.set(InputBaseProps.propNames.inputAttributes, {
|
|
785
|
-
max: 100,
|
|
786
|
-
});
|
|
787
|
-
|
|
788
|
-
const component = <InputBase inputProps={inputProps} />;
|
|
789
|
-
const mountedComponent = mount(component);
|
|
790
|
-
const input = mountedComponent.find("input");
|
|
791
|
-
input.simulate("change", { target: { value: "2000", focus: noop } });
|
|
792
|
-
|
|
793
|
-
expect(update, "not to have calls satisfying", [{ args: ["2000", metadata] }]);
|
|
794
|
-
|
|
795
|
-
input.simulate("change", { target: { value: "11", focus: noop } });
|
|
796
|
-
expect(update, "to have calls satisfying", [{ args: ["11", metadata] }]);
|
|
797
|
-
});
|
|
798
|
-
|
|
799
849
|
it("Change advanced numeric input value: dash is allowed", () => {
|
|
800
850
|
const inputProps = new InputBaseProps();
|
|
801
851
|
const aLabel = "aLabel";
|