MCPcopy
hub / github.com/apache/echarts / setSelectInputInitValue

Function setSelectInputInitValue

test/lib/testHelper.js:1322–1347  ·  view source on GitHub ↗
(inputDefine)

Source from the content-addressed store, hash-verified

1320 }
1321
1322 function setSelectInputInitValue(inputDefine) {
1323 var initOptionIdx = 0;
1324 var initOptionIdxOpt = retrieveValue(inputDefine.optionIndex, inputDefine.valueIndex, undefined);
1325 if (initOptionIdxOpt != null) {
1326 if (initOptionIdxOpt < 0 || initOptionIdxOpt >= selectCtx._optionList.length) {
1327 throw new Error(errMsgPrefix + ' Invalid optionIndex: ' + initOptionIdxOpt);
1328 }
1329 selectCtx._selectEl.value = selectCtx._optionList[initOptionIdxOpt].value;
1330 initOptionIdx = initOptionIdxOpt;
1331 }
1332 else if (inputDefine.hasOwnProperty('value')) {
1333 var found = false;
1334 for (var idx = 0; idx < selectCtx._optionList.length; idx++) {
1335 if (!selectCtx._optionList[idx].input
1336 && selectCtx._optionList[idx].value === inputDefine.value
1337 ) {
1338 found = true;
1339 initOptionIdx = idx;
1340 }
1341 }
1342 if (!found) {
1343 throw new Error(errMsgPrefix + ' Value not found in select options: ' + inputDefine.value);
1344 }
1345 }
1346 resetSelectInputOptionIndex(initOptionIdx);
1347 }
1348
1349 function resetSelectInputOptionIndex(optionIdx) {
1350 selectCtx._selectEl.value = optionIdx;

Callers 1

createSelectInputFunction · 0.85

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…