MCPcopy
hub / github.com/antvis/Infographic / renderOptions

Function renderOptions

src/editor/plugins/components/select.ts:93–113  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

91 };
92
93 const renderOptions = () => {
94 dropdown.innerHTML = '';
95 options.forEach((option) => {
96 const optionNode =
97 props.renderOption?.(option) ??
98 option.render?.() ??
99 defaultOptionNode(option);
100
101 optionNode.classList.add(OPTION_CLASS);
102 optionNode.setAttribute('data-value', option.value);
103 if (option.disabled) {
104 optionNode.setAttribute('aria-disabled', 'true');
105 optionNode.classList.add(`${OPTION_CLASS}--disabled`);
106 } else {
107 optionNode.addEventListener('click', () => {
108 selectValue(option.value, option);
109 });
110 }
111 dropdown.appendChild(optionNode);
112 });
113 };
114
115 const selectValue = (value: SelectValue, option?: SelectOption) => {
116 selected = value;

Callers 1

SelectFunction · 0.85

Calls 4

defaultOptionNodeFunction · 0.85
selectValueFunction · 0.85
forEachMethod · 0.80
renderMethod · 0.65

Tested by

no test coverage detected