- {value}
+ {
+ isMultiSelect &&
+ value.map((key, index) => {
+ const v = valuesMap[key];
+ return (
+
+ );
+ })
+ }
+
+ {
+ !isMultiSelect && value
+ }
{
@@ -31,12 +51,15 @@ function HintedSelectInputSelectedValue(props) {
}
HintedSelectInputSelectedValue.propTypes = {
- value: PropTypes.string,
+ value: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number]))]).isRequired,
+ values: PropTypes.arrayOf(PropTypes.object).isRequired,
hint: PropTypes.string,
+ isMultiSelect: PropTypes.bool.isRequired,
includeHint: PropTypes.bool.isRequired
};
HintedSelectInputSelectedValue.defaultProps = {
+ isMultiSelect: false,
includeHint: true
};
diff --git a/frontend/src/Components/Form/ProviderFieldFormGroup.js b/frontend/src/Components/Form/ProviderFieldFormGroup.js
index d52afb4db..70fe56b20 100644
--- a/frontend/src/Components/Form/ProviderFieldFormGroup.js
+++ b/frontend/src/Components/Form/ProviderFieldFormGroup.js
@@ -6,7 +6,7 @@ import FormGroup from 'Components/Form/FormGroup';
import FormLabel from 'Components/Form/FormLabel';
import FormInputGroup from 'Components/Form/FormInputGroup';
-function getType(type) {
+function getType(type, value) {
switch (type) {
case 'captcha':
return inputTypes.CAPTCHA;
@@ -43,7 +43,8 @@ function getSelectValues(selectOptions) {
return _.reduce(selectOptions, (result, option) => {
result.push({
key: option.value,
- value: option.name
+ value: option.name,
+ hint: option.hint
});
return result;
@@ -84,7 +85,7 @@ function ProviderFieldFormGroup(props) {
{label}
GetSelectOptions(Type selectOptions)
{
- var options = from Enum e in Enum.GetValues(selectOptions)
- select new SelectOption { Value = Convert.ToInt32(e), Name = e.ToString() };
+ var options = selectOptions.GetFields().Where(v => v.IsStatic).Select(v =>
+ {
+ var name = v.Name.Replace('_', ' ');
+ var value = Convert.ToInt32(v.GetRawConstantValue());
+ var attrib = v.GetCustomAttribute();
+ if (attrib != null)
+ {
+ return new SelectOption
+ {
+ Value = value,
+ Name = attrib.Label ?? name,
+ Order = attrib.Order,
+ Hint = attrib.Hint ?? $"({value})"
+ };
+ }
+ else
+ {
+ return new SelectOption
+ {
+ Value = value,
+ Name = name,
+ Order = value,
+ Hint = $"({value})"
+ };
+ }
+ });
- return options.OrderBy(o => o.Value).ToList();
+ return options.OrderBy(o => o.Order).ToList();
}
private static Func