@widergy/energy-ui 1.125.2 → 1.126.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
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [1.126.0](https://github.com/widergy/energy-ui/compare/v1.125.2...v1.126.0) (2022-06-22)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* added UTChecklist, UTRadio and UTRating titles ([#294](https://github.com/widergy/energy-ui/issues/294)) ([39e1cf3](https://github.com/widergy/energy-ui/commit/39e1cf3f19e24ff23df4b47a48f4c91d65003155))
|
|
7
|
+
|
|
1
8
|
## [1.125.2](https://github.com/widergy/energy-ui/compare/v1.125.1...v1.125.2) (2022-06-22)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -39,6 +39,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
39
39
|
|
|
40
40
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
41
41
|
|
|
42
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
43
|
+
|
|
42
44
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
43
45
|
|
|
44
46
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -52,6 +54,8 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
|
|
|
52
54
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
53
55
|
|
|
54
56
|
var UTCheckList = function UTCheckList(_ref) {
|
|
57
|
+
var _field$configuration;
|
|
58
|
+
|
|
55
59
|
var valueKey = _ref.valueKey,
|
|
56
60
|
labelKey = _ref.labelKey,
|
|
57
61
|
input = _ref.input,
|
|
@@ -73,7 +77,11 @@ var UTCheckList = function UTCheckList(_ref) {
|
|
|
73
77
|
allChecked = _ref.allChecked,
|
|
74
78
|
getSelectAllNewValues = _ref.getSelectAllNewValues,
|
|
75
79
|
CustomCheckedIcon = _ref.CustomCheckedIcon,
|
|
76
|
-
CustomUncheckedIcon = _ref.CustomUncheckedIcon
|
|
80
|
+
CustomUncheckedIcon = _ref.CustomUncheckedIcon,
|
|
81
|
+
field = _ref.field,
|
|
82
|
+
withUpperTitle = _ref.withUpperTitle,
|
|
83
|
+
titleProps = _ref.titleProps;
|
|
84
|
+
var shouldShowUpperTitle = (field === null || field === void 0 ? void 0 : (_field$configuration = field.configuration) === null || _field$configuration === void 0 ? void 0 : _field$configuration.ignore_title) && withUpperTitle;
|
|
77
85
|
|
|
78
86
|
var handleChange = function handleChange(id) {
|
|
79
87
|
var newValues = input.value.indexOf(id) === -1 ? [].concat(_toConsumableArray(input.value), [id]) : input.value.filter(function (elem) {
|
|
@@ -112,7 +120,9 @@ var UTCheckList = function UTCheckList(_ref) {
|
|
|
112
120
|
|
|
113
121
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
114
122
|
className: "".concat(_stylesModule.default.container, " ").concat(className)
|
|
115
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
123
|
+
}, shouldShowUpperTitle && /*#__PURE__*/_react.default.createElement(_UTLabel.default, _extends({
|
|
124
|
+
className: "".concat(classes.title)
|
|
125
|
+
}, titleProps), field.title), /*#__PURE__*/_react.default.createElement("div", {
|
|
116
126
|
className: header ? classes.tableHeader : classes.selectAll
|
|
117
127
|
}, header && header.map(function (item) {
|
|
118
128
|
return /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
@@ -169,39 +179,42 @@ UTCheckList.defaultProps = {
|
|
|
169
179
|
list: []
|
|
170
180
|
};
|
|
171
181
|
UTCheckList.propTypes = {
|
|
172
|
-
disabled: _propTypes.bool,
|
|
173
|
-
valueKey: _propTypes.string.isRequired,
|
|
174
|
-
labelKey: _propTypes.string.isRequired,
|
|
175
|
-
input: (0, _propTypes.shape)({
|
|
176
|
-
onChange: _propTypes.func,
|
|
177
|
-
value: _propTypes.any
|
|
178
|
-
}),
|
|
179
182
|
additionalInfo: (0, _propTypes.shape)({
|
|
180
183
|
header: _propTypes.string,
|
|
181
184
|
footer: _propTypes.string
|
|
182
185
|
}),
|
|
183
|
-
list: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
|
|
184
|
-
id: _propTypes.number,
|
|
185
|
-
label: _propTypes.string,
|
|
186
|
-
checked: _propTypes.bool
|
|
187
|
-
})),
|
|
188
186
|
allChecked: _propTypes.bool,
|
|
189
|
-
|
|
187
|
+
classes: (0, _propTypes.objectOf)(_propTypes.string),
|
|
190
188
|
className: _propTypes.string,
|
|
191
|
-
|
|
189
|
+
classNames: (0, _propTypes.objectOf)(_propTypes.string),
|
|
190
|
+
CustomCheckedIcon: _propTypes.element,
|
|
192
191
|
customRowLabel: _propTypes.element,
|
|
193
192
|
customSelectAllRowLabel: _propTypes.element,
|
|
193
|
+
CustomUncheckedIcon: _propTypes.element,
|
|
194
|
+
disabled: _propTypes.bool,
|
|
195
|
+
field: _formTypes.fieldType,
|
|
194
196
|
getSelectAllNewValues: _propTypes.func,
|
|
195
|
-
classes: (0, _propTypes.objectOf)(_propTypes.string),
|
|
196
|
-
classNames: (0, _propTypes.objectOf)(_propTypes.string),
|
|
197
197
|
header: (0, _propTypes.shape)({
|
|
198
198
|
text: _propTypes.string
|
|
199
199
|
}),
|
|
200
200
|
headerLabel: _propTypes.string,
|
|
201
|
-
|
|
201
|
+
input: (0, _propTypes.shape)({
|
|
202
|
+
onChange: _propTypes.func,
|
|
203
|
+
value: _propTypes.any
|
|
204
|
+
}),
|
|
205
|
+
labelKey: _propTypes.string.isRequired,
|
|
206
|
+
list: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
|
|
207
|
+
id: _propTypes.number,
|
|
208
|
+
label: _propTypes.string,
|
|
209
|
+
checked: _propTypes.bool
|
|
210
|
+
})),
|
|
211
|
+
meta: _formTypes.metaPropTypes,
|
|
212
|
+
shouldShowErrors: _propTypes.bool,
|
|
213
|
+
titleProps: _propTypes.object,
|
|
202
214
|
useCustomIcons: _propTypes.bool,
|
|
203
|
-
|
|
204
|
-
|
|
215
|
+
valueKey: _propTypes.string.isRequired,
|
|
216
|
+
withCheckRow: _propTypes.bool,
|
|
217
|
+
withUpperTitle: _propTypes.bool
|
|
205
218
|
};
|
|
206
219
|
|
|
207
220
|
var _default = (0, _WithTheme.default)(_theme.retrieveStyle, _theme.retrieveMuiTheme)(UTCheckList);
|
|
@@ -21,6 +21,8 @@ var _formTypes = require("../../types/formTypes");
|
|
|
21
21
|
|
|
22
22
|
var _WithTheme = _interopRequireDefault(require("../WithTheme"));
|
|
23
23
|
|
|
24
|
+
var _UTLabel = _interopRequireDefault(require("../UTLabel"));
|
|
25
|
+
|
|
24
26
|
var _theme = require("./theme");
|
|
25
27
|
|
|
26
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -29,6 +31,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
29
31
|
|
|
30
32
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
31
33
|
|
|
34
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
35
|
+
|
|
32
36
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
33
37
|
|
|
34
38
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
@@ -115,16 +119,25 @@ var UTRadioGroup = /*#__PURE__*/function (_PureComponent) {
|
|
|
115
119
|
_createClass(UTRadioGroup, [{
|
|
116
120
|
key: "render",
|
|
117
121
|
value: function render() {
|
|
122
|
+
var _field$configuration;
|
|
123
|
+
|
|
118
124
|
var _this$props2 = this.props,
|
|
119
125
|
input = _this$props2.input,
|
|
120
126
|
options = _this$props2.options,
|
|
121
|
-
containerClassName = _this$props2.containerClassName
|
|
122
|
-
|
|
127
|
+
containerClassName = _this$props2.containerClassName,
|
|
128
|
+
field = _this$props2.field,
|
|
129
|
+
withUpperTitle = _this$props2.withUpperTitle,
|
|
130
|
+
titleProps = _this$props2.titleProps,
|
|
131
|
+
classes = _this$props2.classes;
|
|
132
|
+
var shouldShowUpperTitle = (field === null || field === void 0 ? void 0 : (_field$configuration = field.configuration) === null || _field$configuration === void 0 ? void 0 : _field$configuration.ignore_title) && withUpperTitle;
|
|
133
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, shouldShowUpperTitle && /*#__PURE__*/_react.default.createElement(_UTLabel.default, _extends({
|
|
134
|
+
className: "".concat(classes.title)
|
|
135
|
+
}, titleProps), field.title), /*#__PURE__*/_react.default.createElement(_RadioGroup.default, {
|
|
123
136
|
name: input.name,
|
|
124
137
|
value: input.value,
|
|
125
138
|
className: containerClassName,
|
|
126
139
|
onChange: this.handleChange
|
|
127
|
-
}, options.map(this.renderRadioItem));
|
|
140
|
+
}, options.map(this.renderRadioItem)));
|
|
128
141
|
}
|
|
129
142
|
}]);
|
|
130
143
|
|
|
@@ -132,23 +145,26 @@ var UTRadioGroup = /*#__PURE__*/function (_PureComponent) {
|
|
|
132
145
|
}(_react.PureComponent);
|
|
133
146
|
|
|
134
147
|
UTRadioGroup.defaultProps = {
|
|
135
|
-
|
|
148
|
+
classes: {},
|
|
136
149
|
labelKey: 'name',
|
|
137
|
-
|
|
150
|
+
valueKey: 'value'
|
|
138
151
|
};
|
|
139
152
|
UTRadioGroup.propTypes = {
|
|
140
|
-
|
|
141
|
-
options: (0, _propTypes.arrayOf)(_propTypes.object),
|
|
142
|
-
valueKey: _propTypes.string,
|
|
143
|
-
labelKey: _propTypes.string,
|
|
144
|
-
divider: _propTypes.bool,
|
|
145
|
-
disabled: _propTypes.bool,
|
|
153
|
+
classes: (0, _propTypes.objectOf)(_propTypes.string),
|
|
146
154
|
className: _propTypes.string,
|
|
155
|
+
classNames: (0, _propTypes.objectOf)(_propTypes.string),
|
|
147
156
|
containerClassName: _propTypes.string,
|
|
148
157
|
customRadioLabel: _propTypes.element,
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
158
|
+
disabled: _propTypes.bool,
|
|
159
|
+
disableRipple: _propTypes.bool,
|
|
160
|
+
divider: _propTypes.bool,
|
|
161
|
+
field: _formTypes.fieldType,
|
|
162
|
+
input: _formTypes.inputPropTypes,
|
|
163
|
+
labelKey: _propTypes.string,
|
|
164
|
+
options: (0, _propTypes.arrayOf)(_propTypes.object),
|
|
165
|
+
titleProps: _propTypes.object,
|
|
166
|
+
valueKey: _propTypes.string,
|
|
167
|
+
withUpperTitle: _propTypes.bool
|
|
152
168
|
};
|
|
153
169
|
|
|
154
170
|
var _default = (0, _WithTheme.default)(_theme.retrieveStyle, _theme.retrieveMuiTheme)(UTRadioGroup);
|
|
@@ -17,6 +17,8 @@ var _formTypes = require("../../types/formTypes");
|
|
|
17
17
|
|
|
18
18
|
var _WithTheme = _interopRequireDefault(require("../WithTheme"));
|
|
19
19
|
|
|
20
|
+
var _UTLabel = _interopRequireDefault(require("../UTLabel"));
|
|
21
|
+
|
|
20
22
|
var _theme = require("./theme");
|
|
21
23
|
|
|
22
24
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
@@ -48,10 +50,14 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
48
50
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
49
51
|
|
|
50
52
|
var UTRatingContainer = function UTRatingContainer(_ref) {
|
|
51
|
-
var
|
|
53
|
+
var _field$configuration;
|
|
54
|
+
|
|
55
|
+
var classes = _ref.classes,
|
|
52
56
|
field = _ref.field,
|
|
53
57
|
onChange = _ref.onChange,
|
|
54
|
-
|
|
58
|
+
options = _ref.options,
|
|
59
|
+
titleProps = _ref.titleProps,
|
|
60
|
+
withUpperTitle = _ref.withUpperTitle;
|
|
55
61
|
|
|
56
62
|
var _useState = (0, _react.useState)([]),
|
|
57
63
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -68,6 +74,8 @@ var UTRatingContainer = function UTRatingContainer(_ref) {
|
|
|
68
74
|
temporalSelected = _useState6[0],
|
|
69
75
|
setTemporalSelected = _useState6[1];
|
|
70
76
|
|
|
77
|
+
var shouldShowUpperTitle = (field === null || field === void 0 ? void 0 : (_field$configuration = field.configuration) === null || _field$configuration === void 0 ? void 0 : _field$configuration.ignore_title) && withUpperTitle;
|
|
78
|
+
|
|
71
79
|
var handleClick = function handleClick(order, value) {
|
|
72
80
|
setSelectedOptions((0, _array.autocompleteWithNumbers)(1, order));
|
|
73
81
|
if ((0, _array.isEmpty)(selectedOptions)) setTemporalSelected((0, _array.autocompleteWithNumbers)(1, order));
|
|
@@ -92,7 +100,7 @@ var UTRatingContainer = function UTRatingContainer(_ref) {
|
|
|
92
100
|
value: option.value,
|
|
93
101
|
order: option.order,
|
|
94
102
|
isFirst: options[0].order === option.order,
|
|
95
|
-
isLast: options.length === option.order,
|
|
103
|
+
isLast: options[options.length - 1].order === option.order,
|
|
96
104
|
textVariant: field.configuration && field.configuration.text_variant,
|
|
97
105
|
name: option.name,
|
|
98
106
|
classes: classes,
|
|
@@ -110,22 +118,29 @@ var UTRatingContainer = function UTRatingContainer(_ref) {
|
|
|
110
118
|
}, defaultProps));
|
|
111
119
|
};
|
|
112
120
|
|
|
113
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
114
|
-
className:
|
|
115
|
-
},
|
|
121
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, shouldShowUpperTitle && /*#__PURE__*/_react.default.createElement(_UTLabel.default, _extends({
|
|
122
|
+
className: "".concat(classes.title)
|
|
123
|
+
}, titleProps), field.title), /*#__PURE__*/_react.default.createElement("div", {
|
|
124
|
+
className: "".concat(_stylesModule.default.container, " ").concat(classes.container)
|
|
125
|
+
}, options.map(handleMapOptions)));
|
|
116
126
|
};
|
|
117
127
|
|
|
118
128
|
UTRatingContainer.propTypes = {
|
|
129
|
+
classes: (0, _propTypes.shape)({
|
|
130
|
+
avatar: _propTypes.string,
|
|
131
|
+
container: _propTypes.string,
|
|
132
|
+
label: _propTypes.string,
|
|
133
|
+
ratingContainer: _propTypes.string,
|
|
134
|
+
title: _propTypes.string
|
|
135
|
+
}),
|
|
136
|
+
field: _formTypes.fieldType,
|
|
137
|
+
onChange: _propTypes.func,
|
|
119
138
|
options: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
|
|
120
139
|
order: _propTypes.number,
|
|
121
140
|
value: (0, _propTypes.oneOfType)([_propTypes.number, _propTypes.string])
|
|
122
141
|
})),
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
classes: (0, _propTypes.shape)({
|
|
126
|
-
label: _propTypes.string,
|
|
127
|
-
avatar: _propTypes.string
|
|
128
|
-
})
|
|
142
|
+
titleProps: _propTypes.object,
|
|
143
|
+
withUpperTitle: _propTypes.bool
|
|
129
144
|
};
|
|
130
145
|
|
|
131
146
|
var _default = (0, _WithTheme.default)(_theme.retrieveStyle)(UTRatingContainer);
|