UNPKG

@ozen-ui/kit

Version:

React component library

15 lines (14 loc) 1.13 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.defaultGetOptionDisabled = exports.defaultGetOptionLabel = exports.defaultGetOptionKey = void 0; exports.withDefaultGetters = withDefaultGetters; var tslib_1 = require("tslib"); var defaultGetOptionKey = function (option) { var _a; return (_a = option.id) !== null && _a !== void 0 ? _a : option; }; exports.defaultGetOptionKey = defaultGetOptionKey; var defaultGetOptionLabel = function (option) { var _a; return (_a = option.label) !== null && _a !== void 0 ? _a : option; }; exports.defaultGetOptionLabel = defaultGetOptionLabel; var defaultGetOptionDisabled = function (option) { var _a; return (_a = option.disabled) !== null && _a !== void 0 ? _a : false; }; exports.defaultGetOptionDisabled = defaultGetOptionDisabled; function withDefaultGetters(props) { return tslib_1.__assign(tslib_1.__assign({}, props), { getOptionLabel: props.getOptionLabel || exports.defaultGetOptionLabel, getOptionKey: props.getOptionKey || exports.defaultGetOptionKey, getOptionDisabled: props.getOptionDisabled || exports.defaultGetOptionDisabled }); }