MCPcopy Create free account
hub / github.com/DTStack/molecule / getSelectOption

Method getSelectOption

src/components/select/select.tsx:93–112  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

91 }
92
93 private static getSelectOption(props) {
94 let defaultSelectedOption: ISelectOptionProps = {};
95 const defaultValue = props.value || props.defaultValue;
96 const options = Children.toArray(props.children);
97 for (const option of options) {
98 if (isValidElement(option)) {
99 const optionProps = option.props as ISelectOptionProps;
100 if (optionProps.value && optionProps.value === defaultValue) {
101 defaultSelectedOption = {
102 ...optionProps,
103 name:
104 optionProps.name ||
105 (optionProps.children as string),
106 };
107 break;
108 }
109 }
110 }
111 return defaultSelectedOption;
112 }
113
114 private getDefaultState(props) {
115 return {

Callers 2

getDefaultStateMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected