MCPcopy Index your code
hub / github.com/apache/echarts / createInput

Function createInput

test/lib/testHelper.js:1856–1915  ·  view source on GitHub ↗
(key)

Source from the content-addressed store, hash-verified

1854 }
1855 }
1856 function createInput(key) {
1857 if (/^br[0-9]*$/i.test(key)) {
1858 // Can be typically `{br: {}, br0: {}, br1: {}, BR: {}, BR1: {}}`.
1859 return {
1860 type: 'br'
1861 };
1862 }
1863 else if (/^hr[0-9]*$/i.test(key)) {
1864 // Can be typically `{br: {}, br0: {}, br1: {}, BR: {}, BR1: {}}`.
1865 return {
1866 type: 'hr',
1867 text: _ctx[key].text
1868 };
1869 }
1870 else {
1871 var input = {
1872 type: 'select',
1873 text: _ctx[key].text || (key + ':'),
1874 onchange: function () {
1875 var newValue = this.value;
1876 if (_ctx[key].hasOwnProperty('valueIndex')) {
1877 _ctx[key].valueIndex = findValueIndex();
1878 }
1879 else if (_ctx[key].hasOwnProperty('optionIndex')) {
1880 _ctx[key].optionIndex = findValueIndex();
1881 }
1882 else {
1883 _ctx[key].value = newValue;
1884 }
1885
1886 function findValueIndex() {
1887 if (_ctx[key].values) {
1888 return arrayIndexOf(_ctx[key].values, newValue);
1889 }
1890 else if (_ctx[key].options) {
1891 for (var i = 0; i < _ctx[key].options.length; i++) {
1892 if (_ctx[key].options[i].value === newValue) {
1893 return i;
1894 }
1895 }
1896 return -1;
1897 }
1898 }
1899
1900 updateChart(_ctx[key]);
1901 }
1902 };
1903 function assignIfExisting(prop) {
1904 if (_ctx[key].hasOwnProperty(prop)) {
1905 input[prop] = _ctx[key][prop];
1906 }
1907 }
1908 assignIfExisting('value');
1909 assignIfExisting('valueIndex');
1910 assignIfExisting('optionIndex');
1911 assignIfExisting('values');
1912 assignIfExisting('options');
1913 return input;

Callers 1

testHelper.jsFile · 0.85

Calls 2

findValueIndexFunction · 0.85
assignIfExistingFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…