UNPKG

dareway-rui

Version:

64 lines (50 loc) 1.51 kB
'use strict'; var _interopRequireDefault = require('@babel/runtime/helpers/interopRequireDefault'); Object.defineProperty(exports, '__esModule', { value: true }); exports.default = void 0; var _TabPageView = _interopRequireDefault(require('./TabPageView')); var _Focus = require('../../Focus'); var canFocus = function canFocus(props) { var children = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; if (props.hidden) { return false; } for (var i = 0; i < children.length; i++) { if (children[i].canFocus && children[i].canFocus()) { return true; } } return false; }; var focus = function focus(props) { var children = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; var ref = arguments.length > 2 ? arguments[2] : undefined; var isActive = props.isActive, name = props.name, showTabPage = props.showTabPage; if (isActive) { return; } showTabPage(name); setTimeout(function() { for (var i = 0; i < children.length; i++) { if (children[i].canFocus && children[i].canFocus()) { children[i].focus(); break; } } }, 0); }; var _default = (0, _Focus.withFocus)( { canFocus: canFocus, focus: focus }, { autoFocus: false } )(_TabPageView.default); exports.default = _default; //@ sourceMappingURL=WrapTabPageViewWithFocus.js.map