@rhc-shared-components/form-multi-select-component 0.0.9 → 0.1.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/FormMultiSelectInput.d.ts +2 -0
- package/dist/index.js +22 -3
- package/dist/index.modern.js +23 -4
- package/package.json +1 -2
|
@@ -3,6 +3,7 @@ import './styles.scss';
|
|
|
3
3
|
export interface IMultiSelectItem {
|
|
4
4
|
value: string;
|
|
5
5
|
description?: string;
|
|
6
|
+
extraProps?: any;
|
|
6
7
|
}
|
|
7
8
|
export interface FormMultiSelectInputProps {
|
|
8
9
|
name: string;
|
|
@@ -16,6 +17,7 @@ export interface FormMultiSelectInputProps {
|
|
|
16
17
|
isDisabled?: boolean;
|
|
17
18
|
classNames?: string;
|
|
18
19
|
menuAppendTo?: HTMLElement | (() => HTMLElement) | 'inline' | 'parent';
|
|
20
|
+
extraProps?: any;
|
|
19
21
|
}
|
|
20
22
|
declare const FormMultiSelectInput: React.FC<FormMultiSelectInputProps>;
|
|
21
23
|
export default FormMultiSelectInput;
|
package/dist/index.js
CHANGED
|
@@ -24,6 +24,24 @@ function _interopNamespace(e) {
|
|
|
24
24
|
|
|
25
25
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
26
26
|
|
|
27
|
+
function _extends() {
|
|
28
|
+
_extends = Object.assign || function (target) {
|
|
29
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
30
|
+
var source = arguments[i];
|
|
31
|
+
|
|
32
|
+
for (var key in source) {
|
|
33
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
34
|
+
target[key] = source[key];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return target;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
return _extends.apply(this, arguments);
|
|
43
|
+
}
|
|
44
|
+
|
|
27
45
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
28
46
|
if (source == null) return {};
|
|
29
47
|
var target = {};
|
|
@@ -39,7 +57,7 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
39
57
|
return target;
|
|
40
58
|
}
|
|
41
59
|
|
|
42
|
-
var _excluded = ["label", "isRequired", "children", "selectOptions", "ariaLabel", "placeholder", "helperText", "maxHeight", "isDisabled", "classNames", "menuAppendTo"];
|
|
60
|
+
var _excluded = ["label", "isRequired", "children", "selectOptions", "ariaLabel", "placeholder", "helperText", "maxHeight", "isDisabled", "classNames", "menuAppendTo", "extraProps"];
|
|
43
61
|
|
|
44
62
|
var FormMultiSelectInput = function FormMultiSelectInput(_ref) {
|
|
45
63
|
var label = _ref.label,
|
|
@@ -53,6 +71,7 @@ var FormMultiSelectInput = function FormMultiSelectInput(_ref) {
|
|
|
53
71
|
isDisabled = _ref.isDisabled,
|
|
54
72
|
classNames = _ref.classNames,
|
|
55
73
|
menuAppendTo = _ref.menuAppendTo,
|
|
74
|
+
extraProps = _ref.extraProps,
|
|
56
75
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
57
76
|
|
|
58
77
|
var _useField = formik.useField(rest),
|
|
@@ -112,14 +131,14 @@ var FormMultiSelectInput = function FormMultiSelectInput(_ref) {
|
|
|
112
131
|
className: classNames
|
|
113
132
|
}, menuAppendTo && {
|
|
114
133
|
menuAppendTo: menuAppendTo
|
|
115
|
-
}, rest), lodash.map(selectOptions, function (option, index) {
|
|
134
|
+
}, extraProps && _extends({}, extraProps), rest), lodash.map(selectOptions, function (option, index) {
|
|
116
135
|
return React__namespace.createElement(reactCore.SelectOption, Object.assign({
|
|
117
136
|
key: index,
|
|
118
137
|
value: option.value,
|
|
119
138
|
label: option.value
|
|
120
139
|
}, option.description && {
|
|
121
140
|
description: option.description
|
|
122
|
-
}));
|
|
141
|
+
}, option.extraProps && _extends({}, option.extraProps)));
|
|
123
142
|
}))));
|
|
124
143
|
};
|
|
125
144
|
|
package/dist/index.modern.js
CHANGED
|
@@ -4,6 +4,24 @@ import { ValidatedOptions, Select, SelectVariant, SelectOption } from '@patternf
|
|
|
4
4
|
import { FormGroupContainer } from '@rhc-shared-components/form-group-container';
|
|
5
5
|
import { map } from 'lodash';
|
|
6
6
|
|
|
7
|
+
function _extends() {
|
|
8
|
+
_extends = Object.assign || function (target) {
|
|
9
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
10
|
+
var source = arguments[i];
|
|
11
|
+
|
|
12
|
+
for (var key in source) {
|
|
13
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
14
|
+
target[key] = source[key];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return target;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
return _extends.apply(this, arguments);
|
|
23
|
+
}
|
|
24
|
+
|
|
7
25
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
8
26
|
if (source == null) return {};
|
|
9
27
|
var target = {};
|
|
@@ -19,7 +37,7 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
19
37
|
return target;
|
|
20
38
|
}
|
|
21
39
|
|
|
22
|
-
const _excluded = ["label", "isRequired", "children", "selectOptions", "ariaLabel", "placeholder", "helperText", "maxHeight", "isDisabled", "classNames", "menuAppendTo"];
|
|
40
|
+
const _excluded = ["label", "isRequired", "children", "selectOptions", "ariaLabel", "placeholder", "helperText", "maxHeight", "isDisabled", "classNames", "menuAppendTo", "extraProps"];
|
|
23
41
|
|
|
24
42
|
const FormMultiSelectInput = _ref => {
|
|
25
43
|
let {
|
|
@@ -32,7 +50,8 @@ const FormMultiSelectInput = _ref => {
|
|
|
32
50
|
maxHeight,
|
|
33
51
|
isDisabled,
|
|
34
52
|
classNames,
|
|
35
|
-
menuAppendTo
|
|
53
|
+
menuAppendTo,
|
|
54
|
+
extraProps
|
|
36
55
|
} = _ref,
|
|
37
56
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
38
57
|
|
|
@@ -88,13 +107,13 @@ const FormMultiSelectInput = _ref => {
|
|
|
88
107
|
className: classNames
|
|
89
108
|
}, menuAppendTo && {
|
|
90
109
|
menuAppendTo
|
|
91
|
-
}, rest), map(selectOptions, (option, index) => React.createElement(SelectOption, Object.assign({
|
|
110
|
+
}, extraProps && _extends({}, extraProps), rest), map(selectOptions, (option, index) => React.createElement(SelectOption, Object.assign({
|
|
92
111
|
key: index,
|
|
93
112
|
value: option.value,
|
|
94
113
|
label: option.value
|
|
95
114
|
}, option.description && {
|
|
96
115
|
description: option.description
|
|
97
|
-
}))))));
|
|
116
|
+
}, option.extraProps && _extends({}, option.extraProps)))))));
|
|
98
117
|
};
|
|
99
118
|
|
|
100
119
|
export { FormMultiSelectInput };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rhc-shared-components/form-multi-select-component",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "project description",
|
|
5
5
|
"author": "shkale",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
"react-dom": ">=16.13.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@rhc-shared-components/form-group-container": "^0.2.9",
|
|
34
33
|
"@testing-library/jest-dom": "^4.2.4",
|
|
35
34
|
"@testing-library/react": "^9.5.0",
|
|
36
35
|
"@testing-library/user-event": "^7.2.1",
|