iguazio.dashboard-react-controls 0.0.38 → 0.0.39
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/FormInput/FormInput.js +1 -1
- package/dist/components/FormSelect/FormSelect.js +23 -6
- package/dist/components/FormSelect/formSelect.scss +1 -1
- package/dist/components/PopUpDialog/PopUpDialog.js +13 -8
- package/dist/elements/SelectOption/SelectOption.js +6 -3
- package/package.json +1 -1
|
@@ -475,7 +475,7 @@ var FormInput = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
475
475
|
}
|
|
476
476
|
}, "".concat(item).concat(index));
|
|
477
477
|
})
|
|
478
|
-
}), !(0, _lodash.isEmpty)(validationRules) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_OptionsMenu.default, {
|
|
478
|
+
}), !(0, _lodash.isEmpty)(validationRules) && isInvalid && Array.isArray(errorsRef.current) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_OptionsMenu.default, {
|
|
479
479
|
show: showValidationRules,
|
|
480
480
|
ref: ref,
|
|
481
481
|
children: getValidationRules()
|
|
@@ -97,15 +97,22 @@ var FormSelect = function FormSelect(_ref) {
|
|
|
97
97
|
isOpen = _useState6[0],
|
|
98
98
|
setOpen = _useState6[1];
|
|
99
99
|
|
|
100
|
-
var _useState7 = (0, _react.useState)(''),
|
|
100
|
+
var _useState7 = (0, _react.useState)('bottom-right'),
|
|
101
101
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
position = _useState8[0],
|
|
103
|
+
setPosition = _useState8[1];
|
|
104
|
+
|
|
105
|
+
var _useState9 = (0, _react.useState)(''),
|
|
106
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
107
|
+
searchValue = _useState10[0],
|
|
108
|
+
setSearchValue = _useState10[1];
|
|
104
109
|
|
|
105
110
|
var selectRef = (0, _react.useRef)();
|
|
111
|
+
var popUpRef = (0, _react.useRef)();
|
|
106
112
|
|
|
107
113
|
var _ref2 = (selectRef === null || selectRef === void 0 ? void 0 : (_selectRef$current = selectRef.current) === null || _selectRef$current === void 0 ? void 0 : _selectRef$current.getBoundingClientRect()) || {},
|
|
108
|
-
|
|
114
|
+
selectWidth = _ref2.width,
|
|
115
|
+
selectLeft = _ref2.left;
|
|
109
116
|
|
|
110
117
|
var selectWrapperClassNames = (0, _classnames.default)('form-field__wrapper', "form-field__wrapper-".concat(density), disabled && 'form-field__wrapper-disabled', isOpen && 'form-field__wrapper-active', isInvalid && 'form-field__wrapper-invalid', withoutBorder && 'without-border');
|
|
111
118
|
var selectLabelClassName = (0, _classnames.default)('form-field__label', disabled && 'form-field__label-disabled');
|
|
@@ -151,6 +158,14 @@ var FormSelect = function FormSelect(_ref) {
|
|
|
151
158
|
closeMenu();
|
|
152
159
|
}
|
|
153
160
|
}, [closeMenu]);
|
|
161
|
+
(0, _react.useLayoutEffect)(function () {
|
|
162
|
+
if (popUpRef !== null && popUpRef !== void 0 && popUpRef.current) {
|
|
163
|
+
var _popUpRef$current$get = popUpRef.current.getBoundingClientRect(),
|
|
164
|
+
width = _popUpRef$current$get.width;
|
|
165
|
+
|
|
166
|
+
selectLeft + width > window.innerWidth ? setPosition('bottom-left') : setPosition('bottom-right');
|
|
167
|
+
}
|
|
168
|
+
}, [isOpen, selectLeft]);
|
|
154
169
|
(0, _react.useEffect)(function () {
|
|
155
170
|
if (isOpen) {
|
|
156
171
|
window.addEventListener('scroll', handleScroll, true);
|
|
@@ -289,12 +304,14 @@ var FormSelect = function FormSelect(_ref) {
|
|
|
289
304
|
}), isOpen && /*#__PURE__*/(0, _jsxRuntime.jsx)(_PopUpDialog.default, {
|
|
290
305
|
className: "form-field form-field-select__options-list",
|
|
291
306
|
headerIsHidden: true,
|
|
307
|
+
ref: popUpRef,
|
|
292
308
|
customPosition: {
|
|
293
309
|
element: selectRef,
|
|
294
|
-
position:
|
|
310
|
+
position: position
|
|
295
311
|
},
|
|
296
312
|
style: {
|
|
297
|
-
|
|
313
|
+
maxWidth: "".concat(selectWidth < 500 ? 500 : selectWidth, "px"),
|
|
314
|
+
minWidth: "".concat(selectWidth, "px")
|
|
298
315
|
},
|
|
299
316
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
300
317
|
"data-testid": "select-body",
|
|
@@ -47,7 +47,9 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
47
47
|
|
|
48
48
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
49
49
|
|
|
50
|
-
var PopUpDialog = function
|
|
50
|
+
var PopUpDialog = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
51
|
+
var _ref2;
|
|
52
|
+
|
|
51
53
|
var children = _ref.children,
|
|
52
54
|
className = _ref.className,
|
|
53
55
|
closePopUp = _ref.closePopUp,
|
|
@@ -57,11 +59,14 @@ var PopUpDialog = function PopUpDialog(_ref) {
|
|
|
57
59
|
style = _ref.style,
|
|
58
60
|
tooltipText = _ref.tooltipText;
|
|
59
61
|
var popUpOverlayRef = (0, _react.useRef)(null);
|
|
62
|
+
(_ref2 = ref) !== null && _ref2 !== void 0 ? _ref2 : ref = popUpOverlayRef;
|
|
60
63
|
var popUpClassNames = (0, _classnames.default)(className, 'pop-up-dialog__overlay', customPosition.element && 'custom-position');
|
|
61
64
|
var calculateCustomPopUpPosition = (0, _react.useCallback)(function () {
|
|
62
65
|
if (customPosition && customPosition.element) {
|
|
66
|
+
var _ref3;
|
|
67
|
+
|
|
63
68
|
var elementRect = customPosition.element.current.getBoundingClientRect();
|
|
64
|
-
var popUpRect =
|
|
69
|
+
var popUpRect = (_ref3 = ref) === null || _ref3 === void 0 ? void 0 : _ref3.current.getBoundingClientRect();
|
|
65
70
|
|
|
66
71
|
var _customPosition$posit = customPosition.position.split('-'),
|
|
67
72
|
_customPosition$posit2 = _slicedToArray(_customPosition$posit, 2),
|
|
@@ -77,15 +82,15 @@ var PopUpDialog = function PopUpDialog(_ref) {
|
|
|
77
82
|
topPosition = popUpRect.height + elementRect.bottom > window.innerHeight ? window.innerHeight - popUpRect.height - 5 : elementRect.bottom + 5;
|
|
78
83
|
}
|
|
79
84
|
|
|
80
|
-
|
|
85
|
+
ref.current.style.top = "".concat(topPosition, "px");
|
|
81
86
|
|
|
82
87
|
if (style.left) {
|
|
83
|
-
|
|
88
|
+
ref.current.style.left = "calc(".concat(leftPosition, "px + ").concat(style.left, ")");
|
|
84
89
|
} else {
|
|
85
|
-
|
|
90
|
+
ref.current.style.left = "".concat(leftPosition, "px");
|
|
86
91
|
}
|
|
87
92
|
}
|
|
88
|
-
}, [customPosition, style.left]);
|
|
93
|
+
}, [customPosition, style.left, ref]);
|
|
89
94
|
(0, _react.useLayoutEffect)(function () {
|
|
90
95
|
calculateCustomPopUpPosition();
|
|
91
96
|
}, [calculateCustomPopUpPosition]);
|
|
@@ -96,7 +101,7 @@ var PopUpDialog = function PopUpDialog(_ref) {
|
|
|
96
101
|
};
|
|
97
102
|
});
|
|
98
103
|
return /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
99
|
-
ref:
|
|
104
|
+
ref: ref,
|
|
100
105
|
className: popUpClassNames,
|
|
101
106
|
style: style,
|
|
102
107
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
@@ -125,7 +130,7 @@ var PopUpDialog = function PopUpDialog(_ref) {
|
|
|
125
130
|
}), children]
|
|
126
131
|
})
|
|
127
132
|
}), document.getElementById('overlay_container'));
|
|
128
|
-
};
|
|
133
|
+
});
|
|
129
134
|
|
|
130
135
|
PopUpDialog.defaultProps = {
|
|
131
136
|
className: '',
|
|
@@ -70,16 +70,19 @@ var SelectOption = function SelectOption(_ref) {
|
|
|
70
70
|
!item.disabled && _onClick(item.id);
|
|
71
71
|
},
|
|
72
72
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
73
|
-
className: "
|
|
73
|
+
className: "label-row",
|
|
74
74
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
75
|
-
className: "select__item-label",
|
|
75
|
+
className: "data-ellipsis select__item-label",
|
|
76
76
|
children: [item.icon && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
77
77
|
"data-testid": "select-icon",
|
|
78
78
|
className: "select__item-icon",
|
|
79
79
|
children: item.icon
|
|
80
80
|
}), item.status && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
81
81
|
className: "state-".concat(item.status, "-job status")
|
|
82
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
82
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Tooltip, {
|
|
83
|
+
template: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TextTooltipTemplate, {
|
|
84
|
+
text: item.label
|
|
85
|
+
}),
|
|
83
86
|
children: item.label
|
|
84
87
|
})]
|
|
85
88
|
}), withSelectedIcon && item.id === selectedId && /*#__PURE__*/(0, _jsxRuntime.jsx)(_checkmark.ReactComponent, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iguazio.dashboard-react-controls",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.39",
|
|
4
4
|
"description": "Collection of resources (such as CSS styles, fonts and images) and ReactJS 17.x components to share among different Iguazio React repos.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|