Edit File by line
/home/barbar84/www/wp-inclu.../js/dist
File: components.js
return;
[25500] Fix | Delete
} // get next non-disabled starting upwards from last index if that's disabled.
[25501] Fix | Delete
[25502] Fix | Delete
[25503] Fix | Delete
var newHighlightedIndex = getNextNonDisabledIndex(-1, itemCount - 1, itemCount, function (index) {
[25504] Fix | Delete
return _this5.getItemNodeFromIndex(index);
[25505] Fix | Delete
}, false);
[25506] Fix | Delete
this.setHighlightedIndex(newHighlightedIndex, {
[25507] Fix | Delete
type: keyDownEnd
[25508] Fix | Delete
});
[25509] Fix | Delete
}
[25510] Fix | Delete
});
[25511] Fix | Delete
[25512] Fix | Delete
_this.getToggleButtonProps = function (_temp3) {
[25513] Fix | Delete
var _ref3 = _temp3 === void 0 ? {} : _temp3,
[25514] Fix | Delete
onClick = _ref3.onClick;
[25515] Fix | Delete
_ref3.onPress;
[25516] Fix | Delete
var onKeyDown = _ref3.onKeyDown,
[25517] Fix | Delete
onKeyUp = _ref3.onKeyUp,
[25518] Fix | Delete
onBlur = _ref3.onBlur,
[25519] Fix | Delete
rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref3, _excluded2$3);
[25520] Fix | Delete
[25521] Fix | Delete
var _this$getState5 = _this.getState(),
[25522] Fix | Delete
isOpen = _this$getState5.isOpen;
[25523] Fix | Delete
[25524] Fix | Delete
var enabledEventHandlers = {
[25525] Fix | Delete
onClick: callAllEventHandlers(onClick, _this.buttonHandleClick),
[25526] Fix | Delete
onKeyDown: callAllEventHandlers(onKeyDown, _this.buttonHandleKeyDown),
[25527] Fix | Delete
onKeyUp: callAllEventHandlers(onKeyUp, _this.buttonHandleKeyUp),
[25528] Fix | Delete
onBlur: callAllEventHandlers(onBlur, _this.buttonHandleBlur)
[25529] Fix | Delete
};
[25530] Fix | Delete
var eventHandlers = rest.disabled ? {} : enabledEventHandlers;
[25531] Fix | Delete
return extends_extends({
[25532] Fix | Delete
type: 'button',
[25533] Fix | Delete
role: 'button',
[25534] Fix | Delete
'aria-label': isOpen ? 'close menu' : 'open menu',
[25535] Fix | Delete
'aria-haspopup': true,
[25536] Fix | Delete
'data-toggle': true
[25537] Fix | Delete
}, eventHandlers, rest);
[25538] Fix | Delete
};
[25539] Fix | Delete
[25540] Fix | Delete
_this.buttonHandleKeyUp = function (event) {
[25541] Fix | Delete
// Prevent click event from emitting in Firefox
[25542] Fix | Delete
event.preventDefault();
[25543] Fix | Delete
};
[25544] Fix | Delete
[25545] Fix | Delete
_this.buttonHandleKeyDown = function (event) {
[25546] Fix | Delete
var key = normalizeArrowKey(event);
[25547] Fix | Delete
[25548] Fix | Delete
if (_this.buttonKeyDownHandlers[key]) {
[25549] Fix | Delete
_this.buttonKeyDownHandlers[key].call(assertThisInitialized_assertThisInitialized(_this), event);
[25550] Fix | Delete
}
[25551] Fix | Delete
};
[25552] Fix | Delete
[25553] Fix | Delete
_this.buttonHandleClick = function (event) {
[25554] Fix | Delete
event.preventDefault(); // handle odd case for Safari and Firefox which
[25555] Fix | Delete
// don't give the button the focus properly.
[25556] Fix | Delete
[25557] Fix | Delete
/* istanbul ignore if (can't reasonably test this) */
[25558] Fix | Delete
[25559] Fix | Delete
if (_this.props.environment.document.activeElement === _this.props.environment.document.body) {
[25560] Fix | Delete
event.target.focus();
[25561] Fix | Delete
} // to simplify testing components that use downshift, we'll not wrap this in a setTimeout
[25562] Fix | Delete
// if the NODE_ENV is test. With the proper build system, this should be dead code eliminated
[25563] Fix | Delete
// when building for production and should therefore have no impact on production code.
[25564] Fix | Delete
[25565] Fix | Delete
[25566] Fix | Delete
if (false) {} else {
[25567] Fix | Delete
// Ensure that toggle of menu occurs after the potential blur event in iOS
[25568] Fix | Delete
_this.internalSetTimeout(function () {
[25569] Fix | Delete
return _this.toggleMenu({
[25570] Fix | Delete
type: clickButton
[25571] Fix | Delete
});
[25572] Fix | Delete
});
[25573] Fix | Delete
}
[25574] Fix | Delete
};
[25575] Fix | Delete
[25576] Fix | Delete
_this.buttonHandleBlur = function (event) {
[25577] Fix | Delete
var blurTarget = event.target; // Save blur target for comparison with activeElement later
[25578] Fix | Delete
// Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not body element
[25579] Fix | Delete
[25580] Fix | Delete
_this.internalSetTimeout(function () {
[25581] Fix | Delete
if (!_this.isMouseDown && (_this.props.environment.document.activeElement == null || _this.props.environment.document.activeElement.id !== _this.inputId) && _this.props.environment.document.activeElement !== blurTarget // Do nothing if we refocus the same element again (to solve issue in Safari on iOS)
[25582] Fix | Delete
) {
[25583] Fix | Delete
_this.reset({
[25584] Fix | Delete
type: blurButton
[25585] Fix | Delete
});
[25586] Fix | Delete
}
[25587] Fix | Delete
});
[25588] Fix | Delete
};
[25589] Fix | Delete
[25590] Fix | Delete
_this.getLabelProps = function (props) {
[25591] Fix | Delete
return extends_extends({
[25592] Fix | Delete
htmlFor: _this.inputId,
[25593] Fix | Delete
id: _this.labelId
[25594] Fix | Delete
}, props);
[25595] Fix | Delete
};
[25596] Fix | Delete
[25597] Fix | Delete
_this.getInputProps = function (_temp4) {
[25598] Fix | Delete
var _ref4 = _temp4 === void 0 ? {} : _temp4,
[25599] Fix | Delete
onKeyDown = _ref4.onKeyDown,
[25600] Fix | Delete
onBlur = _ref4.onBlur,
[25601] Fix | Delete
onChange = _ref4.onChange,
[25602] Fix | Delete
onInput = _ref4.onInput;
[25603] Fix | Delete
_ref4.onChangeText;
[25604] Fix | Delete
var rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref4, _excluded3$2);
[25605] Fix | Delete
[25606] Fix | Delete
var onChangeKey;
[25607] Fix | Delete
var eventHandlers = {};
[25608] Fix | Delete
/* istanbul ignore next (preact) */
[25609] Fix | Delete
[25610] Fix | Delete
{
[25611] Fix | Delete
onChangeKey = 'onChange';
[25612] Fix | Delete
}
[25613] Fix | Delete
[25614] Fix | Delete
var _this$getState6 = _this.getState(),
[25615] Fix | Delete
inputValue = _this$getState6.inputValue,
[25616] Fix | Delete
isOpen = _this$getState6.isOpen,
[25617] Fix | Delete
highlightedIndex = _this$getState6.highlightedIndex;
[25618] Fix | Delete
[25619] Fix | Delete
if (!rest.disabled) {
[25620] Fix | Delete
var _eventHandlers;
[25621] Fix | Delete
[25622] Fix | Delete
eventHandlers = (_eventHandlers = {}, _eventHandlers[onChangeKey] = callAllEventHandlers(onChange, onInput, _this.inputHandleChange), _eventHandlers.onKeyDown = callAllEventHandlers(onKeyDown, _this.inputHandleKeyDown), _eventHandlers.onBlur = callAllEventHandlers(onBlur, _this.inputHandleBlur), _eventHandlers);
[25623] Fix | Delete
}
[25624] Fix | Delete
[25625] Fix | Delete
return extends_extends({
[25626] Fix | Delete
'aria-autocomplete': 'list',
[25627] Fix | Delete
'aria-activedescendant': isOpen && typeof highlightedIndex === 'number' && highlightedIndex >= 0 ? _this.getItemId(highlightedIndex) : null,
[25628] Fix | Delete
'aria-controls': isOpen ? _this.menuId : null,
[25629] Fix | Delete
'aria-labelledby': _this.labelId,
[25630] Fix | Delete
// https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion
[25631] Fix | Delete
// revert back since autocomplete="nope" is ignored on latest Chrome and Opera
[25632] Fix | Delete
autoComplete: 'off',
[25633] Fix | Delete
value: inputValue,
[25634] Fix | Delete
id: _this.inputId
[25635] Fix | Delete
}, eventHandlers, rest);
[25636] Fix | Delete
};
[25637] Fix | Delete
[25638] Fix | Delete
_this.inputHandleKeyDown = function (event) {
[25639] Fix | Delete
var key = normalizeArrowKey(event);
[25640] Fix | Delete
[25641] Fix | Delete
if (key && _this.inputKeyDownHandlers[key]) {
[25642] Fix | Delete
_this.inputKeyDownHandlers[key].call(assertThisInitialized_assertThisInitialized(_this), event);
[25643] Fix | Delete
}
[25644] Fix | Delete
};
[25645] Fix | Delete
[25646] Fix | Delete
_this.inputHandleChange = function (event) {
[25647] Fix | Delete
_this.internalSetState({
[25648] Fix | Delete
type: changeInput,
[25649] Fix | Delete
isOpen: true,
[25650] Fix | Delete
inputValue: event.target.value,
[25651] Fix | Delete
highlightedIndex: _this.props.defaultHighlightedIndex
[25652] Fix | Delete
});
[25653] Fix | Delete
};
[25654] Fix | Delete
[25655] Fix | Delete
_this.inputHandleBlur = function () {
[25656] Fix | Delete
// Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not the body element
[25657] Fix | Delete
_this.internalSetTimeout(function () {
[25658] Fix | Delete
var downshiftButtonIsActive = _this.props.environment.document && !!_this.props.environment.document.activeElement && !!_this.props.environment.document.activeElement.dataset && _this.props.environment.document.activeElement.dataset.toggle && _this._rootNode && _this._rootNode.contains(_this.props.environment.document.activeElement);
[25659] Fix | Delete
[25660] Fix | Delete
if (!_this.isMouseDown && !downshiftButtonIsActive) {
[25661] Fix | Delete
_this.reset({
[25662] Fix | Delete
type: blurInput
[25663] Fix | Delete
});
[25664] Fix | Delete
}
[25665] Fix | Delete
});
[25666] Fix | Delete
};
[25667] Fix | Delete
[25668] Fix | Delete
_this.menuRef = function (node) {
[25669] Fix | Delete
_this._menuNode = node;
[25670] Fix | Delete
};
[25671] Fix | Delete
[25672] Fix | Delete
_this.getMenuProps = function (_temp5, _temp6) {
[25673] Fix | Delete
var _extends3;
[25674] Fix | Delete
[25675] Fix | Delete
var _ref5 = _temp5 === void 0 ? {} : _temp5,
[25676] Fix | Delete
_ref5$refKey = _ref5.refKey,
[25677] Fix | Delete
refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,
[25678] Fix | Delete
ref = _ref5.ref,
[25679] Fix | Delete
props = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref5, _excluded4$1);
[25680] Fix | Delete
[25681] Fix | Delete
var _ref6 = _temp6 === void 0 ? {} : _temp6,
[25682] Fix | Delete
_ref6$suppressRefErro = _ref6.suppressRefError,
[25683] Fix | Delete
suppressRefError = _ref6$suppressRefErro === void 0 ? false : _ref6$suppressRefErro;
[25684] Fix | Delete
[25685] Fix | Delete
_this.getMenuProps.called = true;
[25686] Fix | Delete
_this.getMenuProps.refKey = refKey;
[25687] Fix | Delete
_this.getMenuProps.suppressRefError = suppressRefError;
[25688] Fix | Delete
return extends_extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, _this.menuRef), _extends3.role = 'listbox', _extends3['aria-labelledby'] = props && props['aria-label'] ? null : _this.labelId, _extends3.id = _this.menuId, _extends3), props);
[25689] Fix | Delete
};
[25690] Fix | Delete
[25691] Fix | Delete
_this.getItemProps = function (_temp7) {
[25692] Fix | Delete
var _enabledEventHandlers;
[25693] Fix | Delete
[25694] Fix | Delete
var _ref7 = _temp7 === void 0 ? {} : _temp7,
[25695] Fix | Delete
onMouseMove = _ref7.onMouseMove,
[25696] Fix | Delete
onMouseDown = _ref7.onMouseDown,
[25697] Fix | Delete
onClick = _ref7.onClick;
[25698] Fix | Delete
_ref7.onPress;
[25699] Fix | Delete
var index = _ref7.index,
[25700] Fix | Delete
_ref7$item = _ref7.item,
[25701] Fix | Delete
item = _ref7$item === void 0 ? true ?
[25702] Fix | Delete
/* istanbul ignore next */
[25703] Fix | Delete
undefined : undefined : _ref7$item,
[25704] Fix | Delete
rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref7, _excluded5$1);
[25705] Fix | Delete
[25706] Fix | Delete
if (index === undefined) {
[25707] Fix | Delete
_this.items.push(item);
[25708] Fix | Delete
[25709] Fix | Delete
index = _this.items.indexOf(item);
[25710] Fix | Delete
} else {
[25711] Fix | Delete
_this.items[index] = item;
[25712] Fix | Delete
}
[25713] Fix | Delete
[25714] Fix | Delete
var onSelectKey = 'onClick';
[25715] Fix | Delete
var customClickHandler = onClick;
[25716] Fix | Delete
var enabledEventHandlers = (_enabledEventHandlers = {
[25717] Fix | Delete
// onMouseMove is used over onMouseEnter here. onMouseMove
[25718] Fix | Delete
// is only triggered on actual mouse movement while onMouseEnter
[25719] Fix | Delete
// can fire on DOM changes, interrupting keyboard navigation
[25720] Fix | Delete
onMouseMove: callAllEventHandlers(onMouseMove, function () {
[25721] Fix | Delete
if (index === _this.getState().highlightedIndex) {
[25722] Fix | Delete
return;
[25723] Fix | Delete
}
[25724] Fix | Delete
[25725] Fix | Delete
_this.setHighlightedIndex(index, {
[25726] Fix | Delete
type: itemMouseEnter
[25727] Fix | Delete
}); // We never want to manually scroll when changing state based
[25728] Fix | Delete
// on `onMouseMove` because we will be moving the element out
[25729] Fix | Delete
// from under the user which is currently scrolling/moving the
[25730] Fix | Delete
// cursor
[25731] Fix | Delete
[25732] Fix | Delete
[25733] Fix | Delete
_this.avoidScrolling = true;
[25734] Fix | Delete
[25735] Fix | Delete
_this.internalSetTimeout(function () {
[25736] Fix | Delete
return _this.avoidScrolling = false;
[25737] Fix | Delete
}, 250);
[25738] Fix | Delete
}),
[25739] Fix | Delete
onMouseDown: callAllEventHandlers(onMouseDown, function (event) {
[25740] Fix | Delete
// This prevents the activeElement from being changed
[25741] Fix | Delete
// to the item so it can remain with the current activeElement
[25742] Fix | Delete
// which is a more common use case.
[25743] Fix | Delete
event.preventDefault();
[25744] Fix | Delete
})
[25745] Fix | Delete
}, _enabledEventHandlers[onSelectKey] = callAllEventHandlers(customClickHandler, function () {
[25746] Fix | Delete
_this.selectItemAtIndex(index, {
[25747] Fix | Delete
type: clickItem
[25748] Fix | Delete
});
[25749] Fix | Delete
}), _enabledEventHandlers); // Passing down the onMouseDown handler to prevent redirect
[25750] Fix | Delete
// of the activeElement if clicking on disabled items
[25751] Fix | Delete
[25752] Fix | Delete
var eventHandlers = rest.disabled ? {
[25753] Fix | Delete
onMouseDown: enabledEventHandlers.onMouseDown
[25754] Fix | Delete
} : enabledEventHandlers;
[25755] Fix | Delete
return extends_extends({
[25756] Fix | Delete
id: _this.getItemId(index),
[25757] Fix | Delete
role: 'option',
[25758] Fix | Delete
'aria-selected': _this.getState().highlightedIndex === index
[25759] Fix | Delete
}, eventHandlers, rest);
[25760] Fix | Delete
};
[25761] Fix | Delete
[25762] Fix | Delete
_this.clearItems = function () {
[25763] Fix | Delete
_this.items = [];
[25764] Fix | Delete
};
[25765] Fix | Delete
[25766] Fix | Delete
_this.reset = function (otherStateToSet, cb) {
[25767] Fix | Delete
if (otherStateToSet === void 0) {
[25768] Fix | Delete
otherStateToSet = {};
[25769] Fix | Delete
}
[25770] Fix | Delete
[25771] Fix | Delete
otherStateToSet = pickState(otherStateToSet);
[25772] Fix | Delete
[25773] Fix | Delete
_this.internalSetState(function (_ref8) {
[25774] Fix | Delete
var selectedItem = _ref8.selectedItem;
[25775] Fix | Delete
return extends_extends({
[25776] Fix | Delete
isOpen: _this.props.defaultIsOpen,
[25777] Fix | Delete
highlightedIndex: _this.props.defaultHighlightedIndex,
[25778] Fix | Delete
inputValue: _this.props.itemToString(selectedItem)
[25779] Fix | Delete
}, otherStateToSet);
[25780] Fix | Delete
}, cb);
[25781] Fix | Delete
};
[25782] Fix | Delete
[25783] Fix | Delete
_this.toggleMenu = function (otherStateToSet, cb) {
[25784] Fix | Delete
if (otherStateToSet === void 0) {
[25785] Fix | Delete
otherStateToSet = {};
[25786] Fix | Delete
}
[25787] Fix | Delete
[25788] Fix | Delete
otherStateToSet = pickState(otherStateToSet);
[25789] Fix | Delete
[25790] Fix | Delete
_this.internalSetState(function (_ref9) {
[25791] Fix | Delete
var isOpen = _ref9.isOpen;
[25792] Fix | Delete
return extends_extends({
[25793] Fix | Delete
isOpen: !isOpen
[25794] Fix | Delete
}, isOpen && {
[25795] Fix | Delete
highlightedIndex: _this.props.defaultHighlightedIndex
[25796] Fix | Delete
}, otherStateToSet);
[25797] Fix | Delete
}, function () {
[25798] Fix | Delete
var _this$getState7 = _this.getState(),
[25799] Fix | Delete
isOpen = _this$getState7.isOpen,
[25800] Fix | Delete
highlightedIndex = _this$getState7.highlightedIndex;
[25801] Fix | Delete
[25802] Fix | Delete
if (isOpen) {
[25803] Fix | Delete
if (_this.getItemCount() > 0 && typeof highlightedIndex === 'number') {
[25804] Fix | Delete
_this.setHighlightedIndex(highlightedIndex, otherStateToSet);
[25805] Fix | Delete
}
[25806] Fix | Delete
}
[25807] Fix | Delete
[25808] Fix | Delete
cbToCb(cb)();
[25809] Fix | Delete
});
[25810] Fix | Delete
};
[25811] Fix | Delete
[25812] Fix | Delete
_this.openMenu = function (cb) {
[25813] Fix | Delete
_this.internalSetState({
[25814] Fix | Delete
isOpen: true
[25815] Fix | Delete
}, cb);
[25816] Fix | Delete
};
[25817] Fix | Delete
[25818] Fix | Delete
_this.closeMenu = function (cb) {
[25819] Fix | Delete
_this.internalSetState({
[25820] Fix | Delete
isOpen: false
[25821] Fix | Delete
}, cb);
[25822] Fix | Delete
};
[25823] Fix | Delete
[25824] Fix | Delete
_this.updateStatus = debounce(function () {
[25825] Fix | Delete
var state = _this.getState();
[25826] Fix | Delete
[25827] Fix | Delete
var item = _this.items[state.highlightedIndex];
[25828] Fix | Delete
[25829] Fix | Delete
var resultCount = _this.getItemCount();
[25830] Fix | Delete
[25831] Fix | Delete
var status = _this.props.getA11yStatusMessage(extends_extends({
[25832] Fix | Delete
itemToString: _this.props.itemToString,
[25833] Fix | Delete
previousResultCount: _this.previousResultCount,
[25834] Fix | Delete
resultCount: resultCount,
[25835] Fix | Delete
highlightedItem: item
[25836] Fix | Delete
}, state));
[25837] Fix | Delete
[25838] Fix | Delete
_this.previousResultCount = resultCount;
[25839] Fix | Delete
setStatus(status, _this.props.environment.document);
[25840] Fix | Delete
}, 200);
[25841] Fix | Delete
[25842] Fix | Delete
var _this$props = _this.props,
[25843] Fix | Delete
defaultHighlightedIndex = _this$props.defaultHighlightedIndex,
[25844] Fix | Delete
_this$props$initialHi = _this$props.initialHighlightedIndex,
[25845] Fix | Delete
_highlightedIndex = _this$props$initialHi === void 0 ? defaultHighlightedIndex : _this$props$initialHi,
[25846] Fix | Delete
defaultIsOpen = _this$props.defaultIsOpen,
[25847] Fix | Delete
_this$props$initialIs = _this$props.initialIsOpen,
[25848] Fix | Delete
_isOpen = _this$props$initialIs === void 0 ? defaultIsOpen : _this$props$initialIs,
[25849] Fix | Delete
_this$props$initialIn = _this$props.initialInputValue,
[25850] Fix | Delete
_inputValue = _this$props$initialIn === void 0 ? '' : _this$props$initialIn,
[25851] Fix | Delete
_this$props$initialSe = _this$props.initialSelectedItem,
[25852] Fix | Delete
_selectedItem = _this$props$initialSe === void 0 ? null : _this$props$initialSe;
[25853] Fix | Delete
[25854] Fix | Delete
var _state = _this.getState({
[25855] Fix | Delete
highlightedIndex: _highlightedIndex,
[25856] Fix | Delete
isOpen: _isOpen,
[25857] Fix | Delete
inputValue: _inputValue,
[25858] Fix | Delete
selectedItem: _selectedItem
[25859] Fix | Delete
});
[25860] Fix | Delete
[25861] Fix | Delete
if (_state.selectedItem != null && _this.props.initialInputValue === undefined) {
[25862] Fix | Delete
_state.inputValue = _this.props.itemToString(_state.selectedItem);
[25863] Fix | Delete
}
[25864] Fix | Delete
[25865] Fix | Delete
_this.state = _state;
[25866] Fix | Delete
return _this;
[25867] Fix | Delete
}
[25868] Fix | Delete
[25869] Fix | Delete
var _proto = Downshift.prototype;
[25870] Fix | Delete
[25871] Fix | Delete
/**
[25872] Fix | Delete
* Clear all running timeouts
[25873] Fix | Delete
*/
[25874] Fix | Delete
_proto.internalClearTimeouts = function internalClearTimeouts() {
[25875] Fix | Delete
this.timeoutIds.forEach(function (id) {
[25876] Fix | Delete
clearTimeout(id);
[25877] Fix | Delete
});
[25878] Fix | Delete
this.timeoutIds = [];
[25879] Fix | Delete
}
[25880] Fix | Delete
/**
[25881] Fix | Delete
* Gets the state based on internal state or props
[25882] Fix | Delete
* If a state value is passed via props, then that
[25883] Fix | Delete
* is the value given, otherwise it's retrieved from
[25884] Fix | Delete
* stateToMerge
[25885] Fix | Delete
*
[25886] Fix | Delete
* @param {Object} stateToMerge defaults to this.state
[25887] Fix | Delete
* @return {Object} the state
[25888] Fix | Delete
*/
[25889] Fix | Delete
;
[25890] Fix | Delete
[25891] Fix | Delete
_proto.getState = function getState$1(stateToMerge) {
[25892] Fix | Delete
if (stateToMerge === void 0) {
[25893] Fix | Delete
stateToMerge = this.state;
[25894] Fix | Delete
}
[25895] Fix | Delete
[25896] Fix | Delete
return getState(stateToMerge, this.props);
[25897] Fix | Delete
};
[25898] Fix | Delete
[25899] Fix | Delete
_proto.getItemCount = function getItemCount() {
[25900] Fix | Delete
// things read better this way. They're in priority order:
[25901] Fix | Delete
// 1. `this.itemCount`
[25902] Fix | Delete
// 2. `this.props.itemCount`
[25903] Fix | Delete
// 3. `this.items.length`
[25904] Fix | Delete
var itemCount = this.items.length;
[25905] Fix | Delete
[25906] Fix | Delete
if (this.itemCount != null) {
[25907] Fix | Delete
itemCount = this.itemCount;
[25908] Fix | Delete
} else if (this.props.itemCount !== undefined) {
[25909] Fix | Delete
itemCount = this.props.itemCount;
[25910] Fix | Delete
}
[25911] Fix | Delete
[25912] Fix | Delete
return itemCount;
[25913] Fix | Delete
};
[25914] Fix | Delete
[25915] Fix | Delete
_proto.getItemNodeFromIndex = function getItemNodeFromIndex(index) {
[25916] Fix | Delete
return this.props.environment.document.getElementById(this.getItemId(index));
[25917] Fix | Delete
};
[25918] Fix | Delete
[25919] Fix | Delete
_proto.scrollHighlightedItemIntoView = function scrollHighlightedItemIntoView() {
[25920] Fix | Delete
/* istanbul ignore else (react-native) */
[25921] Fix | Delete
{
[25922] Fix | Delete
var node = this.getItemNodeFromIndex(this.getState().highlightedIndex);
[25923] Fix | Delete
this.props.scrollIntoView(node, this._menuNode);
[25924] Fix | Delete
}
[25925] Fix | Delete
};
[25926] Fix | Delete
[25927] Fix | Delete
_proto.moveHighlightedIndex = function moveHighlightedIndex(amount, otherStateToSet) {
[25928] Fix | Delete
var _this6 = this;
[25929] Fix | Delete
[25930] Fix | Delete
var itemCount = this.getItemCount();
[25931] Fix | Delete
[25932] Fix | Delete
var _this$getState8 = this.getState(),
[25933] Fix | Delete
highlightedIndex = _this$getState8.highlightedIndex;
[25934] Fix | Delete
[25935] Fix | Delete
if (itemCount > 0) {
[25936] Fix | Delete
var nextHighlightedIndex = getNextWrappingIndex(amount, highlightedIndex, itemCount, function (index) {
[25937] Fix | Delete
return _this6.getItemNodeFromIndex(index);
[25938] Fix | Delete
});
[25939] Fix | Delete
this.setHighlightedIndex(nextHighlightedIndex, otherStateToSet);
[25940] Fix | Delete
}
[25941] Fix | Delete
};
[25942] Fix | Delete
[25943] Fix | Delete
_proto.getStateAndHelpers = function getStateAndHelpers() {
[25944] Fix | Delete
var _this$getState9 = this.getState(),
[25945] Fix | Delete
highlightedIndex = _this$getState9.highlightedIndex,
[25946] Fix | Delete
inputValue = _this$getState9.inputValue,
[25947] Fix | Delete
selectedItem = _this$getState9.selectedItem,
[25948] Fix | Delete
isOpen = _this$getState9.isOpen;
[25949] Fix | Delete
[25950] Fix | Delete
var itemToString = this.props.itemToString;
[25951] Fix | Delete
var id = this.id;
[25952] Fix | Delete
var getRootProps = this.getRootProps,
[25953] Fix | Delete
getToggleButtonProps = this.getToggleButtonProps,
[25954] Fix | Delete
getLabelProps = this.getLabelProps,
[25955] Fix | Delete
getMenuProps = this.getMenuProps,
[25956] Fix | Delete
getInputProps = this.getInputProps,
[25957] Fix | Delete
getItemProps = this.getItemProps,
[25958] Fix | Delete
openMenu = this.openMenu,
[25959] Fix | Delete
closeMenu = this.closeMenu,
[25960] Fix | Delete
toggleMenu = this.toggleMenu,
[25961] Fix | Delete
selectItem = this.selectItem,
[25962] Fix | Delete
selectItemAtIndex = this.selectItemAtIndex,
[25963] Fix | Delete
selectHighlightedItem = this.selectHighlightedItem,
[25964] Fix | Delete
setHighlightedIndex = this.setHighlightedIndex,
[25965] Fix | Delete
clearSelection = this.clearSelection,
[25966] Fix | Delete
clearItems = this.clearItems,
[25967] Fix | Delete
reset = this.reset,
[25968] Fix | Delete
setItemCount = this.setItemCount,
[25969] Fix | Delete
unsetItemCount = this.unsetItemCount,
[25970] Fix | Delete
setState = this.internalSetState;
[25971] Fix | Delete
return {
[25972] Fix | Delete
// prop getters
[25973] Fix | Delete
getRootProps: getRootProps,
[25974] Fix | Delete
getToggleButtonProps: getToggleButtonProps,
[25975] Fix | Delete
getLabelProps: getLabelProps,
[25976] Fix | Delete
getMenuProps: getMenuProps,
[25977] Fix | Delete
getInputProps: getInputProps,
[25978] Fix | Delete
getItemProps: getItemProps,
[25979] Fix | Delete
// actions
[25980] Fix | Delete
reset: reset,
[25981] Fix | Delete
openMenu: openMenu,
[25982] Fix | Delete
closeMenu: closeMenu,
[25983] Fix | Delete
toggleMenu: toggleMenu,
[25984] Fix | Delete
selectItem: selectItem,
[25985] Fix | Delete
selectItemAtIndex: selectItemAtIndex,
[25986] Fix | Delete
selectHighlightedItem: selectHighlightedItem,
[25987] Fix | Delete
setHighlightedIndex: setHighlightedIndex,
[25988] Fix | Delete
clearSelection: clearSelection,
[25989] Fix | Delete
clearItems: clearItems,
[25990] Fix | Delete
setItemCount: setItemCount,
[25991] Fix | Delete
unsetItemCount: unsetItemCount,
[25992] Fix | Delete
setState: setState,
[25993] Fix | Delete
// props
[25994] Fix | Delete
itemToString: itemToString,
[25995] Fix | Delete
// derived
[25996] Fix | Delete
id: id,
[25997] Fix | Delete
// state
[25998] Fix | Delete
highlightedIndex: highlightedIndex,
[25999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function