@redhat-cloud-services/frontend-components 3.4.9 → 3.4.13
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/ConditionalFilter/ConditionalFilter.js +6 -5
- package/ConditionalFilter/GroupFilter.js +2 -3
- package/ConditionalFilter/conditional-filter.css +1 -3
- package/ConditionalFilter/conditional-filter.scss +1 -1
- package/ConditionalFilter/groupFilterConstants.js +1 -1
- package/Inventory/InventoryLoadError.js +1 -1
- package/esm/ConditionalFilter/ConditionalFilter.js +6 -5
- package/esm/ConditionalFilter/GroupFilter.js +3 -4
- package/esm/ConditionalFilter/groupFilterConstants.js +1 -1
- package/esm/Inventory/InventoryLoadError.js +1 -1
- package/index.css +1 -3
- package/package.json +3 -3
|
@@ -148,7 +148,8 @@ var ConditionalFilter = /*#__PURE__*/function (_Component) {
|
|
|
148
148
|
placeholder = _this$props.placeholder,
|
|
149
149
|
hideLabel = _this$props.hideLabel,
|
|
150
150
|
isDisabled = _this$props.isDisabled,
|
|
151
|
-
|
|
151
|
+
useMobileLayout = _this$props.useMobileLayout,
|
|
152
|
+
props = (0, _objectWithoutProperties2["default"])(_this$props, ["items", "value", "onChange", "placeholder", "hideLabel", "isDisabled", "useMobileLayout"]);
|
|
152
153
|
var _this$state = this.state,
|
|
153
154
|
isOpen = _this$state.isOpen,
|
|
154
155
|
stateValue = _this$state.stateValue,
|
|
@@ -164,9 +165,9 @@ var ConditionalFilter = /*#__PURE__*/function (_Component) {
|
|
|
164
165
|
return string[0].toUpperCase() + string.substring(1);
|
|
165
166
|
};
|
|
166
167
|
|
|
167
|
-
var shouldRenderNewLayout =
|
|
168
|
+
var shouldRenderNewLayout = useMobileLayout && isMobile;
|
|
168
169
|
var Wrapper = this.getWrapper();
|
|
169
|
-
return /*#__PURE__*/_react["default"].createElement(Wrapper, null,
|
|
170
|
+
return /*#__PURE__*/_react["default"].createElement(Wrapper, null, useMobileLayout && isMobile && /*#__PURE__*/_react["default"].createElement(_ToolbarGroup.ToolbarGroup, {
|
|
170
171
|
className: "ins-c-conditional-filter mobile"
|
|
171
172
|
}, items.map(function (activeItem, key) {
|
|
172
173
|
var ActiveComponent = activeItem && (_conditionalFilterConstants.typeMapper[activeItem.type] || _conditionalFilterConstants.typeMapper.text);
|
|
@@ -178,7 +179,7 @@ var ConditionalFilter = /*#__PURE__*/function (_Component) {
|
|
|
178
179
|
}, activeItem.filterValues)));
|
|
179
180
|
})), !shouldRenderNewLayout && /*#__PURE__*/_react["default"].createElement(_react.Fragment, null, !items || items && items.length <= 0 ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
180
181
|
className: (0, _classnames["default"])('ins-c-conditional-filter', {
|
|
181
|
-
desktop:
|
|
182
|
+
desktop: useMobileLayout
|
|
182
183
|
})
|
|
183
184
|
}, /*#__PURE__*/_react["default"].createElement(_TextFilter["default"], (0, _extends2["default"])({}, props, {
|
|
184
185
|
value: currentValue,
|
|
@@ -189,7 +190,7 @@ var ConditionalFilter = /*#__PURE__*/function (_Component) {
|
|
|
189
190
|
"widget-type": "InsightsInput"
|
|
190
191
|
}))) : /*#__PURE__*/_react["default"].createElement(_Split.Split, {
|
|
191
192
|
className: (0, _classnames["default"])('ins-c-conditional-filter', {
|
|
192
|
-
desktop:
|
|
193
|
+
desktop: useMobileLayout
|
|
193
194
|
})
|
|
194
195
|
}, items.length > 1 && /*#__PURE__*/_react["default"].createElement(_SplitItem.SplitItem, null, /*#__PURE__*/_react["default"].createElement(_Dropdown.Dropdown, {
|
|
195
196
|
className: "ins-c-conditional-filter__group",
|
|
@@ -87,7 +87,6 @@ var Group = function Group(_ref) {
|
|
|
87
87
|
(0, _react.useEffect)(function () {
|
|
88
88
|
setStateSelected(selected);
|
|
89
89
|
}, [selected]);
|
|
90
|
-
var calculateSelection = (0, _react.useCallback)(_groupFilterConstants.calculateSelected, [stateSelected]);
|
|
91
90
|
(0, _react.useEffect)(function () {
|
|
92
91
|
setSearchString(filterBy);
|
|
93
92
|
}, [filterBy]);
|
|
@@ -127,8 +126,8 @@ var Group = function Group(_ref) {
|
|
|
127
126
|
setIsOpen(!isOpen);
|
|
128
127
|
};
|
|
129
128
|
|
|
130
|
-
var groupMenuItems = (0, _groupFilterConstants.getGroupMenuItems)(groups, onChange,
|
|
131
|
-
var menuItems = (0, _groupFilterConstants.getMenuItems)(items, onChange,
|
|
129
|
+
var groupMenuItems = (0, _groupFilterConstants.getGroupMenuItems)(groups, onChange, (0, _groupFilterConstants.calculateSelected)(selected));
|
|
130
|
+
var menuItems = (0, _groupFilterConstants.getMenuItems)(items, onChange, (0, _groupFilterConstants.calculateSelected)(selected)); // eslint-disable-next-line react/prop-types
|
|
132
131
|
|
|
133
132
|
var renderItems = function renderItems(items, type) {
|
|
134
133
|
var groupKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
@@ -51,9 +51,6 @@
|
|
|
51
51
|
.ins-c-conditional-filter .pf-c-select__toggle-badge {
|
|
52
52
|
display: none;
|
|
53
53
|
}
|
|
54
|
-
.ins-c-conditional-filter .pf-c-menu-toggle {
|
|
55
|
-
padding: 0;
|
|
56
|
-
}
|
|
57
54
|
.ins-c-conditional-filter .pf-c-menu-toggle .pf-c-menu-toggle__text {
|
|
58
55
|
flex: 1;
|
|
59
56
|
}
|
|
@@ -64,6 +61,7 @@
|
|
|
64
61
|
.pf-c-menu.ins-c-menu__scrollable {
|
|
65
62
|
max-height: 416px;
|
|
66
63
|
overflow-y: auto;
|
|
64
|
+
min-width: initial;
|
|
67
65
|
}
|
|
68
66
|
.pf-c-menu .ins-c-menu__show--more {
|
|
69
67
|
background: none;
|
|
@@ -61,7 +61,6 @@
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
.pf-c-menu-toggle {
|
|
64
|
-
padding: 0;
|
|
65
64
|
.pf-c-menu-toggle__text {
|
|
66
65
|
flex: 1;
|
|
67
66
|
input { border: none; }
|
|
@@ -73,6 +72,7 @@
|
|
|
73
72
|
&.ins-c-menu__scrollable {
|
|
74
73
|
max-height: 416px;
|
|
75
74
|
overflow-y: auto;
|
|
75
|
+
min-width: initial;
|
|
76
76
|
}
|
|
77
77
|
.ins-c-menu__show--more {
|
|
78
78
|
background: none;
|
|
@@ -106,7 +106,7 @@ exports.getGroupMenuItems = getGroupMenuItems;
|
|
|
106
106
|
|
|
107
107
|
var calculateSelected = function calculateSelected(selectedTags) {
|
|
108
108
|
return function (type, groupKey, itemKey) {
|
|
109
|
-
var activeGroup = selectedTags[groupKey];
|
|
109
|
+
var activeGroup = selectedTags === null || selectedTags === void 0 ? void 0 : selectedTags[groupKey];
|
|
110
110
|
|
|
111
111
|
if (activeGroup) {
|
|
112
112
|
if (type !== _groupType["default"].radio && (activeGroup[itemKey] instanceof Object ? activeGroup[itemKey].isSelected : Boolean(activeGroup[itemKey]))) {
|
|
@@ -23,7 +23,7 @@ var InventoryLoadError = function InventoryLoadError(_ref) {
|
|
|
23
23
|
var component = _ref.component,
|
|
24
24
|
props = (0, _objectWithoutProperties2["default"])(_ref, ["component"]);
|
|
25
25
|
(0, _react.useEffect)(function () {
|
|
26
|
-
console.error("Unable to load
|
|
26
|
+
console.error("Unable to load inventory component. Failed to load ".concat(component, "."), props);
|
|
27
27
|
}, []);
|
|
28
28
|
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("h1", null, "Unable to load inventory component"), /*#__PURE__*/_react["default"].createElement("h2", null, "Failed to load ", component), /*#__PURE__*/_react["default"].createElement("code", null, "More info can be found in browser console output."));
|
|
29
29
|
};
|
|
@@ -116,7 +116,8 @@ var ConditionalFilter = /*#__PURE__*/function (_Component) {
|
|
|
116
116
|
placeholder = _this$props.placeholder,
|
|
117
117
|
hideLabel = _this$props.hideLabel,
|
|
118
118
|
isDisabled = _this$props.isDisabled,
|
|
119
|
-
|
|
119
|
+
useMobileLayout = _this$props.useMobileLayout,
|
|
120
|
+
props = _objectWithoutProperties(_this$props, ["items", "value", "onChange", "placeholder", "hideLabel", "isDisabled", "useMobileLayout"]);
|
|
120
121
|
|
|
121
122
|
var _this$state = this.state,
|
|
122
123
|
isOpen = _this$state.isOpen,
|
|
@@ -133,9 +134,9 @@ var ConditionalFilter = /*#__PURE__*/function (_Component) {
|
|
|
133
134
|
return string[0].toUpperCase() + string.substring(1);
|
|
134
135
|
};
|
|
135
136
|
|
|
136
|
-
var shouldRenderNewLayout =
|
|
137
|
+
var shouldRenderNewLayout = useMobileLayout && isMobile;
|
|
137
138
|
var Wrapper = this.getWrapper();
|
|
138
|
-
return /*#__PURE__*/React.createElement(Wrapper, null,
|
|
139
|
+
return /*#__PURE__*/React.createElement(Wrapper, null, useMobileLayout && isMobile && /*#__PURE__*/React.createElement(ToolbarGroup, {
|
|
139
140
|
className: "ins-c-conditional-filter mobile"
|
|
140
141
|
}, items.map(function (activeItem, key) {
|
|
141
142
|
var ActiveComponent = activeItem && (typeMapper[activeItem.type] || typeMapper.text);
|
|
@@ -147,7 +148,7 @@ var ConditionalFilter = /*#__PURE__*/function (_Component) {
|
|
|
147
148
|
}, activeItem.filterValues)));
|
|
148
149
|
})), !shouldRenderNewLayout && /*#__PURE__*/React.createElement(Fragment, null, !items || items && items.length <= 0 ? /*#__PURE__*/React.createElement("div", {
|
|
149
150
|
className: classNames('ins-c-conditional-filter', {
|
|
150
|
-
desktop:
|
|
151
|
+
desktop: useMobileLayout
|
|
151
152
|
})
|
|
152
153
|
}, /*#__PURE__*/React.createElement(Text, _extends({}, props, {
|
|
153
154
|
value: currentValue,
|
|
@@ -158,7 +159,7 @@ var ConditionalFilter = /*#__PURE__*/function (_Component) {
|
|
|
158
159
|
"widget-type": "InsightsInput"
|
|
159
160
|
}))) : /*#__PURE__*/React.createElement(Split, {
|
|
160
161
|
className: classNames('ins-c-conditional-filter', {
|
|
161
|
-
desktop:
|
|
162
|
+
desktop: useMobileLayout
|
|
162
163
|
})
|
|
163
164
|
}, items.length > 1 && /*#__PURE__*/React.createElement(SplitItem, null, /*#__PURE__*/React.createElement(Dropdown, {
|
|
164
165
|
className: "ins-c-conditional-filter__group",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
-
import React, {
|
|
4
|
+
import React, { useState, useRef, useEffect } from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
7
|
import { TextInput } from "@patternfly/react-core/dist/esm/components/TextInput/TextInput.js";
|
|
@@ -54,7 +54,6 @@ var Group = function Group(_ref) {
|
|
|
54
54
|
useEffect(function () {
|
|
55
55
|
setStateSelected(selected);
|
|
56
56
|
}, [selected]);
|
|
57
|
-
var calculateSelection = useCallback(calculateSelected, [stateSelected]);
|
|
58
57
|
useEffect(function () {
|
|
59
58
|
setSearchString(filterBy);
|
|
60
59
|
}, [filterBy]);
|
|
@@ -94,8 +93,8 @@ var Group = function Group(_ref) {
|
|
|
94
93
|
setIsOpen(!isOpen);
|
|
95
94
|
};
|
|
96
95
|
|
|
97
|
-
var groupMenuItems = getGroupMenuItems(groups, onChange,
|
|
98
|
-
var menuItems = getMenuItems(items, onChange,
|
|
96
|
+
var groupMenuItems = getGroupMenuItems(groups, onChange, calculateSelected(selected));
|
|
97
|
+
var menuItems = getMenuItems(items, onChange, calculateSelected(selected)); // eslint-disable-next-line react/prop-types
|
|
99
98
|
|
|
100
99
|
var renderItems = function renderItems(items, type) {
|
|
101
100
|
var groupKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
@@ -87,7 +87,7 @@ export var getGroupMenuItems = function getGroupMenuItems(groups, onChange, calc
|
|
|
87
87
|
};
|
|
88
88
|
export var calculateSelected = function calculateSelected(selectedTags) {
|
|
89
89
|
return function (type, groupKey, itemKey) {
|
|
90
|
-
var activeGroup = selectedTags[groupKey];
|
|
90
|
+
var activeGroup = selectedTags === null || selectedTags === void 0 ? void 0 : selectedTags[groupKey];
|
|
91
91
|
|
|
92
92
|
if (activeGroup) {
|
|
93
93
|
if (type !== groupType.radio && (activeGroup[itemKey] instanceof Object ? activeGroup[itemKey].isSelected : Boolean(activeGroup[itemKey]))) {
|
|
@@ -7,7 +7,7 @@ var InventoryLoadError = function InventoryLoadError(_ref) {
|
|
|
7
7
|
props = _objectWithoutProperties(_ref, ["component"]);
|
|
8
8
|
|
|
9
9
|
useEffect(function () {
|
|
10
|
-
console.error("Unable to load
|
|
10
|
+
console.error("Unable to load inventory component. Failed to load ".concat(component, "."), props);
|
|
11
11
|
}, []);
|
|
12
12
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h1", null, "Unable to load inventory component"), /*#__PURE__*/React.createElement("h2", null, "Failed to load ", component), /*#__PURE__*/React.createElement("code", null, "More info can be found in browser console output."));
|
|
13
13
|
};
|
package/index.css
CHANGED
|
@@ -122,9 +122,6 @@ i.ins-battery svg {
|
|
|
122
122
|
.ins-c-conditional-filter .pf-c-select__toggle-badge {
|
|
123
123
|
display: none;
|
|
124
124
|
}
|
|
125
|
-
.ins-c-conditional-filter .pf-c-menu-toggle {
|
|
126
|
-
padding: 0;
|
|
127
|
-
}
|
|
128
125
|
.ins-c-conditional-filter .pf-c-menu-toggle .pf-c-menu-toggle__text {
|
|
129
126
|
flex: 1;
|
|
130
127
|
}
|
|
@@ -135,6 +132,7 @@ i.ins-battery svg {
|
|
|
135
132
|
.pf-c-menu.ins-c-menu__scrollable {
|
|
136
133
|
max-height: 416px;
|
|
137
134
|
overflow-y: auto;
|
|
135
|
+
min-width: initial;
|
|
138
136
|
}
|
|
139
137
|
.pf-c-menu .ins-c-menu__show--more {
|
|
140
138
|
background: none;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redhat-cloud-services/frontend-components",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.13",
|
|
4
4
|
"description": "Common components for RedHat Cloud Services project.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@redhat-cloud-services/frontend-components-utilities": ">=3.0.0",
|
|
45
45
|
"sanitize-html": "^2.3.2",
|
|
46
|
-
"@scalprum/core": "^0.1.
|
|
47
|
-
"@scalprum/react-core": "^0.1.
|
|
46
|
+
"@scalprum/core": "^0.1.1",
|
|
47
|
+
"@scalprum/react-core": "^0.1.7"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@patternfly/patternfly": ">=4.102.2",
|