dtable-ui-component 6.0.118-jh.3 → 6.0.119
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.
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
8
9
|
var _react = _interopRequireDefault(require("react"));
|
|
9
10
|
var _reactSelect = _interopRequireDefault(require("react-select"));
|
|
10
11
|
var _utils = require("./utils");
|
|
@@ -28,8 +29,17 @@ class DTableSelect extends _react.default.Component {
|
|
|
28
29
|
form,
|
|
29
30
|
customFilterOption,
|
|
30
31
|
autoFocus,
|
|
31
|
-
className
|
|
32
|
+
className,
|
|
33
|
+
closeMenuOnSelect,
|
|
34
|
+
onMenuClose,
|
|
35
|
+
components: userComponents
|
|
32
36
|
} = this.props;
|
|
37
|
+
const mergedComponents = (0, _objectSpread2.default)({
|
|
38
|
+
Option: _utils.Option,
|
|
39
|
+
DropdownIndicator: _utils.DropdownIndicator,
|
|
40
|
+
MenuList: _utils.MenuList,
|
|
41
|
+
ClearIndicator: _utils.ClearIndicator
|
|
42
|
+
}, userComponents);
|
|
33
43
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSelect.default, {
|
|
34
44
|
value: value,
|
|
35
45
|
onChange: onChange,
|
|
@@ -38,12 +48,7 @@ class DTableSelect extends _react.default.Component {
|
|
|
38
48
|
className: className,
|
|
39
49
|
classNamePrefix: classNamePrefix,
|
|
40
50
|
styles: style || _utils.MenuSelectStyle,
|
|
41
|
-
components:
|
|
42
|
-
Option: _utils.Option,
|
|
43
|
-
DropdownIndicator: _utils.DropdownIndicator,
|
|
44
|
-
MenuList: _utils.MenuList,
|
|
45
|
-
ClearIndicator: _utils.ClearIndicator
|
|
46
|
-
},
|
|
51
|
+
components: mergedComponents,
|
|
47
52
|
placeholder: placeholder,
|
|
48
53
|
isSearchable: isSearchable,
|
|
49
54
|
isClearable: isClearable,
|
|
@@ -52,6 +57,8 @@ class DTableSelect extends _react.default.Component {
|
|
|
52
57
|
menuShouldScrollIntoView: true,
|
|
53
58
|
menuPortalTarget: document.querySelector(this.props.menuPortalTarget),
|
|
54
59
|
captureMenuScroll: false,
|
|
60
|
+
closeMenuOnSelect: closeMenuOnSelect,
|
|
61
|
+
onMenuClose: onMenuClose,
|
|
55
62
|
hideSelectedOptions: false,
|
|
56
63
|
noOptionsMessage: noOptionsMessage,
|
|
57
64
|
isDisabled: isDisabled,
|
|
@@ -72,6 +79,7 @@ DTableSelect.defaultProps = {
|
|
|
72
79
|
placeholder: '',
|
|
73
80
|
isMulti: false,
|
|
74
81
|
autoFocus: false,
|
|
82
|
+
closeMenuOnSelect: true,
|
|
75
83
|
menuPortalTarget: '.modal',
|
|
76
84
|
noOptionsMessage: () => {
|
|
77
85
|
return null;
|
|
@@ -22,6 +22,17 @@ const RoleStatusEditor = _ref => {
|
|
|
22
22
|
closeShowDropdownIcon
|
|
23
23
|
} = _ref;
|
|
24
24
|
const [isOpen, setIsOpen] = (0, _react.useState)(false);
|
|
25
|
+
const [menuMaxHeight, setMenuMaxHeight] = (0, _react.useState)(320);
|
|
26
|
+
const toggleRef = (0, _react.useRef)(null);
|
|
27
|
+
(0, _react.useEffect)(() => {
|
|
28
|
+
if (isOpen && toggleRef.current) {
|
|
29
|
+
const rect = toggleRef.current.getBoundingClientRect();
|
|
30
|
+
const spaceBelow = window.innerHeight - rect.bottom - 8;
|
|
31
|
+
const spaceAbove = rect.top - 8;
|
|
32
|
+
const maxAvailable = Math.max(spaceBelow, spaceAbove);
|
|
33
|
+
setMenuMaxHeight(Math.min(maxAvailable, 320));
|
|
34
|
+
}
|
|
35
|
+
}, [isOpen]);
|
|
25
36
|
const handleClickMenuOption = menuOption => {
|
|
26
37
|
const {
|
|
27
38
|
value
|
|
@@ -35,6 +46,7 @@ const RoleStatusEditor = _ref => {
|
|
|
35
46
|
className: "role-status-editor",
|
|
36
47
|
toggle: () => setIsOpen(!isOpen),
|
|
37
48
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactstrap.DropdownToggle, {
|
|
49
|
+
innerRef: toggleRef,
|
|
38
50
|
className: "dropdown-toggle-button d-flex align-items-center",
|
|
39
51
|
tag: "div",
|
|
40
52
|
children: [currentOption.label, /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
@@ -47,6 +59,10 @@ const RoleStatusEditor = _ref => {
|
|
|
47
59
|
})]
|
|
48
60
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_DTableDropdownMenu.default, {
|
|
49
61
|
className: "position-fixed",
|
|
62
|
+
style: {
|
|
63
|
+
maxHeight: menuMaxHeight,
|
|
64
|
+
overflowY: 'auto'
|
|
65
|
+
},
|
|
50
66
|
children: menuOptions.map(option => {
|
|
51
67
|
const {
|
|
52
68
|
value,
|