wix-style-react
Version:
wix-style-react
42 lines (32 loc) • 1.29 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _InputWithOptions = require('../InputWithOptions/InputWithOptions.driver');
var _InputWithOptions2 = _interopRequireDefault(_InputWithOptions);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var multiSelectCheckboxDriverFactory = function multiSelectCheckboxDriverFactory(_ref) {
var element = _ref.element,
component = _ref.component;
var _inputWithOptionsDriv = (0, _InputWithOptions2.default)({ element: element }),
driver = _inputWithOptionsDriv.driver,
inputDriver = _inputWithOptionsDriv.inputDriver,
dropdownLayoutDriver = _inputWithOptionsDriv.dropdownLayoutDriver;
var multiSelectCheckboxDriver = Object.assign(driver, {
getNumOfLabels: function getNumOfLabels() {
return this.getLabels().length;
},
getLabels: function getLabels() {
return inputDriver.getValue().split(component.props.delimiter);
},
getLabelAt: function getLabelAt(index) {
return this.getLabels()[index];
}
});
return {
driver: multiSelectCheckboxDriver,
inputDriver: inputDriver,
dropdownLayoutDriver: dropdownLayoutDriver
};
};
exports.default = multiSelectCheckboxDriverFactory;